JVM監控功能工具jstat的使用
格式
jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]
GeneralOption
-help:顯示幫助信息
-version:顯示版本
-options:顯示所有的statOption
如果指定了generalOption, 那麼就不能再指定outputOptions了
OutputOption
格式:[ statOption [ -t | -h | -J ]
-t:輸出結果加上timestamp列,值爲自jvm啓動的時長(秒)
-h n:每輸出n行數據就輸出一行頭信息,用於多次輸出時
-JjavaOption:Passes javaOption to the Java application launcher. For example, -J-Xms48m sets the startup memory to 48 MB. For a complete list of options
outputOption決定輸出的內容以及格式, 由statOption和otherOutputOption(-t, -h, -J)組成, statOption必須放在前面
StatOption
-class
顯示class loader的信息
Loaded:已加載的類個數
Bytes:已加載字節(Kbytes,千字節)
Unloaded:已卸載的類個數
Bytes:已卸載字節(Kbytes,千字節)
Time:用於類加載及卸載所用的總時間
-compiler
顯示JIT的統計信息
Compiled:Number of compilation tasks performed
Failed:Number of compilation tasks that failed
Invalid:Number of compilation tasks that were invalidated
Time:Time spent performing compilation tasks
FailedType:Compile type of the last failed compilation
FailedMethod:Class name and method for the last failed compilation
-gc
顯示垃圾回收統計信息(堆)
S0C:Current survivor space 0 capacity (KB)
S1C:Current survivor space 1 capacity (KB)
S0U:Survivor space 0 utilization (KB)
S1U:Survivor space 1 utilization (KB)
EC:Current eden space capacity (KB)
EU:Eden space utilization (KB)
OC:Current old space capacity (KB)
OU:Old space utilization (KB)
MC:Metaspace capacity (kB)
MU:Metacspace utilization (kB)
CCSC:Compressed class space capacity(KB)
CCSU:Compressed class space used
YGC:Number of young generation garbage collection events
YGCT:Young generation garbage collection time.
FGC:Number of full GC events.
FGCT:Full garbage collection time.
GCT:Total garbage collection time.
-gccapacity
顯示堆內存相關信息
NGCMN: Minimum new generation capacity (kB).
NGCMX: Maximum new generation capacity (kB).
NGC: Current new generation capacity (kB).
S0C: Current survivor space 0 capacity (kB).
S1C: Current survivor space 1 capacity (kB).
EC: Current eden space capacity (kB).
OGCMN: Minimum old generation capacity (kB).
OGCMX: Maximum old generation capacity (kB).
OGC: Current old generation capacity (kB).
OC: Current old space capacity (kB).
MCMN: Minimum metaspace capacity (kB).
MCMX: Maximum metaspace capacity (kB).
MC: Metaspace capacity (kB).
CCSMN: Compressed class space minimum capacity (kB).
CCSMX: Compressed class space maximum capacity (kB).
CCSC: Compressed class space capacity (kB).
YGC: Number of young generation GC events.
FGC: Number of full GC events.
-gcutil
顯示垃圾回收相關信息
S0: Survivor space 0 utilization as a percentage of the space's current capacity.
S1: Survivor space 1 utilization as a percentage of the space's current capacity.
E: Eden space utilization as a percentage of the space's current capacity.
O: Old space utilization as a percentage of the space's current capacity.
M: Metaspace utilization as a percentage of the space's current capacity.
CCS: Compressed class space utilization as a percentage.
YGC: Number of young generation GC events.
YGCT: Young generation garbage collection time.
FGC: Number of full GC events.
FGCT: Full garbage collection time.
GCT: Total garbage collection time.
-gccause
類似於-gcutil,多了LGCC和GCC
LGCC: Cause of last garbage collection
GCC: Cause of current garbage collection
-gcnew
顯示新生代統計信息
S0C: Current survivor space 0 capacity (kB).
S1C: Current survivor space 1 capacity (kB).
S0U: Survivor space 0 utilization (kB).
S1U: Survivor space 1 utilization (kB).
TT: Tenuring threshold.
MTT: Maximum tenuring threshold.
DSS: Desired survivor size (kB).
EC: Current eden space capacity (kB).
EU: Eden space utilization (kB).
YGC: Number of young generation GC events.
YGCT: Young generation garbage collection time.
-gcnewcapacity
新生代空間大小統計信息
NGCMN: Minimum new generation capacity (kB).
NGCMX: Maximum new generation capacity (kB).
NGC: Current new generation capacity (kB).
S0CMX: Maximum survivor space 0 capacity (kB).
S0C: Current survivor space 0 capacity (kB).
S1CMX: Maximum survivor space 1 capacity (kB).
S1C: Current survivor space 1 capacity (kB).
ECMX: Maximum eden space capacity (kB).
EC: Current eden space capacity (kB).
YGC: Number of young generation GC events.
FGC: Number of full GC events.
-gcold
老年代及方法區的統計信息
MC: Metaspace capacity (kB).
MU: Metaspace utilization (kB).
CCSC: Compressed class space capacity (kB).
CCSU: Compressed class space used (kB).
OC: Current old space capacity (kB).
OU: Old space utilization (kB).
YGC: Number of young generation GC events.
FGC: Number of full GC events.
FGCT: Full garbage collection time.
GCT: Total garbage collection time.
-gcoldcapacity
老年代容量信息
OGCMN: Minimum old generation capacity (kB).
OGCMX: Maximum old generation capacity (kB).
OGC: Current old generation capacity (kB).
OC: Current old space capacity (kB).
YGC: Number of young generation GC events.
FGC: Number of full GC events.
FGCT: Full garbage collection time.
GCT: Total garbage collection time.
-gcmetacapacity
方法區容量信息
MCMN: Minimum metaspace capacity (kB).
MCMX: Maximum metaspace capacity (kB).
MC: Metaspace capacity (kB).
CCSMN: Compressed class space minimum capacity (kB).
CCSMX: Compressed class space maximum capacity (kB).
YGC: Number of young generation GC events.
FGC: Number of full GC events.
FGCT: Full garbage collection time.
GCT: Total garbage collection time.
-printcompilation
Java HotSpot VM compiler method statistics.
Compiled: Number of compilation tasks performed by the most recently compiled method.
Size: Number of bytes of byte code of the most recently compiled method.
Type: Compilation type of the most recently compiled method.
Method: Class name and method name identifying the most recently compiled method. Class name uses slash (/) instead of dot (.) as a name space separator. Method name is the method within the specified class. The format for these two fields is consistent with the HotSpot -XX:+PrintCompilation option.
示例用法
1.jstat -gcutil -t -h 2 6300 1s 10