RFR: 8366896: JFR: Add gc view support for ZGC

Erik Gahlin egahlin at openjdk.org
Thu Sep 4 14:56:20 UTC 2025


Could I have a review of a PR that fixes the 'jfr gc view' when using ZGC?

Could I have a review of a PR that fixes the 'jfr gc view' when using ZGC? The problem is that jdk.YoungGarbageCollection and jdk.OldGarbageCollection events are not used with ZGC. Instead, jdk.ZYoungGarbageCollection and jdk.ZOldGarbageCollection are used.

Before:
**$ jfr view gc recording.jfr**
    
                              Garbage Collections
    
    Start    GC ID Type                  Heap Before GC Heap After GC Longest Pause
    -------- ----- --------------------- -------------- ------------- -------------
    16:13:43     0 Unknown                     868.0 MB        1.6 GB    0.00808 ms
    16:13:43     1 Unknown                       1.7 GB        3.8 GB    0.00796 ms
    16:13:44     2 Unknown                       3.8 GB        9.0 GB     0.0136 ms
    16:13:45     3 Unknown                       6.6 GB        9.0 GB     0.0203 ms
    16:13:46     4 Unknown                       9.0 GB        9.0 GB    0.00867 ms
    16:13:48     5 Unknown                       9.0 GB        9.0 GB    0.00775 ms
 
 
 After:
 **$ jfr view gc recording.jfr**

                                       Garbage Collections
    
    Start    GC ID Type                         Heap Before GC Heap After GC Longest Pause
    -------- ----- ---------------------------- -------------- ------------- -------------
    16:13:43     0 ZGC Old Garbage Collection         868.0 MB        1.6 GB    0.00808 ms
    16:13:43     1 ZGC Old Garbage Collection           1.7 GB        3.8 GB    0.00796 ms
    16:13:44     2 ZGC Old Garbage Collection           3.8 GB        9.0 GB     0.0136 ms
    16:13:45     3 ZGC Young Garbage Collection         6.6 GB        9.0 GB     0.0203 ms
    16:13:46     4 ZGC Young Garbage Collection         9.0 GB        9.0 GB    0.00867 ms
    16:13:48     5 ZGC Young Garbage Collection         9.0 GB        9.0 GB    0.00775 ms

Note: "Unknown" can still occur if not all events for a GC ID have been emitted.

I also made a change so that GCs are now ordered according to GC ID. This prevents issues where entries with a start time of N/A appear first in cases where not all events are emitted for a GC cycle.

Testing: jdk/jdk/jfr + manual inspection with ZGC, G1, Parallel and Serial.

Thanks
Erik

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

Commit messages:
 - Order by GC id
 - Initial

Changes: https://git.openjdk.org/jdk/pull/27099/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27099&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366896
  Stats: 5 lines in 1 file changed: 2 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/27099.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27099/head:pull/27099

PR: https://git.openjdk.org/jdk/pull/27099


More information about the hotspot-jfr-dev mailing list