'jstat -gcutil' - Garbage Collection Statistics

This section provides a tutorial example on how to use the 'jstat -gcutil' command to get garbage collection statistics against a specified JVM process ID.

With the garbage collection testing program running, I am ready to test the "jstat" tool. The first test is run "jstat" with the "-gcutil -t" option to get statistic samples on a local JVM process.

1. Run the "jps" to get the process ID of the GarbageCollection.java JVM:

C:\herong>\Progra~1\java\jdk1.8.0\bin\jps -l -m -v

3824 sun.tools.jps.Jps -l -m -v 
   -Dapplication.home=C:\Program Files\java\jdk1.8.0 -Xms8m
3868 GarbageCollection -Xms24m -Xmx24m
2924 PrimeNumberSeeker 10 200
2544 sun.tools.jstatd.Jstatd -p 1234 
   -Dapplication.home=C:\Program Files\java\jdk1.8.0 -Xms8m
   -Djava.security.policy=tools.policy

2. Run the "jstat" to get the summary of garbage collection statistics of the GarbageCollection JVM identified by the process ID 3868:

C:\herong>\Progra~1\java\jdk1.8.0\bin\jstat -gcutil -t 3868 1s 30

 Time    S0    S1     E     O    P  YGC  YGCT FGC   FGCT    GCT
313.7  0.00 99.99  4.20 84.56 0.15 2093 3.653 416 13.998 17.651
314.6  0.00 99.99  0.00 97.66 0.15 2100 3.665 417 14.023 17.688
315.6  0.00  0.00  0.00 71.25 0.15 2106 3.674 419 14.090 17.764
316.7  0.00 99.99  4.20 84.56 0.15 2113 3.687 420 14.124 17.811
317.7  0.00 99.99  0.00 97.66 0.15 2120 3.699 421 14.158 17.858
318.6  0.00  0.00  0.00 71.25 0.15 2126 3.708 423 14.225 17.933
319.7  0.00 99.99  4.20 84.56 0.15 2133 3.721 424 14.259 17.980
320.7  0.00 99.99  0.00 97.66 0.15 2140 3.734 425 14.293 18.027
321.6  0.00  0.00  0.00 71.25 0.15 2146 3.743 427 14.360 18.103
322.7  0.00 99.99  4.20 84.56 0.15 2153 3.756 428 14.394 18.149
323.7  0.00 99.99  0.00 97.66 0.15 2160 3.769 429 14.428 18.196
324.7  0.00  0.00 67.14 71.25 0.15 2166 3.777 431 14.495 18.272
325.7  0.00 99.99  4.20 84.56 0.15 2173 3.790 432 14.528 18.319
326.7  0.00 99.99  0.00 97.66 0.15 2180 3.803 433 14.563 18.366
327.7  0.00 99.99 86.29 97.66 0.15 2185 3.810 434 14.588 18.397
328.7 99.99  0.00  0.00 77.66 0.15 2192 3.821 436 14.656 18.476
329.7  0.00 99.99 71.29 84.56 0.15 2198 3.832 437 14.690 18.522
330.7  0.00 99.99 19.15 97.66 0.15 2205 3.845 438 14.723 18.568
331.7 99.99  0.00  0.00 77.66 0.15 2212 3.855 440 14.791 18.646
332.7  0.00 99.99 71.29 84.56 0.15 2218 3.867 441 14.825 18.692
...

The last two parameters "1s 30" tells "jstat" to collect 30 samples with an interval of 1 second.

To understand the statistic output, you need to read the full documentation of the "jstat" tool.

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

'jstat' - JVM Statistics Monitoring Tool

 'jps' - JVM Process Status Tool

 Listing JVM Processes on the Local Machine with "jps"

 'jstatd' - JVM Remote Monitoring Server

 Starting 'jstatd' with a Security Policy File

 Connecting to 'jps' to Remote 'jstatd'

 'jstat' Command Options and Parameters

 Garbage Collection Testing Program

'jstat -gcutil' - Garbage Collection Statistics

 Accessing Remote JVM Processes with 'jstat'

 JVM Troubleshooting Tools

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 PDF Printing Version