8373625: CPUTimeCounters creates a total counter for unsupported GCs

Reviewed-by: sjohanss, tschatzl
This commit is contained in:
Jonas Norlinder 2025-12-16 21:33:27 +00:00 committed by David Holmes
parent 2241218ef6
commit 30be94086a

View File

@ -28,6 +28,7 @@
#define SHARE_RUNTIME_CPUTIMECOUNTERS_HPP
#include "gc/shared/gc_globals.hpp"
#include "memory/iterator.hpp"
#include "runtime/os.hpp"
#include "runtime/perfData.hpp"
@ -83,7 +84,9 @@ public:
assert(_instance == nullptr, "we can only allocate one CPUTimeCounters object");
if (UsePerfData && os::is_thread_cpu_time_supported()) {
_instance = new CPUTimeCounters();
create_counter(SUN_THREADS, CPUTimeGroups::CPUTimeType::gc_total);
if (UseG1GC || UseParallelGC) {
create_counter(SUN_THREADS, CPUTimeGroups::CPUTimeType::gc_total);
}
}
}