Skip to content

Commit 5cd86bc

Browse files
committed
report hot metrics: add boolean option and default phase plan setting
1 parent f816a7d commit 5cd86bc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ReportHotMetricsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static int snippet01(int limit1) {
5959
public void testAbsNegate() {
6060
ByteArrayOutputStream bos = new ByteArrayOutputStream();
6161
try (TTY.Filter ttyFilter = new TTY.Filter(new LogStream(bos))) {
62-
OptionValues opt = new OptionValues(getInitialOptions(), BasePhase.PhaseOptions.ReportHotMetricsAfterPhases, "BoxNodeIdentity=*.snippet01");
62+
OptionValues opt = new OptionValues(getInitialOptions(), BasePhase.PhaseOptions.ReportHotMetrics, true, BasePhase.PhaseOptions.ReportHotMetricsAfterPhases, "BoxNodeIdentity=*.snippet01");
6363
test(opt, "snippet01", 100);
6464
}
6565
// the missing profile

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/BasePhase.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public static class PhaseOptions {
205205
@Option(help = "Exclude certain phases from compilation based on the given phase filter(s)." + PhaseFilterKey.HELP, type = OptionType.Debug)
206206
public static final PhaseFilterKey CompilationExcludePhases = new PhaseFilterKey(null, null);
207207
@Option(help = "Report hot metrics after each phase matching the given phase filter(s).", type = OptionType.Debug)
208-
public static final PhaseFilterKey ReportHotMetricsAfterPhases = new PhaseFilterKey(null, null);
208+
public static final PhaseFilterKey ReportHotMetricsAfterPhases = new PhaseFilterKey("DominatorBasedGlobalValueNumberingPhase=*", null);
209+
@Option(help = "Report hot metrics extracted from compiler IR.", type = OptionType.Debug)
210+
public static final OptionKey<Boolean> ReportHotMetrics = new OptionKey<>(false);
209211
// @formatter:on
210212
}
211213

@@ -498,7 +500,7 @@ public final void apply(final StructuredGraph graph, final C context, final bool
498500
}
499501
}
500502

501-
if (PhaseOptions.ReportHotMetricsAfterPhases.matches(options, this, graph)) {
503+
if (PhaseOptions.ReportHotMetrics.getValue(options) && PhaseOptions.ReportHotMetricsAfterPhases.matches(options, this, graph)) {
502504
String label = graph.name != null ? graph.name : graph.method().format("%H.%n(%p)");
503505
TTY.println("Reporting hot metrics after " + getName() + " during compilation of " + label);
504506
new ReportHotCodePhase().apply(graph, context);

0 commit comments

Comments
 (0)