lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ man jstat
jstat(1) jstat(1)
Namejstat - Java Virtual Machine Statistics[n. 统计;统计学;[统计] 统计资料] Monitoring[n. 监视,[自] 监控;检验,检查] Tool
SYNOPSIS[n. 概要,大纲]
jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]
PARAMETERS
generalOption
A single general command-line option (-help, -options, or -version)
outputOptions
One or more output options, consisting of[包含…;组成元素为…] a single statOption, plus any of the -t, -h, and -J options.
vmid
Virtual machine identifier[ 标志符], a string indicating[表明;指示] the target Java virtual machine (JVM). The general syntax[n. 语法;句法;有秩序的排列] is
[protocol:][//]lvmid[@hostname[:port]/servername]
The syntax of the vmid string largely corresponds[符合,一致;相应;通信] to the syntax of a URI. The vmid can vary[变化;变异;违反] from a simple
integer representing a local JVM to a more complex construction[结构] specifying a communications protocol, port
number, and other implementation-specific values. See Virtual Machine Identifier for details.
interval[s|ms]
Sampling[取样;抽样] interval in the specified units, seconds (s) or milliseconds (ms). Default units are milliseconds.
Must be a positive[正数] integer. If specified, jstat will produce its output at each interval.
count
Number of samples to display. Default value is infinity[无穷;无限大;无限距]; that is, jstat displays statistics until the target
JVM terminates[ 终止] or the jstat command is terminated. Must be a positive integer.
DESCRIPTION
The jstat tool displays performance[ 性能] statistics for an instrumented HotSpot Java virtual machine (JVM). The target
JVM is identified by its virtual machine identifier, or vmid option described below.
NOTE: This utility[可用性] is unsupported and may not be available in future versions of the JDK. It is not currently
available on Windows 98 and Windows ME. platforms.
VIRTUAL MACHINE IDENTIFIER
The syntax[语法;句法;有秩序的排列] of the vmid string largely corresponds[符合,一致;相应;通信] to the syntax of a URI:
[protocol:][//]lvmid[@hostname][:port][/servername]
protocol
The communications protocol. If the protocol is omitted and a hostname is not specified, the default pro‐
tocol is a platform specific optimized[最优] local protocol. If the protocol is omitted and a hostname is speci‐
fied, then the default protocol is rmi.
lvmid
The local virtual machine identifier for the target JVM. The lvmid is a platform-specific value that
uniquely[独特的] identifies a JVM on a system. The lvmid is the only required component of a virtual machine iden‐
tifier. The lvmid is typically, but not necessarily, the operating system's process identifier for the
target JVM process. You can use the jps(1) command to determine the lvmid. Also, you can determine lvmid
on Unix platforms with the ps command, and on Windows with the Windows Task Manager.
hostname
A hostname or IP address indicating[表明,指示] the target host. If hostname is omitted[省略,省去的], then the target host is the
local host.
port
The default port for communicating with the remote server. If the hostname is omitted or the protocol
specifies an optimized, local protocol, then port is ignored. Otherwise, treatment of the port parameter
is implementation specific. For the default rmi protocol, the port indicates[表明,指示,显示] the port number for the
rmiregistry on the remote host. If port is omitted, and protocol indicates rmi, then the default rmireg‐
istry port (1099) is used.
servername
The treatment[处置] of this parameter depends on implementation. For the optimized[最优] local protocol, this field is
ignored. For the rmi protocol, it represents the name of the RMI remote object on the remote host.
OPTIONS
The jstat command supports two types of options, general options and output options. General options cause jstat to
display simple usage[使用;用法;惯例] and version information. Output options determine the content and format of the statistical
output.
NOTE: All options, and their functionality are subject to change or removal in future releases.
GENERAL OPTIONS
If you specify one of the general options, you cannot specify any other option or parameter.
-help
Display help message.
-version
Display version information.
-options
Display list of statistics[n. 统计;统计学;[统计] 统计资料] options. See the Output Options section below.
OUTPUT OPTIONS
If you do not specify a general option, then you can specify output options. Output options determine the con‐
tent and format of jstat's output, and consist of a single statOption, plus any of the other output options (-h,
-t, and -J). The statOption must come first.
Output is formatted as a table, with columns are separated by spaces. A header row with titles describes the
columns. Use the -h option to set the frequency[频率] at which the header is displayed. Column header names are gen‐
erally consistent[始终如一的,一致的;坚持的] between the different options. In general, if two options provide a column with the same name,
then the data source for the two columns are the same.
Use the -t option to display a time stamp[印记;标志] column, labeled Timestamp as the first column of output. The Timestamp
column contains the elapsed[时间过去;消逝] time, in seconds, since startup of the target JVM. The resolution[ 解析度] of the time stamp
is dependent[依靠的,从属的,取决于] on various factors and is subject[主题,科目] to variation[ 可变性] due to[由于] delayed thread scheduling on heavily loaded
systems.
Use the interval and count parameters to determine[确定] how frequently and how many times, respectively[分别地;各自地,独自地], jstat dis‐
plays its output.
NOTE: You are advised not to write scripts to parse jstat's output since the format may change in future
releases. If you choose to write scripts that parse jstat output, expect to modify them for future releases of
this tool.
-statOption
Determines the statistics information that jstat displays. The following table lists the available
options. Use the -options general option to display the list of options for a particular platform instal‐
lation.
-h n
Display a column header every n samples (output rows), where n is a positive[正的] integer. Default value is 0,
which displays the column header above the first row of data.
-t n
Display a timestamp column as the first column of output. The timestamp is the time since the start time
of the target JVM.
-JjavaOption
Pass javaOption to the java application launcher. For example, -J-Xms48m sets the startup memory to 48
megabytes. For a complete list of options, see java(1)
STATOPTIONS AND OUTPUT
The following tables summarize the columns that jstat outputs for each statOption.
-class Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -class -h10 3007 1s
Loaded Bytes Unloaded Bytes Time
9567 12506.2 0 0.0 13.96
9567 12506.2 0 0.0 13.96
9567 12506.2 0 0.0 13.96
9567 12506.2 0 0.0 13.96
9567 12506.2 0 0.0 13.96
-compiler Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -compiler -h10 3007 1s
Compiled Failed Invalid Time FailedType FailedMethod
3007 0 0 2.77 0
3007 0 0 2.77 0
3007 0 0 2.77 0
3007 0 0 2.77 0
3007 0 0 2.77 0
3007 0 0 2.77 0
3007 0 0 2.77 0
-gc Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gc -h10 3007 1s
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
17472.0 17472.0 7343.4 0.0 139776.0 137784.5 349568.0 29540.3 524288.0 53285.3 12 0.891 0 0.000 0.891
17472.0 17472.0 7343.4 0.0 139776.0 137784.5 349568.0 29540.3 524288.0 53285.3 12 0.891 0 0.000 0.891
17472.0 17472.0 7343.4 0.0 139776.0 139776.0 349568.0 29540.3 524288.0 53285.3 12 0.891 0 0.000 0.891
17472.0 17472.0 7343.4 0.0 139776.0 139776.0 349568.0 29540.3 524288.0 53285.3 12 0.891 0 0.000 0.891
17472.0 17472.0 0.0 7367.6 139776.0 2855.2 349568.0 29540.3 524288.0 53285.3 13 0.918 0 0.000 0.918
17472.0 17472.0 0.0 7367.6 139776.0 2855.2 349568.0 29540.3 524288.0 53285.3 13 0.918 0 0.000 0.918
17472.0 17472.0 0.0 7367.6 139776.0 2879.2 349568.0 29540.3 524288.0 53285.3 13 0.918 0 0.000 0.918
-gccapacity Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gccapacity -h10 3007 1s
NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC PGCMN PGCMX PGC PC YGC FGC
174720.0 174720.0 174720.0 17472.0 17472.0 139776.0 349568.0 349568.0 349568.0 349568.0 524288.0 524288.0 524288.0 524288.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 139776.0 349568.0 349568.0 349568.0 349568.0 524288.0 524288.0 524288.0 524288.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 139776.0 349568.0 349568.0 349568.0 349568.0 524288.0 524288.0 524288.0 524288.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 139776.0 349568.0 349568.0 349568.0 349568.0 524288.0 524288.0 524288.0 524288.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 139776.0 349568.0 349568.0 349568.0 349568.0 524288.0 524288.0 524288.0 524288.0 13 0
This option displays the same summary of garbage collection statistics as the -gcutil option, but includes the
causes of the last garbage collection event and (if applicable) the current garbage collection event. In addition
to the columns listed for -gcutil, this option adds the following columns:
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gccause -h10 3007 1s
S0 S1 E O P YGC YGCT FGC FGCT GCT LGCC GCC
0.00 42.17 55.08 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 55.08 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 55.09 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 55.10 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 55.10 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 55.10 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 55.10 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 57.03 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 57.03 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
0.00 42.17 57.05 8.45 10.16 13 0.918 0 0.000 0.918 unknown GCCause No GC
S0 S1 E O P YGC YGCT FGC FGCT GCT LGCC GCC
-gcnew Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gcnew -h10 3007 1s
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
17472.0 17472.0 0.0 7367.6 15 15 8736.0 139776.0 94172.7 13 0.918
17472.0 17472.0 0.0 7367.6 15 15 8736.0 139776.0 94172.7 13 0.918
17472.0 17472.0 0.0 7367.6 15 15 8736.0 139776.0 94181.5 13 0.918
17472.0 17472.0 0.0 7367.6 15 15 8736.0 139776.0 94181.5 13 0.918
17472.0 17472.0 0.0 7367.6 15 15 8736.0 139776.0 94181.5 13 0.918
-gcnewcapacity Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gcnewcapacity -h10 3007 1s
NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC
174720.0 174720.0 174720.0 17472.0 17472.0 17472.0 17472.0 139776.0 139776.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 17472.0 17472.0 139776.0 139776.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 17472.0 17472.0 139776.0 139776.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 17472.0 17472.0 139776.0 139776.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 17472.0 17472.0 139776.0 139776.0 13 0
174720.0 174720.0 174720.0 17472.0 17472.0 17472.0 17472.0 139776.0 139776.0 13 0
-gcold Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gcold -h10 3007 1s
PC PU OC OU YGC FGC FGCT GCT
524288.0 53285.3 349568.0 29540.3 13 0 0.000 0.918
524288.0 53285.3 349568.0 29540.3 13 0 0.000 0.918
524288.0 53285.3 349568.0 29540.3 13 0 0.000 0.918
524288.0 53285.3 349568.0 29540.3 13 0 0.000 0.918
-gcoldcapacity Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gcoldcapacity -h10 3007 1s
OGCMN OGCMX OGC OC YGC FGC FGCT GCT
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
349568.0 349568.0 349568.0 349568.0 13 0 0.000 0.918
-gcpermcapacity Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gcpermcapacity -h10 3007 1s
PGCMN PGCMX PGC PC YGC FGC FGCT GCT
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
524288.0 524288.0 524288.0 524288.0 13 0 0.000 0.918
-gcutil Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -gcutil -h10 3007 1s
S0 S1 E O P YGC YGCT FGC FGCT GCT
42.08 0.00 6.30 8.45 10.16 14 0.945 0 0.000 0.945
42.08 0.00 6.31 8.45 10.16 14 0.945 0 0.000 0.945
42.08 0.00 6.31 8.45 10.16 14 0.945 0 0.000 0.945
42.08 0.00 6.52 8.45 10.16 14 0.945 0 0.000 0.945
42.08 0.00 6.52 8.45 10.16 14 0.945 0 0.000 0.945
42.08 0.00 6.55 8.45 10.16 14 0.945 0 0.000 0.945
42.08 0.00 8.27 8.45 10.16 14 0.945 0 0.000 0.945
-printcompilation Option
lester@lester-ThinkPad-T410:~/develop/jdk1.6.0_37/bin$ jstat -printcompilation -h10 3007 1s
Compiled Size Type Method
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
3038 11 1 org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob runInUIThread
This section presents some examples of monitoring a local JVM with a lvmid of 21891.
Using the gcutil option
This example attaches to[附着于] lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as
specified by the -gcutil option.
jstat -gcutil 21891 250 7
S0 S1 E O P YGC YGCT FGC FGCT GCT
12.44 0.00 27.20 9.49 96.70 78 0.176 5 0.495 0.672
12.44 0.00 62.16 9.49 96.70 78 0.176 5 0.495 0.672
12.44 0.00 83.97 9.49 96.70 78 0.176 5 0.495 0.672
0.00 7.74 0.00 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 23.37 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 43.82 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 58.11 9.51 96.71 79 0.177 5 0.495 0.673
The output of this example shows that a young generation collection occurred between the 3rd and 4th sample[取样;尝试;抽样检查]. The
collection took 0.001 seconds and promoted[晋升的] objects from the eden space (E) to the old space (O), resulting in an
increase of old space utilization from 9.49% to 9.51%. Before the collection, the survivor space was 12.44% uti‐
lized, but after this collection it is only 7.74% utilized[被利用的].
Repeating the column header string
This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as
specified by -gcutil option. In addition, it uses the -h3 option to output the column header after every 3 lines of
data.
jstat -gcnew -h3 21891 250
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 0.0 31.7 31 31 32.0 512.0 178.6 249 0.203
64.0 64.0 0.0 31.7 31 31 32.0 512.0 355.5 249 0.203
64.0 64.0 35.4 0.0 2 31 32.0 512.0 21.9 250 0.204
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 35.4 0.0 2 31 32.0 512.0 245.9 250 0.204
64.0 64.0 35.4 0.0 2 31 32.0 512.0 421.1 250 0.204
64.0 64.0 0.0 19.0 31 31 32.0 512.0 84.4 251 0.204
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 0.0 19.0 31 31 32.0 512.0 306.7 251 0.204
In addition to showing the repeating header string, this example shows that between the 2nd and 3rd samples, a
young GC occurred. Its duration was 0.001 seconds. The collection found enough live data that the survivor space 0
utilization[利用,使用] (S0U) would would have exceeded[超过(exceed的过去分词);越出] the desired[渴望的;想得到的] survivor Size (DSS). As a result, objects were promoted to the old generation (not visible[ 可见的] in this output), and the tenuring[ 占有期;保有期] threshold[ 阈值] (TT) was lowered from 31 to 2.
Another collection occurs between the 5th and 6th samples. This collection found very few survivors and returned
the tenuring threshold to 31.
Including a time stamp for each sample
This example attaches to lvmid 21891 and takes 3 samples at 250 millisecond intervals. The -t option is used to
generate a time stamp for each sample in the first column.
jstat -gcoldcapacity -t 21891 250 3
Timestamp OGCMN OGCMX OGC OC YGC FGC FGCT GCT
150.1 1408.0 60544.0 11696.0 11696.0 194 80 2.874 3.799
150.4 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
150.7 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
The Timestamp column reports the elapsed time in seconds since the start of the target JVM. In addition, the
-gcoldcapacity output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the
heap expands to meet allocation[分配,配置;安置] and/or promotion demands[需求]. The old generation capacity (OGC) has grown to from 11696
KB to 13820 KB after the 81st Full GC (FGC). The maximum capacity of the generation (and space) is 60544 KB
(OGCMX), so it still has room to expand.
Monitor[监控] instrumentation[ 方法] for a remote JVM
This example attaches to lvmid 40496 on the system named remote.domain using the -gcutil option, with samples taken
every second indefinitely.
jstat -gcutil 40496@remote.domain 1000
The lvmid is combined[结合的,组合的] with the name of the remote host to construct a vmid of 40496@remote.domain. This vmid
results in the use of the rmi protocol to communicate to the default jstatd server on the remote host. The jstatd
server is located using the rmiregistry on remote.domain that is bound to the default rmiregistry port (port 1099).
SEE ALSO
o java(1) - the Java Application Launcher
o jps(1) - the Java Process Status Application
o jstatd(1) - the jvmstat daemon
o rmiregistry(1) - the Java Remote Object Registry