JDK Tools Notes for jps, jstate, and jinfo

JDK Tools

Name Description
jps JVM Process Status Tool, list all HoSpot processes
jstat JVM Statistics Monitoring Tool, collector HotSpot runtime info
jinfo Configuration Info for Java (JVM)
jmap Memory Map for Java, generate heapdump file
jhat JVM Heap Dump Browser, analyse heapdump info
jstack Stack Trace for Java, thread dump info

jps

jps [options] [hostid]

List the Local Virtual Machine Identifier (LVMID), similar to ps in UNIX. It's usually the first step to determine which process to monitor in deep.

Option Description
-q Only print out LVMID
-m List all the parameters that are passed to main class
-l List the full name, or the full path to the jar file
-v List all the JVM runtime parameters

jstat

jstat [ option vmid [] interval [s|ms] [count] ]

If the process is in local, VMID is the same with LVMID. If it's an remote process, VMID should be in the following format [protocol:][//]lvmid[@hostname[:port]/servername]

Example of jstat: jstat -gc 2764 250 20, looking 2764 process's GC info for 20 times with 250 ms interval.

Option Description
-class Time spend on loading, count of unloading, total space and etc.
-gc Java heap status, including Eden, Survivor, old generation and PermGen. Space and Time spending on GC
-gccapcity Max and min space of java heap
-gcutil The percentage of java heap usage
-gccause List the cause of last GC
-gcnew NewGen GC status
-gcnewcapacity Max and min space of NewGen
-gcold OldGen GC status
-gcoldcapcity Max and min space of OldGen
-gcpermcapcity Max and min space of PermGen
-compiler The method and time compiled by JIT
-printcompilation List all methods that are compiled

Note:

  • S0, S1 -> Survivor 0, 1

  • YGC -> Young GC (Minor GC)

  • FGC -> Full GC (Major GC)

jinfo

jinfo [option] pid

Option Description
-sysprops print out result of System.getProperites()
-flag name List the config info of that flag
-flag name=value Edit the config info of that flag

评论

暂无评论