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

Stefan Karlsson stefank at openjdk.org
Mon Jun 30 14:05:42 UTC 2025


On Mon, 30 Jun 2025 13:35:23 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 with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
> 
>  - Merge branch 'master' of github.com:JonasNorlinder/openjdk_jdk into gc_cpu_time
>  - Implement CollectedHeap::before_exit() as suggested by @stefank
>  - Remove incorrect is_gc_operation call after rebase
>  - More clean up, remove virtual
>  - Fixes after feedback from @stefank
>  - Remove extra whitespace
>  - operation_is_gc -> is_gc_operation per @stefank suggestion
>  - Only sample if needed
>  - Remove explicit super call and minor fixes
>  - Add CPU time tracking for string deduplication to log_gc_vtime
>  - ... and 8 more: https://git.openjdk.org/jdk/compare/aa191119...0993931f

I missed that you hadn't changed this:

LogTarget(Info, gc) out;

I would prefer to see this getting moved over to gc+cpu (alt. gc+cpu+exit).

src/hotspot/share/gc/shared/collectedHeap.cpp line 70:

> 68: size_t CollectedHeap::_filler_array_max_size = 0;
> 69: size_t CollectedHeap::_stack_chunk_max_size = 0;
> 70: jlong  CollectedHeap::_vm_vtime = 0;

I'm not sure that the `vm` prefix is fitting for this name.

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

PR Review: https://git.openjdk.org/jdk/pull/25779#pullrequestreview-2971365591
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2175161128


More information about the hotspot-gc-dev mailing list