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

Jonas Norlinder duke at openjdk.org
Mon Jun 30 13:35:23 UTC 2025


On Mon, 23 Jun 2025 18:57:51 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> I think it makes sense. We want to log the total GC CPU time before exiting. The latest point we can do that is right before we terminate threads, which we do in when we call `ConcurrentGCThread::stop`. I am open for any suggestions to rename `log_gc_vtime` in case that would help.
>
> I'd also prefer to see a small adjustment here. With this change all GCs have to add a back call to `CollectedHeap::stop()`. I think it makes the could a tiny bit less clean.
> 
> I wonder if an alternative could be to split `CollectedHeap::stop()` into two functions:
> 
> virtual void CollectedHeap::stop() = 0; // Now pure virtual
> 
> void CollectedHeap::before_exit() {
>   // Log GC CPU usage.
>   log_gc_vtime();
> 
>   // Stop any on-going concurrent work and prepare for exit.
>   stop();
> }
> 
> And revert the added calls to `CollectedHeap::stop()`.

That's a great suggestion, thanks! I have now implemented these changes :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2175091875


More information about the hotspot-gc-dev mailing list