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

Jonas Norlinder duke at openjdk.org
Mon Jun 16 21:15:29 UTC 2025


On Mon, 16 Jun 2025 12:50:17 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 one additional commit since the last revision:
> 
>   operation_is_gc -> is_gc_operation per @stefank suggestion

> After all both of these VM operations are VM_GC_Operations.

@tschatzl Thanks for pointing that out, that's an excellent point!

Your comment caused me to reflect over that I have currently defined all operations as GC operations if they inherit from `VM_GC_Sync_Operation`. However the following should probably not be strictly counted as a GC activity: `VM_GC_HeapInspection`, `VM_PopulateDynamicDumpSharedSpace`, `VM_Verify`, `VM_PopulateDumpSharedSpace`. I will update the PR.

> So one option is duplicating these workers in G1/Parallel too, and fix https://bugs.openjdk.org/browse/JDK-8277394. 

Thanks for the suggestion, I agree that we should do that to fix the root issue.

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

PR Comment: https://git.openjdk.org/jdk/pull/25779#issuecomment-2978167405


More information about the hotspot-gc-dev mailing list