-
Notifications
You must be signed in to change notification settings - Fork 49
jdk tool jstat
Edward Lee edited this page Sep 7, 2019
·
9 revisions
jstat -gcutil (垃圾回收统计概述)、-class (类加载器统计)、-gc (垃圾回收的堆统计) {pid} (监视JVM的统计信息)
参数选项:
$ jstat -help
Usage: jstat -help|-options
jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
Definitions:
<option> An option reported by the -options option
<vmid> Virtual Machine Identifier. A vmid takes the following form:
<lvmid>[@<hostname>[:<port>]]
Where <lvmid> is the local vm identifier for the target
Java virtual machine, typically a process id; <hostname> is
the name of the host running the target Java virtual machine;
and <port> is the port number for the rmiregistry on the
target host. See the jvmstat documentation for a more complete
description of the Virtual Machine Identifier.
<lines> Number of samples between header lines.
<interval> Sampling interval. The following forms are allowed:
<n>["ms"|"s"]
Where <n> is an integer and the suffix specifies the units as
milliseconds("ms") or seconds("s"). The default units are "ms".
<count> Number of samples to take before terminating.
-J<flag> Pass <flag> directly to the runtime system.
帮助手册:
$ man jstat
$ jstat -gcutil -h7 5942 1s
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 48.80 90.75 79.98 79.32 52.67 5861 267.058 80 10.333 277.392
0.00 48.80 92.72 79.98 79.32 52.67 5861 267.058 80 10.333 277.392
0.00 48.80 96.25 79.98 79.32 52.67 5861 267.058 80 10.333 277.392
0.00 48.80 98.94 79.98 79.32 52.67 5861 267.058 80 10.333 277.392
# old区使用率超过80%,触发一次FGC
57.62 0.00 2.57 80.08 79.37 52.72 5862 267.083 81 10.359 277.442
57.62 0.00 7.28 80.08 79.37 52.72 5862 267.083 81 10.359 277.442
57.62 0.00 9.42 80.08 79.37 52.72 5862 267.083 81 10.359 277.442
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
57.62 0.00 10.84 80.08 79.37 52.72 5862 267.083 81 10.359 277.442
57.62 0.00 13.03 80.08 79.37 52.72 5862 267.083 81 10.359 277.442
# 触发再次FGC,old区空间几乎被完全回收
57.62 0.00 14.17 54.30 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 17.64 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 19.77 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 22.37 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 23.63 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
...
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
57.62 0.00 88.00 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 91.19 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 94.95 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 97.77 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
57.62 0.00 98.72 8.43 79.37 52.72 5862 267.083 82 10.551 277.634
# metadata空间使用率超过80%,伴随YGC一起触发回收
0.00 62.80 1.24 8.61 66.02 39.38 5863 267.112 82 10.551 277.663
0.00 62.80 4.52 8.61 66.02 39.38 5863 267.112 82 10.551 277.663
-gcutil option
Summary of garbage collection statistics.
垃圾回收统计概述。
S0: Survivor space 0 utilization as a percentage of the space's current capacity.
S0: 幸存者区0的使用率(From Space,代数 >= 1)
S1: Survivor space 1 utilization as a percentage of the space's current capacity.
S1: 幸存者区1的使用率(To Space,代数 >= 1)
E: Eden space utilization as a percentage of the space's current capacity.
E: 伊甸园的使用率(new Object)
O: Old space utilization as a percentage of the space's current capacity.
O: 老年代空间的使用率(代数 >= 15)
M: Metaspace utilization as a percentage of the space's current capacity.
M: 元数据空间的使用率
CCS: Compressed class space utilization as a percentage.
CCS: 压缩的类空间的使用率
YGC: Number of young generation GC events.
YGC: 新生代GC事件的数量
YGCT: Young generation garbage collection time.
YGCT: 新生代垃圾收集的时间
FGC: Number of full GC events.
FGC: 完整GC事件的数量
FGCT: Full garbage collection time.
FGCT: 完整垃圾收集的时间
GCT: Total garbage collection time.
GCT: 总的垃圾收集时间
$ jstat -class -h7 5942 1s
Loaded Bytes Unloaded Bytes Time
347417 475696.9 321929 432046.8 884.72
347417 475696.9 321929 432046.8 884.72
347422 475703.6 321929 432046.8 884.73
347422 475703.6 321929 432046.8 884.73
Loaded Bytes Unloaded Bytes Time
347427 475710.3 321929 432046.8 884.74
347427 475710.3 321929 432046.8 884.74
347432 475717.0 321929 432046.8 884.75
347432 475717.0 321929 432046.8 884.75
347437 475723.8 321929 432046.8 884.75
347444 475733.1 321929 432046.8 884.76
-class option
Class loader statistics.
类加载器统计。
Loaded: Number of classes loaded.
Loaded: 加载的类的数量
Unloaded: Number of classes unloaded.
Unloaded: 未加载的类的数量
Time: Time spent performing class loading and unloading operations.
Time: 执行类加载和卸载操作花费的时间
$ jstat -gc -h7 5942 1s
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
1536.0 1536.0 448.0 0.0 15872.0 8370.5 105472.0 104325.9 57600.0 56244.6 6656.0 6330.4 465846 2513.802 12827 1829.190 4342.992
$ jstat -gccapacity -h7 5942 1s
NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC
41984.0 671744.0 18944.0 1536.0 1536.0 15872.0 84992.0 1343488.0 105472.0 105472.0 0.0 1099776.0 57600.0 0.0 1048576.0 6656.0 465873 12828
$ jstat -gcnew -h7 5942 1s
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
2048.0 2048.0 1568.0 0.0 2 15 2048.0 16384.0 13439.0 465776 2513.420
$ jstat -gcnewcapacity -h7 5942 1s
NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC
41984.0 671744.0 18432.0 223744.0 2048.0 223744.0 2048.0 670720.0 14336.0 465992 12832
$ jstat -gcold -h7 5942 1s
MC MU CCSC CCSU OC OU YGC FGC FGCT GCT
57600.0 56244.6 6656.0 6330.4 105984.0/103MB 95649.4 466002 12832 1829.926 4344.596
$ jstat -gcoldcapacity -h7 5942 1s
OGCMN OGCMX OGC OC YGC FGC FGCT GCT
84992.0 1343488.0 105984.0 105984.0 466014 12832 1829.926 4344.663