RFR: 8364638: Refactor and make accumulated GC CPU time code generic [v10]

Stefan Johansson sjohanss at openjdk.org
Wed Aug 20 08:17:43 UTC 2025


On Tue, 19 Aug 2025 15:54:29 GMT, Jonas Norlinder <duke at openjdk.org> wrote:

>>> now we finally have a specific method that is called for GC activites...
>> 
>> Then, it should be in `Universe::before_exit`, not inside heap.
>
> FWIW; `Universe::print_on` do actually call collected heap as well.
> 
> 
> void Universe::print_on(outputStream* st) {
>   GCMutexLocker hl(Heap_lock); // Heap_lock might be locked by caller thread.
>   st->print_cr("Heap");
> 
>   StreamIndentor si(st, 1);
>   heap()->print_heap_on(st);
>   MetaspaceUtils::print_on(st);
> }
> 
> 
> I would be OK with moving it to `Universe::before_exit` and I can see the argument that the log message is conflated with components that are not strictly GC. That being said, I think it would also make sense from a code perspective to put it under GC as the log tag is defined to be GC. The best solution would probably be to redefine the log tags and break the block apart, but that would be out-of-scope for this PR. I'll wait for @kstefanj input before proceeding.

I'm good with moving it to `Universe::before_exit` as well. Looks like a good fit now when it was added.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26621#discussion_r2287363859


More information about the hotspot-dev mailing list