JVM监控功能工具jstat的使用
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