RFR: 8359110: Log accumulated GC and process CPU time upon VM exit [v3]

Albert Mingkun Yang ayang at openjdk.org
Fri Jun 13 13:07:45 UTC 2025


On Fri, 13 Jun 2025 12:51:40 GMT, Jonas Norlinder <duke at openjdk.org> wrote:

>> src/hotspot/share/gc/z/zCollectedHeap.cpp line 123:
>> 
>>> 121:       Atomic::add(&_vtime, os::thread_cpu_time(thread));
>>> 122:     }
>>> 123:   }
>> 
>> Why does this exclude threads like the `ZDirector` and other ZGC background threads? That thread seems to clearly be relevant to ZGC operation, doing so would make the measurement incomplete.
>> The change does not exclude e.g. some random G1 "director" threads either, even if they do not contribute much to the result.
>
> I believe it does not exclude ZDirector, etc. Adding `printf("%s\n", thread->name());` to prove my point results in:
> 
> 
> ZDirector
> ZDriverMajor
> ZDriverMinor
> ZStat
> ZUncommitter#0
> ZWorkerYoung#0
> ZWorkerYoung#1
> ZWorkerYoung#2
> ZWorkerYoung#3
> ZWorkerOld#0
> ZWorkerOld#1
> ZWorkerOld#2
> ZWorkerOld#3
> 
> 
> This code is working around the fact that `ZCollectedHeap::gc_threads_do` also calls `_runtime_workers.threads_do` which I believe do not participate in GC related work.

Both Parallel and G1 reuse the same gc-worker threads in `safepoint_workers()` for non-gc work, just fyi.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2145051424


More information about the hotspot-gc-dev mailing list