RFR: 8369449: Spec: introduce new JVMTI function GetTotalGCCpuTime
Jonas Norlinder
duke at openjdk.org
Fri Oct 17 22:59:59 UTC 2025
On Fri, 17 Oct 2025 21:02:08 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
> With [JDK-8359110](https://bugs.openjdk.org/browse/JDK-8359110) a framework to measure GC CPU time was introduced.
> It will be exposed in JMX as `MemoryMXBean.getTotalGcCpuTime()`. There is also interest to get the same performance data from JVMTI.
> The following API's are being added with this enhancement:
>
> Introduce:
> - new capability: `can_get_gc_cpu_time`
> - new JVMTI functions:
> - `jvmtiError GetGCCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr)`
> - `jvmtiError GetTotalGCCpuTime(jvmtiEnv* env, jlong* nanos_ptr)`
>
> The related CSR will be created shortly.
>
> Testing:
> - TBD: Mach5 tiers 1-6
Thanks for making this happen! I think it looks good from my point of view, I have just one question, is it safe to skip the check for `os::is_thread_cpu_time_supported`? One might ask why `CPUTimeUsage` does not handle that, but since these methods are also used by internal GC functionality this was intentionally omitted for performance reasons (and some GCs like G1 won't run if thread CPU time is not supported so that call is not always needed). I'm no JVMTI expert so this might be fine, like how its fine for G1 to omit calling it, but just wanted to ask.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27879#pullrequestreview-3352329567
More information about the serviceability-dev
mailing list