RFR: 8359110: Log accumulated GC and process CPU time upon VM exit [v5]
Jonas Norlinder
duke at openjdk.org
Mon Jun 16 11:52:28 UTC 2025
On Mon, 16 Jun 2025 07:40:27 GMT, David Holmes <dholmes at openjdk.org> wrote:
> This seems reasonable though I'm unclear on some details. Could you give a
> high-level description of what times we capture for what threads and when, and
> the calculations involved. Thanks.
What threads:
* All GC threads e.g. director thread, sample threads, worker threads, driver
threads (except for ZGC where I currently exclude the "runtime" threads which
we may decide to change, see @tschatzl comments above)
* The VM thread, but only include VM operations related to GC
* The string deduplication thread
What times:
* CPU time for all the threads above
* CPU time for the entire process
When:
* VM thread:
- If VM operation is GC and `-Xlog:gc` or more is enabled, sample `start`, and `end` CPU time
for the GC operation. Add `end - start` to `gc_vm_vtime`.
* GC threads:
- If `-Xlog:gc` or more is enabled, sample all GC threads and store the CPU
time sum to `gc_threads_vtime` during VM exit.
* String deduplication thread:
- If string deduplication is enabled and if `-Xlog:gc` or more is enabled
sample CPU time during VM exit for that thread and store to `string_deduplication_vtime`
* Process:
- If `-Xlog:gc` or more is enabled, sample the CPU time for the entire process
Log accumulated CPU time `gc_threads_vtime + gc_vm_vtime + string_deduplication_vtime`
as a percentage of the total process CPU time. We sample the total process CPU
time with the new method `os::elapsed_process_vtime`.
It should be noted from the above that calling elapsed_gc_vtime assumes that
-Xlog:gc or more is enabled. If one breaks this assumption the GC CPU time will
not include VM thread and may be horribly wrong (e.g. if one runs Serial).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25779#issuecomment-2976252452
More information about the hotspot-gc-dev
mailing list