"-XX:+PrintGCApplicationStoppedTime" - Application Pause Durations

This section describes the garbage collection logging option, '-XX:+PrintGCApplicationStoppedTime', which prints how much time it lasted when the JVM pauses the execution of the application for garbage collection or other JVM event.

In this tutorial, let's try the "-XX:+PrintGCApplicationStoppedTime" garbage collection logging option to see what we will get in the log file:

herong> \progra~1\java\jdk1.8.0\bin\java -Xms2m -Xmx64m \
   -XX:+PrintGCApplicationStoppedTime -Xloggc:gc.log \
   GarbageCollection

Step/TotalMemory/FreeMemory/UsedMemory:
1   2031616   698848   1332768
2   3874816   1473392   2401424
3   3874816   425688   3449128
4   8970240   4442016   4528224
...
(Ctrl-C)

herong> more gc.log
CommandLine flags: -XX:InitialHeapSize=2097152 -XX:MaxHeapSize=67108864
   -XX:+PrintGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCTimeStamps
   -XX:-UseLargePagesIndividualAllocation
0.151: [GC (Allocation Failure)  889K->755K(1984K), 0.0023940 secs]
0.153: Total time for which application threads were stopped:
   0.0026422 seconds, Stopping threads took: 0.0001156 seconds
1.146: [GC (Allocation Failure)  1557K->1540K(2500K), 0.0043665 secs]
1.150: [Full GC (Allocation Failure)  1540K->1540K(2500K), 0.0026525 secs]
1.153: Total time for which application threads were stopped:
   0.0076895 seconds, Stopping threads took: 0.0002393 seconds
2.147: [GC (Allocation Failure)  2601K->2580K(3784K), 0.0049479 secs]
2.152: Total time for which application threads were stopped:
   0.0053164 seconds, Stopping threads took: 0.0001463 seconds
...

Notes on the output:

Obviously, reporting how much time the application are stopped by the JVM does help if you want to troubleshoot any performance issues. So you should use "-XX:+PrintGCApplicationStoppedTime" all the time.

Table of Contents

 About This Book

 Heap Memory Area and Size Control

JVM Garbage Collection Logging

 Garbage Collection Demo Program

 Garbage Collection Logging Options

 "-XX:+PrintGC" - GC Logging Option for Short Messages

 "-XX:+PrintGCDetails" - Option for Detailed GC Messages

 "-XX:+PrintGCDateStamps" - Calendar Timestamp on GC Messages

"-XX:+PrintGCApplicationStoppedTime" - Application Pause Durations

 "-XX:+PrintGCApplicationConcurrentTime" - Application Running Durations

 "-XX:+PrintHeapAtGC" - Print Heap Summary per GC

 "-XX:+PrintTenuringDistribution" - Tunuring Distribution

 "-XX:+PrintReferenceGC" - Reference Counts per GC

 "-XX:+PrintFlagsFinal" - Print JVM Options

 Introduction of Garbage Collectors

 Serial Collector - "+XX:+UseSerialGC"

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 Object References and Garbage Collection

 Garbage Collection Performance Test Program

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

 Garbage Collection Performance Test Summary

 Archived Tutorials

 References

 Full Version in PDF/EPUB