How to get zGC allocation stall times from the JVM?

543 Views Asked by At

How can I get the total allocation stall time due to zGC Garbage Collection in my Java application from the JVM (not the gc.log)?

I saw this interesting answer: https://stackoverflow.com/a/13915440/992432, but looking at the the docs for GarbageCollectorMXBean there are only two methods, neither of which seems to differentiate between general time spent and time the Java application had to stop to GC:

Method Summary

long getCollectionCount() - Returns the total number of collections that have occurred.

long getCollectionTime() - Returns the approximate accumulated collection elapsed time in milliseconds.

What I really want to know is the time spent as full allocation stalls due to GCs (note I do not care about safepointed times). As this article says in Java Magazine:

Many garbage collection algorithms have been tried and tested over the years, iteratively improving their performance. There are two common areas of performance for such algorithms The first is garbage collection throughput: How much of your application’s CPU time is spent performing garbage collection work rather than running application code? The second is the delay created—that is, the latency of individual pauses.

Any assistance would be greatly appreciated.

0

There are 0 best solutions below