Thread CPU times of G1 background threads

Markus Gaisbauer markus.gaisbauer at
Wed Jun 3 12:26:47 UTC 2015


I am working on a JVMTI agent and currently try to get a good estimate on
the total amount of CPU time consumed by the VM for GC.

I already found out about
and InternalThreadCpuTimes. Unfortunately this does not work for G1 which
fails to deliver metrics for the following threads:
* G1 Main Concurrent Mark GC Thread
* G1 Parallel Marking Threads
* G1 Concurrent Refinement Thread

I suspect this has to do with the current implementation of
G1CollectedHeap::gc_threads_do which differs
from G1CollectedHeap::print_gc_threads_on (jstack shows all G1 related

Is this a bug or somehow difficult to change? Is there a better way to get
CPU times from internal VM threads from native code in my agent? The JVMTI
operation GetAllThreads unfortunately does not return internal threads. I
can think of one possible solution that parses output of thread dumps
to detect native thread IDs of GC related threads and determine thread CPU
time this way.

Thank you for any comments and hints,
Markus Gaisbauer (Dynatrace)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the hotspot-gc-dev mailing list