We can see recently GC events which rely on GCHeapLog via hs_err log and VM.info dcmd. However they hold different value.
- testcase:
http://icedtea.classpath.org/hg/release/heapstats-2.1/raw-file/709b94541191/agent/test/oome/OOME.java
- command:
$ java -Xmx256m -XX:+CrashOnOutOfMemoryError OOME
- Result of OpenJDK 11.0.1 Linux x86_64
jsnap:
```
$ jhsdb jsnap --all --exe $JAVA_HOME/bin/java --core core.21252 | grep sun.gc.collector
sun.gc.collector.0.name=G1 incremental collections
sun.gc.collector.0.invocations=18 event(s)
sun.gc.collector.0.time=16291218 tick(s)
sun.gc.collector.0.lastEntryTime=139016631 tick(s)
sun.gc.collector.0.lastExitTime=139199980 tick(s)
sun.gc.collector.1.name=G1 stop-the-world full collections
sun.gc.collector.1.invocations=2 event(s)
sun.gc.collector.1.time=3318759 tick(s)
sun.gc.collector.1.lastEntryTime=140971296 tick(s)
sun.gc.collector.1.lastExitTime=142527295 tick(s)
sun.gc.collector.2.name=G1 stop-the-world phases
sun.gc.collector.2.invocations=32 event(s)
sun.gc.collector.2.time=5623249 tick(s)
sun.gc.collector.2.lastEntryTime=137915931 tick(s)
sun.gc.collector.2.lastExitTime=137968673 tick(s)
```
Last GC events on hs_err:
```
Event: 0.143 GC heap after
{Heap after GC invocations=36 (full 2):
garbage-first heap total 262144K, used 260592K [0x00000000f0000000, 0x0000000100000000)
region size 1024K, 0 young (0K), 0 survivors (0K)
Metaspace used 3746K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 333K, capacity 386K, committed 512K, reserved 1048576K
}
```
`invocations` should count all GC events.
(18 + 2 + 32 = 52)
- testcase:
http://icedtea.classpath.org/hg/release/heapstats-2.1/raw-file/709b94541191/agent/test/oome/OOME.java
- command:
$ java -Xmx256m -XX:+CrashOnOutOfMemoryError OOME
- Result of OpenJDK 11.0.1 Linux x86_64
jsnap:
```
$ jhsdb jsnap --all --exe $JAVA_HOME/bin/java --core core.21252 | grep sun.gc.collector
sun.gc.collector.0.name=G1 incremental collections
sun.gc.collector.0.invocations=18 event(s)
sun.gc.collector.0.time=16291218 tick(s)
sun.gc.collector.0.lastEntryTime=139016631 tick(s)
sun.gc.collector.0.lastExitTime=139199980 tick(s)
sun.gc.collector.1.name=G1 stop-the-world full collections
sun.gc.collector.1.invocations=2 event(s)
sun.gc.collector.1.time=3318759 tick(s)
sun.gc.collector.1.lastEntryTime=140971296 tick(s)
sun.gc.collector.1.lastExitTime=142527295 tick(s)
sun.gc.collector.2.name=G1 stop-the-world phases
sun.gc.collector.2.invocations=32 event(s)
sun.gc.collector.2.time=5623249 tick(s)
sun.gc.collector.2.lastEntryTime=137915931 tick(s)
sun.gc.collector.2.lastExitTime=137968673 tick(s)
```
Last GC events on hs_err:
```
Event: 0.143 GC heap after
{Heap after GC invocations=36 (full 2):
garbage-first heap total 262144K, used 260592K [0x00000000f0000000, 0x0000000100000000)
region size 1024K, 0 young (0K), 0 survivors (0K)
Metaspace used 3746K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 333K, capacity 386K, committed 512K, reserved 1048576K
}
```
`invocations` should count all GC events.
(18 + 2 + 32 = 52)