jmx-dev RFR: 8368527: JMX: Add an MXBeans method to query GC CPU time

Jonas Norlinder duke at openjdk.org
Tue Sep 30 11:44:43 UTC 2025


On Tue, 30 Sep 2025 10:45:27 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> In the CSR discussion I proposed changing the method name to `getTotalGcCpuTime()` as @kevinjwalls raised concerns about conflating it with per generation CPU timings. Would the renaming to `getTotalGcCpuTime()` also solve your concern here?
>
> Also, genesis (Universe::genesis()?), is a VM detail that may be unclear.  Do we mean:
> "
> Returns the CPU time used by all garbage collection threads.
> 
> This includes time for all driver threads, workers, VM operations
> on the VM thread, and the string deduplication thread (if enabled). 
> Therefore the value can be non-zero even if no garbage collection cycles have occurred. 
> 
> This method returns {@code -1} if the platform does not support this operation, or if called during shutdown.
> "

I meant genesis in the literal sense i.e. since thread creation not relating to `Universe::genesis`. It may be non-zero since each there may do some initialization work and thus CPU time would be non-zero. However given @AlanBateman comment about being HotSpot VM specific should we avoid talking about these specific details here?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27537#discussion_r2391079350


More information about the jmx-dev mailing list