Measuring CPU usage

Per Liden per.liden at
Wed Nov 28 08:38:17 UTC 2018


On 11/26/18 7:34 PM, Alex Elent wrote:
> Hello,
> I'm wondering if there are any flags we can pass to ZGC to capture total
> CPU used during GC in the GC logs.
> Looking for something similar to the "Real" metric that Parallel GC spits
> out. More specifically like this:
> [2018-11-26T16:50:42.793+0000][248690777ms] GC(8544) Pause Full
> (System.gc()) 6872M->757M(12169M) 1830.137ms
> [2018-11-26T16:50:42.793+0000][248690777ms] GC(8544) User=3.71s Sys=0.01s
> Real=1.83s

We currently don't have that in ZGC. Are you looking for this 
information for the pauses or for the complete GC cycle? Measuring this 
on the process level for the complete cycle wouldn't make much sense, as 
that would include time used by Java threads.

However, we do have plans to add CPU time in %, in addition to the wall 
clock time, for both stw and concurrent phases. But that would then only 
cover time spent by GC threads doing GC work. With this you could see if 
a GC phase took a long time because a GC thread had a lot of work to do, 
or because it didn't get (enough) time on the CPU.


> I'm currently using the following Xlog opts:
> -Xlog:gc*:file=/env/log/tomcat_gc_log:uptimemillis,time"
> Thank you kindly!

More information about the zgc-dev mailing list