Using jps and jstat to get JVM GC statistics
Ensure that JDK bin directory is on your path
Issue command 'jps' to find the running JVM's PID ( it will show all running java processes ).
Once you have identifed the PID issue command 'jstat -gcutil [PID] 5000', replacing [PID] with the one identified above
Now the console should update on a 5 second basis with statistics.
Fields available in jstat gcutil output
Basically, the first set of columns (S0, S1, E, O, P) describes the utilisation of the various memory heaps
(Survivor heaps, Eden - young generation, Old generation and Perm. heap space).
Next, (YGC and YGCT) show the number of young (eden) space collections and total time taken so far doing these collections.
Columns (FCG, FGCT) show the number and time taken doing old space collections.
Lastly, GCT shows the total time taken performing garbage collection so far.
Sample Output:
#Timestamp S0 S1 E O P YGC YGCT FGC FGCT GCT
#144415.1
0.00 0.00 10.66 21.60 51.84 567 79.287 2 1.276 80.563
Option | Displays... |
class | Statistics on the behavior of the class loader. |
compiler | Statistics of the behavior of the HotSpot Just-in-Time compiler. |
gc | Statistics of the behavior of the garbage collected heap. |
gccapacity | Statistics of the capacities of the generations and their corresponding spaces. |
gccause | Summary of garbage collection statistics (same as -gcutil), with the cause of the last and current (if applicable) garbage collection events. |
gcnew | Statistics of the behavior of the new generation. |
gcnewcapacity | Statistics of the sizes of the new generations and its corresponding spaces. |
gcold | Statistics of the behavior of the old and permanent generations. |
gcoldcapacity | Statistics of the sizes of the old generation. |
gcpermcapacity | Statistics of the sizes of the permanent generation. |
gcutil | Summary of garbage collection statistics. |
printcompilation | HotSpot compilation method statistics. |