"jcmd 0 VM.*" - Running VM Diagnostic Commands

This section provides a tutorial example on how to use 'jcmd 0 VM.*' commands to get lot of information of a given JVM.

From previous tutorials, I learned how to fire diagnostic commands to a given JVM.

Now, let me try some VM.* diagnostic commands on the LongSleep JVM:

herong> jcmd -l
5848 LongSleep
5204 jdk.jcmd/sun.tools.jcmd.JCmd -l

herong> jcmd 5848 VM.version
5848:
Java HotSpot(TM) 64-Bit Server VM version 12.0.1+12
JDK 12.0.1

herong> jcmd LongSleep VM.uptime
5848:
327.465 s

herong> jcmd LongSleep VM.command_line
5848:
VM Arguments:
java_command: LongSleep
java_class_path (initial): .
Launcher Type: SUN_STANDARD

herong> jcmd LongSleep VM.stringtable
5848:
StringTable statistics:
Number of buckets       :     60013 =    480104 bytes, each 8
Number of entries       :      2697 =     64728 bytes, each 24
Number of literals      :      2697 =    183920 bytes, avg  68.194
Total footprint         :           =    728752 bytes
Average bucket size     :     0.045
Variance of bucket size :     0.045
Std. dev. of bucket size:     0.212
Maximum bucket size     :         2


herong> jcmd LongSleep VM.flags
5848:
-XX:CICompilerCount=3 -XX:ConcGCThreads=1 -XX:G1ConcRefinementThreads=4
-XX:G1HeapRegionSize=1048576 -XX:InitialHeapSize=62914560
-XX:MarkStackSize=4194304 -XX:MaxHeapSize=1006632960
...

herong> jcmd LongSleep VM.info | more
5848:
#
# JRE version: Java(TM) SE Runtime Environment (12.0.1+12) (build 10.0.1+10)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (12.0.1+12, mixed mode, tiered,
   compressed oops, g1 gc, windows-amd64)

---------------  S U M M A R Y ------------

Command Line: LongSleep

Host: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz, 4 cores, 3G,  Windows 7,
 64 bit Build 7601 (6.1.7601.24150)

---------------  P R O C E S S  ---------------

Heap address: 0x00000000c4000000, size: 960 MB, Compressed Oops mode:
32-bit Narrow klass base: 0x0000000000000000, Narrow klass shift: 0
Compressed class space size: 1073741824 Address: 0x0000000022e80000

Heap:
 garbage-first heap   total 61440K, used 1024K [0x00000000c4000000, ...)
  region size 1024K, 2 young (2048K), 0 survivors (0K)
 Metaspace used 4973K, capacity 5040K, committed 5120K, reserved 1056768K
  class space used 406K, capacity 447K, committed 512K, reserved 1048576K
Heap Regions: E=young(eden), S=young(survivor), O=old,
   HS=humongous(starts), HC=humongous(continues), CS=collection set,
   F=free, A=archive, TS=gc time stamp, AC=allocation context,
   TAMS=top-at-mark-start (previous, next)
...

Cool. VM.* diagnostic commands can tell us a lot about the running JVM.

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

jcmd - The JVM Diagnostic Tool

 jcmd - JVM Diagnostic Tool Command

 "jcmd 0 help" - Listing JVM Diagnostic Commands

"jcmd 0 VM.*" - Running VM Diagnostic Commands

 "jcmd 0 GC.*" - Running GC Diagnostic Commands

 "jcmd 0 Thread.print" - Generating Thread Dump

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials

 References

 Full Version in PDF/EPUB