"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 first diagnostic commands to a given JVM.

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

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

C:\herong>jcmd 5848 VM.version
5848:
Java HotSpot(TM) 64-Bit Server VM version 10.0.1+10
JDK 10.0.1

C:\herong>jcmd LongSleep VM.uptime
5848:
327.465 s

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

C:\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


C:\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 
...

C:\herong>jcmd LongSleep VM.info | more
5848:
#
# JRE version: Java(TM) SE Runtime Environment (10.0.1+10) (build 10.0.1+10)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0.1+10, 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.

Last update: 2018.

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 java - The Java Program Launcher

 jdb - The Java Debugger

jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 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

 native2ascii - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 Full Version in PDF/EPUB