RFR: 8359110: Log accumulated GC and process CPU time upon VM exit [v2]
Thomas Schatzl
tschatzl at openjdk.org
Thu Jun 12 13:53:28 UTC 2025
On Thu, 12 Jun 2025 13:35:51 GMT, Jonas Norlinder <duke at openjdk.org> wrote:
>> Add support to log CPU cost for GC during VM exit with `-Xlog:gc`.
>>
>>
>> [1.500s][info ][gc] GC CPU cost: 1.75%
>>
>>
>> Additionally, detailed information may be retrieved with `-Xlog:gc=trace`
>>
>>
>> [1.500s][trace][gc] Process CPU time: 4.945370s
>> [1.500s][trace][gc] GC CPU time: 0.086382s
>> [1.500s][info ][gc] GC CPU cost: 1.75%
>
> Jonas Norlinder has updated the pull request incrementally with two additional commits since the last revision:
>
> - Remove unused bool
> - Refactor vtime logic in evaluate_operation into a stack object and call CPUTimeCounters without indirection
Changes requested by tschatzl (Reviewer).
src/hotspot/share/gc/g1/g1CollectedHeap.cpp line 1498:
> 1496: _cr->threads_do(&cl);
> 1497: _cm->threads_do(&cl);
> 1498: _workers->threads_do(&cl);
There is `CollectedHeap::gc_threads_do()` (in general, for all collectors) to iterate over GC threads. Please use that. It may allow putting all that code into `CollectedHeap` used by all collectors too.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25779#pullrequestreview-2921251009
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2142799289
More information about the hotspot-gc-dev
mailing list