Skip to content

Commit

Permalink
Introduce PrintAnalysisCallTreeType option
Browse files Browse the repository at this point in the history
This option enables users to choose the structure of the call tree
report. Currently supported formats are txt and csv.

The use of this flag implicitly enables PrintAnalysisCallTree option.

Closes: oracle#3843
  • Loading branch information
zakkak committed Oct 19, 2021
1 parent fe5a8b8 commit bc0eb6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.oracle.graal.pointsto.reports;

import org.graalvm.collections.EconomicMap;
import org.graalvm.compiler.options.EnumOptionKey;
import org.graalvm.compiler.options.Option;
import org.graalvm.compiler.options.OptionKey;

Expand Down Expand Up @@ -52,6 +53,15 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o
}
};

@Option(help = "Change the output format of the analysis call tree. See: Reports.md.")//
public static final EnumOptionKey<CallTreeType> PrintAnalysisCallTreeType = new EnumOptionKey<CallTreeType>(CallTreeType.TXT) {
@Override
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, CallTreeType oldValue, CallTreeType newValue) {
super.onValueUpdate(values, oldValue, newValue);
PrintAnalysisCallTree.update(values, true);
}
};

@Option(help = "Print image object hierarchy.")//
public static final OptionKey<Boolean> PrintImageObjectTree = new OptionKey<>(false);

Expand All @@ -66,4 +76,9 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o

@Option(help = "Suppress the expansion of specified types. See: Reports.md.")//
public static final OptionKey<String> ImageObjectTreeSuppressTypes = new OptionKey<>("");

enum CallTreeType {
TXT,
CSV;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,21 @@ public static void print(BigBang bb, String reportsPath, String reportName) {
CallTreePrinter printer = new CallTreePrinter(bb);
printer.buildCallTree();

ReportUtils.report("call tree", reportsPath, "call_tree_" + reportName, "txt",
printer::printMethods);
switch (AnalysisReportsOptions.PrintAnalysisCallTreeType.getValue(bb.getOptions())) {
case TXT:
ReportUtils.report("call tree", reportsPath, "call_tree_" + reportName, "txt",
printer::printMethods);
break;
case CSV:
printCsvFiles(printer.methodToNode, reportsPath, reportName);
break;
}
ReportUtils.report("list of used methods", reportsPath, "used_methods_" + reportName, "txt",
printer::printUsedMethods);
ReportUtils.report("list of used classes", reportsPath, "used_classes_" + reportName, "txt",
writer -> printer.printClasses(writer, false));
ReportUtils.report("list of used packages", reportsPath, "used_packages_" + reportName, "txt",
writer -> printer.printClasses(writer, true));

printCsvFiles(printer.methodToNode, reportsPath, reportName);
}

interface Node {
Expand Down

0 comments on commit bc0eb6f

Please sign in to comment.