Skip to content

Commit 5f699a0

Browse files
committed
Drop metric changes
1 parent 579c737 commit 5f699a0

File tree

11 files changed

+4
-240
lines changed

11 files changed

+4
-240
lines changed

compiler/src/jdk.graal.compiler.management/src/jdk/graal/compiler/management/JMXServiceProvider.java

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@
2727
import static jdk.graal.compiler.serviceprovider.GraalServices.getCurrentThreadId;
2828

2929
import java.io.IOException;
30-
import java.lang.management.GarbageCollectorMXBean;
3130
import java.lang.management.ManagementFactory;
3231
import java.nio.file.Files;
3332
import java.nio.file.Path;
3433
import java.util.List;
35-
import java.util.concurrent.TimeUnit;
3634

3735
import com.sun.management.HotSpotDiagnosticMXBean;
3836
import jdk.graal.compiler.serviceprovider.JMXService;
@@ -98,62 +96,6 @@ protected void dumpHeap(String outputFile, boolean live) throws IOException {
9896
}
9997
}
10098

101-
/**
102-
* Reports information about time in the garbage collector.
103-
*/
104-
static class GCTimeStatisticsImpl implements GCTimeStatistics {
105-
106-
private final List<GarbageCollectorMXBean> gcs;
107-
private final long startTimeNanos;
108-
private final long beforeCount;
109-
private final long beforeMillis;
110-
111-
GCTimeStatisticsImpl(List<GarbageCollectorMXBean> gcs) {
112-
this.gcs = gcs;
113-
long totalCount = 0;
114-
long totalMillis = 0;
115-
for (GarbageCollectorMXBean gc : gcs) {
116-
totalCount += gc.getCollectionCount();
117-
totalMillis += gc.getCollectionTime();
118-
}
119-
beforeCount = totalCount;
120-
beforeMillis = totalMillis;
121-
startTimeNanos = System.nanoTime();
122-
}
123-
124-
@Override
125-
public long getGCTimeMillis() {
126-
long afterMillis = 0;
127-
for (GarbageCollectorMXBean gc : gcs) {
128-
afterMillis += gc.getCollectionTime();
129-
}
130-
return afterMillis - beforeMillis;
131-
}
132-
133-
@Override
134-
public long getGCCount() {
135-
long afterCount = 0;
136-
for (GarbageCollectorMXBean gc : gcs) {
137-
afterCount += gc.getCollectionCount();
138-
}
139-
return afterCount - beforeCount;
140-
}
141-
142-
@Override
143-
public long getElapsedTimeMillis() {
144-
return TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTimeNanos);
145-
}
146-
}
147-
148-
@Override
149-
protected GCTimeStatistics getGCTimeStatistics() {
150-
List<GarbageCollectorMXBean> gcs = ManagementFactory.getGarbageCollectorMXBeans();
151-
if (gcs != null) {
152-
return new GCTimeStatisticsImpl(gcs);
153-
}
154-
return null;
155-
}
156-
15799
private void initHotSpotMXBean() {
158100
if (hotspotMXBean == null) {
159101
synchronized (this) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/common/util/CompilationAlarm.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import jdk.graal.compiler.options.OptionType;
3939
import jdk.graal.compiler.options.OptionValues;
4040
import jdk.graal.compiler.serviceprovider.GraalServices;
41-
import jdk.graal.compiler.serviceprovider.JMXService;
4241
import jdk.vm.ci.meta.ResolvedJavaMethod;
4342

4443
/**
@@ -74,11 +73,6 @@ public static class Options {
7473
private CompilationAlarm(double period) {
7574
this.previous = currentAlarm.get();
7675
reset(period);
77-
JMXService.GCTimeStatistics timing = null;
78-
if (period != 0) {
79-
timing = GraalServices.getGCTimeStatistics();
80-
}
81-
this.gcTiming = timing;
8276
}
8377

8478
/**
@@ -196,13 +190,7 @@ public void checkExpiration() {
196190
cloneTree.durationNS = elapsed();
197191
printTree("", sb, cloneTree, true);
198192

199-
// Include information about time spent in the GC if it's available.
200-
String gcMessage = "";
201-
if (gcTiming != null) {
202-
gcMessage = String.format(" (GC time is %s ms of %s ms elapsed)", gcTiming.getGCTimeMillis(), gcTiming.getElapsedTimeMillis());
203-
}
204-
205-
throw new PermanentBailoutException("Compilation exceeded %.3f seconds%s. %n Phase timings:%n %s <===== TIMEOUT HERE", period, gcMessage, sb.toString().trim());
193+
throw new PermanentBailoutException("Compilation exceeded %.3f seconds. %n Phase timings:%n %s <===== TIMEOUT HERE", period, sb.toString().trim());
206194
}
207195
}
208196

@@ -222,11 +210,6 @@ public void close() {
222210
*/
223211
private long expirationNS;
224212

225-
/**
226-
* Time spent in the garbage collector if it's available.
227-
*/
228-
private final JMXService.GCTimeStatistics gcTiming;
229-
230213
/**
231214
* Signal the execution of the phase identified by {@code name} starts.
232215
*/

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/BaseTimerKey.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ public TimeUnit getTimeUnit() {
4848
return accm.getTimeUnit();
4949
}
5050

51-
@Override
52-
public void add(DebugContext debug, long value, TimeUnit units) {
53-
accm.add(debug, value, units);
54-
}
55-
5651
@Override
5752
public DebugCloseable start(DebugContext debug) {
5853
return accm.start(debug);
@@ -95,13 +90,6 @@ public DebugCloseable start(DebugContext debug) {
9590
}
9691
}
9792

98-
@Override
99-
public void add(DebugContext debug, long value, TimeUnit units) {
100-
if (debug.isTimerEnabled(this)) {
101-
addToCurrentValue(debug, getTimeUnit().convert(value, units));
102-
}
103-
}
104-
10593
@Override
10694
public TimerKey getFlat() {
10795
return (FlatTimer) flat;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/DebugContext.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,6 @@ static final class Immutable {
203203

204204
final boolean listMetrics;
205205

206-
/**
207-
* Names of counters. A counter is active if this set is empty or contains the counter's
208-
* name.
209-
*/
210-
final EconomicSet<String> counters;
211-
212-
/**
213-
* Names of timers. A timer is active if this set is empty or contains the timer's name.
214-
*/
215-
final EconomicSet<String> timers;
216-
217206
/**
218207
* Names of unscoped counters. A counter is unscoped if this set is empty or contains the
219208
* counter's name.
@@ -232,25 +221,6 @@ static final class Immutable {
232221
*/
233222
final EconomicSet<String> unscopedMemUseTrackers;
234223

235-
private static EconomicSet<String> parseMetricSpec(String spec, boolean accumulatedKey) {
236-
if (spec == null) {
237-
return null;
238-
} else if (spec.isEmpty()) {
239-
return EconomicSet.emptySet();
240-
} else {
241-
EconomicSet<String> res = EconomicSet.create();
242-
if (!accumulatedKey) {
243-
res.addAll(Arrays.asList(spec.split(",")));
244-
} else {
245-
for (String n : spec.split(",")) {
246-
res.add(n + AccumulatedKey.ACCUMULATED_KEY_SUFFIX);
247-
res.add(n + AccumulatedKey.FLAT_KEY_SUFFIX);
248-
}
249-
}
250-
return res;
251-
}
252-
}
253-
254224
private static EconomicSet<String> parseUnscopedMetricSpec(String spec, boolean unconditional, boolean accumulatedKey) {
255225
EconomicSet<String> res;
256226
if (spec == null) {
@@ -301,8 +271,6 @@ private static boolean isNotEmpty(OptionKey<String> option, OptionValues options
301271

302272
private Immutable(OptionValues options) {
303273
this.options = options;
304-
this.counters = parseMetricSpec(DebugOptions.Counters.getValue(options), false);
305-
this.timers = parseMetricSpec(DebugOptions.Timers.getValue(options), true);
306274
String timeValue = DebugOptions.Time.getValue(options);
307275
String trackMemUseValue = DebugOptions.TrackMemUse.getValue(options);
308276
this.unscopedCounters = parseUnscopedMetricSpec(DebugOptions.Counters.getValue(options), "".equals(DebugOptions.Count.getValue(options)), false);
@@ -332,8 +300,6 @@ private Immutable() {
332300
this.unscopedMemUseTrackers = null;
333301
this.scopesEnabled = false;
334302
this.listMetrics = false;
335-
this.counters = null;
336-
this.timers = null;
337303
}
338304

339305
public boolean hasUnscopedMetrics() {
@@ -788,14 +754,6 @@ public boolean isDumpEnabled(int dumpLevel) {
788754
return currentScope != null && currentScope.isDumpEnabled(dumpLevel);
789755
}
790756

791-
public boolean areCountersEnabled() {
792-
return immutable.counters != null;
793-
}
794-
795-
public boolean areTimersEnabled() {
796-
return immutable.timers != null;
797-
}
798-
799757
/**
800758
* Determines if verification is enabled in the current scope.
801759
*

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/TimerKey.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ public interface TimerKey extends MetricKey {
5151
*/
5252
long getCurrentValue(DebugContext debug);
5353

54-
/**
55-
* Adds {@code value} to this timer.
56-
*/
57-
void add(DebugContext debug, long value, TimeUnit units);
58-
5954
/**
6055
* Gets the time unit of this timer.
6156
*/

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/CompilationTask.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
import jdk.graal.compiler.phases.tiers.MidTierContext;
7474
import jdk.graal.compiler.phases.tiers.Suites;
7575
import jdk.graal.compiler.printer.GraalDebugHandlersFactory;
76-
import jdk.graal.compiler.serviceprovider.GraalServices;
7776
import jdk.vm.ci.code.BailoutException;
7877
import jdk.vm.ci.code.CodeCacheProvider;
7978
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
@@ -535,7 +534,7 @@ public HotSpotCompilationRequestResult runCompilation(OptionValues initialOption
535534

536535
@SuppressWarnings({"try"})
537536
public HotSpotCompilationRequestResult runCompilation(DebugContext debug) {
538-
try (DebugCloseable a = CompilationTime.start(debug); DebugCloseable b = GraalServices.GCTimerScope.create(debug)) {
537+
try (DebugCloseable a = CompilationTime.start(debug)) {
539538
HotSpotCompilationRequestResult result = runCompilation(debug, new HotSpotCompilationWrapper());
540539
LibGraalSupport libgraal = LibGraalSupport.INSTANCE;
541540
if (libgraal != null) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/phases/LIRPhase.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import jdk.graal.compiler.options.Option;
3737
import jdk.graal.compiler.options.OptionKey;
3838
import jdk.graal.compiler.options.OptionType;
39-
import jdk.graal.compiler.serviceprovider.GraalServices;
4039
import jdk.vm.ci.code.TargetDescription;
4140

4241
/**
@@ -106,19 +105,6 @@ public LIRPhase() {
106105
memUseTracker = statistics.memUseTracker;
107106
}
108107

109-
/**
110-
* This can provide more detail about where GC time is spent but isn't necessary most of the
111-
* time.
112-
*/
113-
static final boolean LIR_PHASE_GC_STATISTICS = false;
114-
115-
private DebugCloseable gcStatistics(DebugContext debug) {
116-
if (LIR_PHASE_GC_STATISTICS) {
117-
return GraalServices.GCTimerScope.create(debug, "LIRPhaseTime_", getClass());
118-
}
119-
return null;
120-
}
121-
122108
public final void apply(TargetDescription target, LIRGenerationResult lirGenRes, C context) {
123109
apply(target, lirGenRes, context, true);
124110
}
@@ -130,8 +116,7 @@ public final void apply(TargetDescription target, LIRGenerationResult lirGenRes,
130116
try (DebugContext.Scope s = debug.scope(name, this)) {
131117
try (CompilerPhaseScope cps = debug.enterCompilerPhase(name, null);
132118
DebugCloseable a = timer.start(debug);
133-
DebugCloseable c = memUseTracker.start(debug);
134-
DebugCloseable d = gcStatistics(debug)) {
119+
DebugCloseable c = memUseTracker.start(debug)) {
135120
run(target, lirGenRes, context);
136121
if (dumpLIR && debug.areScopesEnabled()) {
137122
dumpAfter(lirGenRes);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,11 @@
3737
import java.util.Properties;
3838
import java.util.ServiceConfigurationError;
3939
import java.util.ServiceLoader;
40-
import java.util.concurrent.TimeUnit;
4140

4241
import jdk.graal.compiler.core.ArchitectureSpecific;
4342
import jdk.graal.compiler.core.common.LibGraalSupport;
4443
import jdk.graal.compiler.core.common.NativeImageSupport;
45-
import jdk.graal.compiler.debug.CounterKey;
46-
import jdk.graal.compiler.debug.DebugCloseable;
47-
import jdk.graal.compiler.debug.DebugContext;
4844
import jdk.graal.compiler.debug.GraalError;
49-
import jdk.graal.compiler.debug.TimerKey;
5045
import jdk.internal.misc.VM;
5146
import jdk.vm.ci.code.Architecture;
5247
import jdk.vm.ci.meta.EncodedSpeculationReason;
@@ -511,58 +506,6 @@ public static void dumpHeap(String outputFile, boolean live) throws IOException,
511506
}
512507
}
513508

514-
/**
515-
* Returns a scope which tracks time spent in garbage collection if the Java virtual machine
516-
* supports it.
517-
*/
518-
public static JMXService.GCTimeStatistics getGCTimeStatistics() {
519-
if (jmx == null) {
520-
return null;
521-
}
522-
return jmx.getGCTimeStatistics();
523-
}
524-
525-
public record GCTimerScope(DebugContext debug, JMXService.GCTimeStatistics gcStats, TimerKey garbageCollectionTime, CounterKey garbageCollectionCount) implements DebugCloseable {
526-
527-
/**
528-
* Time spent in garbage collection during this compilation.
529-
*/
530-
static final TimerKey GarbageCollectionTime = DebugContext.timer("GarbageCollectionTime").doc("Time spent in GC during compilation and code installation.");
531-
532-
/**
533-
* Number of garbage collection during this compilation.
534-
*/
535-
static final CounterKey GarbageCollectionCount = DebugContext.counter("GarbageCollectionCount").doc("Number of GCs during compilation and code installation.");
536-
537-
public static DebugCloseable create(DebugContext debug) {
538-
if (debug.areCountersEnabled() || debug.areTimersEnabled()) {
539-
final JMXService.GCTimeStatistics gcStats = GraalServices.getGCTimeStatistics();
540-
if (gcStats != null) {
541-
return new GCTimerScope(debug, gcStats, GarbageCollectionTime, GarbageCollectionCount);
542-
}
543-
}
544-
return null;
545-
}
546-
547-
public static DebugCloseable create(DebugContext debug, String prefix, Class<?> forClass) {
548-
if (debug.areCountersEnabled() || debug.areTimersEnabled()) {
549-
final JMXService.GCTimeStatistics gcStats = GraalServices.getGCTimeStatistics();
550-
if (gcStats != null) {
551-
return new GCTimerScope(debug, gcStats,
552-
DebugContext.timer("%s%s_GarbageCollectionTime", prefix, forClass),
553-
DebugContext.counter("%s%s_GarbageCollectionCount", prefix, forClass));
554-
}
555-
}
556-
return null;
557-
}
558-
559-
@Override
560-
public void close() {
561-
garbageCollectionCount.add(debug, gcStats.getGCCount());
562-
garbageCollectionTime.add(debug, gcStats.getGCTimeMillis(), TimeUnit.MILLISECONDS);
563-
}
564-
}
565-
566509
/**
567510
* Returns the fused multiply add of the three arguments; that is, returns the exact product of
568511
* the first two arguments summed with the third argument and then rounded once to the nearest

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/JMXService.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,4 @@ public abstract class JMXService {
5151
* @throws IOException if an IO error occurred during dumping
5252
*/
5353
protected abstract void dumpHeap(String outputFile, boolean live) throws IOException;
54-
55-
/**
56-
* Reports information about time in the garbage collector.
57-
*/
58-
public interface GCTimeStatistics {
59-
/**
60-
* The number of GCs since the creation of this object.
61-
*/
62-
long getGCCount();
63-
64-
/**
65-
* The amount of time spent in the garbage collector since the creation of this object.
66-
*/
67-
long getGCTimeMillis();
68-
69-
/**
70-
* The time since the creation of this object.
71-
*/
72-
long getElapsedTimeMillis();
73-
}
74-
75-
/**
76-
* Provides access to information about time spent in the garbage collector.
77-
*/
78-
protected abstract GCTimeStatistics getGCTimeStatistics();
7954
}

0 commit comments

Comments
 (0)