RFR: 8003216: Add JFR event indicating explicit System.gc() call
egahlin at openjdk.java.net
Thu Jun 10 08:51:36 UTC 2021
This is a continuation of a review that started before the pandemic.
In an offline discussion with Stefan Johansson, we looked into adding GC id to the SystemGC event, but it was not trivial. Still, it would make sense to have this event to see the stack trace of the System GC call. GC id can always be added as another enhancement. I added a field that indicates the status of -XX:+ExplicitGCInvokesConcurrent, to hint to users that the duration of the event may not be the time the GC took.
I only emit the event if a GC is triggered, so there is no need for a field -XX:+DisableExplicitGC which we talked about back then. The reason is that it could potentially create many events in the default configuration, for example if called every rendered frame. I also think users want to track calls that actually led to a GC. If there is a need for a second field, it could be added as another enhancement later.
Testing: tier1/tier2 + test/jdk/jdk/jfr
Stats: 99 lines in 6 files changed: 99 ins; 0 del; 0 mod
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4456/head:pull/4456
More information about the hotspot-gc-dev