Skip to content

Commit 28cef2a

Browse files
author
Alina Weber-Hohengrund
committed
[GR-66463] Remove scoped metrics
PullRequest: graal/21234
2 parents 9d16ee9 + 5c31297 commit 28cef2a

File tree

54 files changed

+187
-676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+187
-676
lines changed

compiler/docs/Debugging.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ to obtain per-method metric values.
189189

190190
## Method filtering
191191

192-
Specifying one of the debug scope options (i.e., `-Djdk.graal.Log`, `-Djdk.graal.Dump`, `-Djdk.graal.Count`,
193-
`-Djdk.graal.Time`, or `-Djdk.graal.TrackMemUse`) can generate a lot of output. Typically, you are only
192+
Specifying one of the debug scope options (i.e., `-Djdk.graal.Log`, `-Djdk.graal.Dump`, `-Djdk.graal.Counter`,
193+
`-Djdk.graal.Timer`, or `-Djdk.graal.MemUseTracker`) can generate a lot of output. Typically, you are only
194194
interesting in compiler output related to a single or few methods. In this case, use the
195195
`-Djdk.graal.MethodFilter` option to specify a method filter. The matching logic for this option is
196196
described in
@@ -201,7 +201,7 @@ and documented in the
201201
## Metric filtering
202202

203203
Alternatively, you may only want to see certain metrics. The `-Djdk.graal.Timers`, `-Djdk.graal.Counters`
204-
and `-Djdk.graal.MemUseTrackers` exist for this purpose. These options take a comma separated list of
204+
and `-Djdk.graal.MemUseTrackers` track everything if nothing is specified. Else, these options take a comma separated list of
205205
metrics names. Only the named metrics will be activated and reported. To see the available metric
206206
names, specify `-Djdk.graal.ListMetrics=true`. At VM shutdown this option lists all the metrics that
207207
were encountered during the VM execution. It does not list metrics registered on non-executed paths

compiler/mx.compiler/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@
523523
"jdk.graal.compiler.code.DisassemblerProvider",
524524
"jdk.graal.compiler.core.match.MatchStatementSet",
525525
"jdk.graal.compiler.core.common.LibGraalSupport",
526-
"jdk.graal.compiler.debug.DebugHandlersFactory",
526+
"jdk.graal.compiler.debug.DebugDumpHandlersFactory",
527527
"jdk.graal.compiler.debug.TTYStreamProvider",
528528
"jdk.graal.compiler.debug.PathUtilitiesProvider",
529529
"jdk.graal.compiler.hotspot.HotSpotBackendFactory",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
import jdk.graal.compiler.core.target.Backend;
8282
import jdk.graal.compiler.debug.DebugContext;
8383
import jdk.graal.compiler.debug.DebugDumpHandler;
84-
import jdk.graal.compiler.debug.DebugHandlersFactory;
84+
import jdk.graal.compiler.debug.DebugDumpHandlersFactory;
8585
import jdk.graal.compiler.debug.GraalError;
8686
import jdk.graal.compiler.debug.TTY;
8787
import jdk.graal.compiler.graph.Node;
@@ -490,7 +490,7 @@ protected DebugContext getDebugContext() {
490490
}
491491

492492
@Override
493-
protected Collection<DebugHandlersFactory> getDebugHandlersFactories() {
493+
protected Collection<DebugDumpHandlersFactory> getDebugHandlersFactories() {
494494
return Collections.singletonList(new GraalDebugHandlersFactory(getSnippetReflection()));
495495
}
496496

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,6 @@ int getLevel() {
106106
}
107107
}
108108

109-
private static final class InvalidVerifyUsagePhase extends TestPhase {
110-
@Override
111-
protected void run(StructuredGraph graph) {
112-
DebugContext debug = graph.getDebug();
113-
debug.verify(graph, "%s", graph.toString());
114-
}
115-
116-
}
117-
118109
private static final class InvalidConcatLogUsagePhase extends TestPhase {
119110
@Override
120111
protected void run(StructuredGraph graph) {
@@ -148,15 +139,6 @@ protected void run(StructuredGraph graph) {
148139

149140
}
150141

151-
static class InvalidConcatVerifyUsagePhase extends TestPhase {
152-
@Override
153-
protected void run(StructuredGraph graph) {
154-
DebugContext debug = graph.getDebug();
155-
debug.verify(graph, "error " + graph);
156-
}
157-
158-
}
159-
160142
static class ValidLogUsagePhase extends TestPhase {
161143
@Override
162144
protected void run(StructuredGraph graph) {
@@ -190,15 +172,6 @@ protected void run(StructuredGraph graph) {
190172

191173
}
192174

193-
static class ValidVerifyUsagePhase extends TestPhase {
194-
@Override
195-
protected void run(StructuredGraph graph) {
196-
DebugContext debug = graph.getDebug();
197-
debug.verify(graph, "%s", graph);
198-
}
199-
200-
}
201-
202175
static class InvalidGraalErrorGuaranteePhase extends TestPhase {
203176
@Override
204177
protected void run(StructuredGraph graph) {
@@ -239,11 +212,6 @@ public void testLogAndIndentInvalid() {
239212
testDebugUsageClass(InvalidLogAndIndentUsagePhase.class);
240213
}
241214

242-
@Test(expected = VerificationError.class)
243-
public void testVerifyInvalid() {
244-
testDebugUsageClass(InvalidVerifyUsagePhase.class);
245-
}
246-
247215
@Test(expected = VerificationError.class)
248216
public void testDumpInvalid() {
249217
testDebugUsageClass(InvalidDumpUsagePhase.class);
@@ -269,11 +237,6 @@ public void testLogAndIndentInvalidConcat() {
269237
testDebugUsageClass(InvalidConcatLogAndIndentUsagePhase.class);
270238
}
271239

272-
@Test(expected = VerificationError.class)
273-
public void testVerifyInvalidConcat() {
274-
testDebugUsageClass(InvalidConcatVerifyUsagePhase.class);
275-
}
276-
277240
@Test(expected = VerificationError.class)
278241
public void testDumpInvalidConcat() {
279242
testDebugUsageClass(InvalidConcatDumpUsagePhase.class);
@@ -289,11 +252,6 @@ public void testLogAndIndentValid() {
289252
testDebugUsageClass(ValidLogAndIndentUsagePhase.class);
290253
}
291254

292-
@Test
293-
public void testVerifyValid() {
294-
testDebugUsageClass(ValidVerifyUsagePhase.class);
295-
}
296-
297255
@Test
298256
public void testDumpValid() {
299257
testDebugUsageClass(ValidDumpUsagePhase.class);

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/debug/test/DebugContextTest.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@
5050
import jdk.graal.compiler.debug.DebugContext.Builder;
5151
import jdk.graal.compiler.debug.DebugContext.Scope;
5252
import jdk.graal.compiler.debug.DebugDumpHandler;
53-
import jdk.graal.compiler.debug.DebugHandler;
54-
import jdk.graal.compiler.debug.DebugHandlersFactory;
53+
import jdk.graal.compiler.debug.DebugDumpHandlersFactory;
5554
import jdk.graal.compiler.debug.DebugOptions;
56-
import jdk.graal.compiler.debug.DebugVerifyHandler;
5755
import jdk.graal.compiler.options.OptionKey;
5856
import jdk.graal.compiler.options.OptionValues;
5957
import jdk.graal.compiler.serviceprovider.GraalServices;
@@ -64,19 +62,14 @@ static class DebugContextSetup {
6462
final Formatter dumpOutput = new Formatter();
6563
final Formatter verifyOutput = new Formatter();
6664
final ByteArrayOutputStream logOutput = new ByteArrayOutputStream();
67-
DebugHandlersFactory handlers = new DebugHandlersFactory() {
65+
DebugDumpHandlersFactory handlers = new DebugDumpHandlersFactory() {
6866
@Override
69-
public List<DebugHandler> createHandlers(OptionValues options) {
67+
public List<DebugDumpHandler> createHandlers(OptionValues options) {
7068
return Arrays.asList(new DebugDumpHandler() {
7169
@Override
7270
public void dump(Object object, DebugContext ignore, boolean forced, String format, Object... arguments) {
7371
dumpOutput.format("Dumping %s with label \"%s\"%n", object, String.format(format, arguments));
7472
}
75-
}, new DebugVerifyHandler() {
76-
@Override
77-
public void verify(DebugContext ignore, Object object, String format, Object... args) {
78-
verifyOutput.format("Verifying %s with label \"%s\"%n", object, String.format(format, args));
79-
}
8073
});
8174
}
8275
};
@@ -95,7 +88,6 @@ public void testDisabledScopes() {
9588
DebugContext.Scope _ = debug.scope("TestDisabledScoping")) {
9689
for (int level = DebugContext.BASIC_LEVEL; level <= DebugContext.VERY_DETAILED_LEVEL; level++) {
9790
debug.dump(level, "an object", "at level %d", level);
98-
debug.verify("an object", "at level %d", level);
9991
debug.log(level, "log statement at level %d", level);
10092
}
10193
}
@@ -341,11 +333,11 @@ public void testDebugConfig() {
341333
@Test
342334
public void testIsCountEnabled1() {
343335
EconomicMap<OptionKey<?>, Object> map = EconomicMap.create();
344-
map.put(DebugOptions.Count, "");
336+
map.put(DebugOptions.Counters, "");
345337
OptionValues options = new OptionValues(map);
346338
DebugContext debug = new Builder(options).build();
347339
try (Scope _ = debug.scope("Scope")) {
348-
Assert.assertTrue(debug.isCountEnabled());
340+
Assert.assertTrue(debug.areCountersEnabled());
349341
}
350342
}
351343

@@ -356,7 +348,7 @@ public void testIsCountEnabled2() {
356348
OptionValues options = new OptionValues(map);
357349
DebugContext debug = new Builder(options).build();
358350
try (Scope _ = debug.scope("Scope")) {
359-
Assert.assertTrue(debug.isCountEnabled());
351+
Assert.assertTrue(debug.areCountersEnabled());
360352
}
361353
}
362354

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/debug/test/TimerKeyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private static long spin(long ms) {
8383
@Test
8484
public void test2() {
8585
EconomicMap<OptionKey<?>, Object> map = EconomicMap.create();
86-
map.put(DebugOptions.Time, "");
86+
map.put(DebugOptions.Timers, "");
8787
OptionValues options = new OptionValues(map);
8888
DebugContext debug = new Builder(options, NO_CONFIG_CUSTOMIZERS).build();
8989

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/test/GraalTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import jdk.graal.compiler.debug.DebugContext;
5959
import jdk.graal.compiler.debug.DebugContext.Builder;
6060
import jdk.graal.compiler.debug.DebugDumpHandler;
61-
import jdk.graal.compiler.debug.DebugHandlersFactory;
61+
import jdk.graal.compiler.debug.DebugDumpHandlersFactory;
6262
import jdk.graal.compiler.debug.GlobalMetrics;
6363
import jdk.graal.compiler.graph.Node;
6464
import jdk.graal.compiler.nodes.StructuredGraph;
@@ -487,9 +487,9 @@ public static void assertFalse(boolean condition, String message, Object... obje
487487
}
488488

489489
/**
490-
* Gets the {@link DebugHandlersFactory}s available for a {@link DebugContext}.
490+
* Gets the {@link DebugDumpHandlersFactory}s available for a {@link DebugContext}.
491491
*/
492-
protected Collection<DebugHandlersFactory> getDebugHandlersFactories() {
492+
protected Collection<DebugDumpHandlersFactory> getDebugHandlersFactories() {
493493
return Collections.emptyList();
494494
}
495495

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/truffle/test/BytecodeInterpreterPartialEvaluationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public void manyIfsProgram() {
644644

645645
@Override
646646
protected OptionValues getGraalOptions() {
647-
return new OptionValues(super.getGraalOptions(), DebugOptions.Count, "", DebugOptions.Time, "");
647+
return new OptionValues(super.getGraalOptions(), DebugOptions.Counters, "", DebugOptions.Timers, "");
648648
}
649649

650650
public abstract static class Inst {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/CompilationWrapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626

2727
import static jdk.graal.compiler.core.CompilationWrapper.ExceptionAction.ExitVM;
2828
import static jdk.graal.compiler.core.common.GraalOptions.TrackNodeSourcePosition;
29-
import static jdk.graal.compiler.debug.DebugOptions.Count;
3029
import static jdk.graal.compiler.debug.DebugOptions.Dump;
3130
import static jdk.graal.compiler.debug.DebugOptions.DumpPath;
3231
import static jdk.graal.compiler.debug.DebugOptions.MethodFilter;
3332
import static jdk.graal.compiler.debug.DebugOptions.PrintBackendCFG;
34-
import static jdk.graal.compiler.debug.DebugOptions.Time;
33+
import static jdk.graal.compiler.debug.DebugOptions.Counters;
34+
import static jdk.graal.compiler.debug.DebugOptions.Timers;
3535
import static jdk.graal.compiler.debug.PathUtilities.getPath;
3636
import static jdk.graal.compiler.debug.DebugOptions.RecordForReplay;
3737

@@ -393,8 +393,8 @@ private OptionValues getRetryOptions(OptionValues initialOptions, String dumpPat
393393
* turn if explicitly set in DiagnoseOptions.
394394
*/
395395
values.put(MethodFilter, null);
396-
values.put(Count, "");
397-
values.put(Time, "");
396+
values.put(Counters, "");
397+
values.put(Timers, "");
398398
values.put(DumpPath, dumpPath);
399399
values.put(PrintBackendCFG, true);
400400
values.put(TrackNodeSourcePosition, true);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/gen/LIRCompilerBackend.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public static void emitCode(Backend backend,
235235
compilationResult.setSpeculationLog(speculationLog);
236236
}
237237
crb.finish();
238-
if (debug.isCountEnabled()) {
238+
if (debug.areCountersEnabled()) {
239239
List<DataPatch> ldp = compilationResult.getDataPatches();
240240
JavaKind[] kindValues = JavaKind.values();
241241
CounterKey[] dms = new CounterKey[kindValues.length];

0 commit comments

Comments
 (0)