Skip to content

Commit 4d13812

Browse files
JonasNorlinderPaul Hohensee
authored andcommitted
8373625: CPUTimeCounters creates a total counter for unsupported GCs
Backport-of: 30be940
1 parent 8cb7c08 commit 4d13812

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/hotspot/share/runtime/cpuTimeCounters.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define SHARE_RUNTIME_CPUTIMECOUNTERS_HPP
2929

3030

31+
#include "gc/shared/gc_globals.hpp"
3132
#include "memory/iterator.hpp"
3233
#include "runtime/os.hpp"
3334
#include "runtime/perfData.hpp"
@@ -83,7 +84,9 @@ class CPUTimeCounters: public CHeapObj<mtServiceability> {
8384
assert(_instance == nullptr, "we can only allocate one CPUTimeCounters object");
8485
if (UsePerfData && os::is_thread_cpu_time_supported()) {
8586
_instance = new CPUTimeCounters();
86-
create_counter(SUN_THREADS, CPUTimeGroups::CPUTimeType::gc_total);
87+
if (UseG1GC || UseParallelGC) {
88+
create_counter(SUN_THREADS, CPUTimeGroups::CPUTimeType::gc_total);
89+
}
8790
}
8891
}
8992

0 commit comments

Comments
 (0)