Scroll to navigation

jstat(1) General Commands Manual jstat(1)

Name

jstat - Java Virtual Machine Statistics Monitoring Tool

SYNOPSIS


jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]

PARAMETERS

A single general command-line option (-help, -options, or -version)
One or more output options, consisting of a single statOption, plus any of the -t, -h, and -J options.
Virtual machine identifier, a string indicating the target Java virtual machine (JVM). The general syntax 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.
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.
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]

The communications protocol. If the protocol is omitted and a hostname is not specified, the default protocol is a platform specific optimized local protocol. If the protocol is omitted and a hostname is specified, then the default protocol is rmi.
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 identifier. 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.
A hostname or IP address indicating the target host. If hostname is omitted, then the target host is the local host.
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 rmiregistry port (1099) is used.
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.

Display help message.
Display version information.
Display list of statistics 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 content 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 generally 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 displays 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.

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 installation.

0u
0
Statistics of the behavior of the HotSpot Just\-in\-Time compiler.
0u
0
Statistics of the behavior of the garbage collected heap.
0u
0
Statistics of the capacities of the generations and their corresponding spaces.
0u
0
Summary of garbage collection statistics (same as \f3\-gcutil\fP), with the cause of the last and current (if applicable) garbage collection events.
0u
0
Statistics of the behavior of the new generation.
0u
0
Statistics of the sizes of the new generations and its corresponding spaces.
0u
0
Statistics of the behavior of the old and permanent generations.
0u
0
Statistics of the sizes of the old generation.
0u
0
Statistics of the sizes of the permanent generation.
0u
0
Summary of garbage collection statistics.
0u
0
HotSpot compilation method statistics.
0u
?Option???Displays...??
?class?????
+456u
-456u
?compiler?????
+456u
-456u
?gc?????
+456u
-456u
?gccapacity?????
+456u
-456u
?gccause?????
+456u
-456u
?gcnew?????
+456u
-456u
?gcnewcapacity?????
+456u
-456u
?gcold?????
+456u
-456u
?gcoldcapacity?????
+456u
-456u
?gcpermcapacity?????
+456u
-456u
?gcutil?????
+456u
-456u
?printcompilation?????
+456u
-456u
0u
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. 
Display a timestamp column as the first column of output. The timestamp is the time since the start time of the target JVM. 
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

0u
0
Number of Kbytes unloaded.
0u
0
Time spent performing class load and unload operations.
0u
?Class Loader Statistics?????
?Column???Description??
?Loaded???Number of classes loaded.??
?Bytes???Number of Kbytes loaded.??
?Unloaded?????
+624u
-624u
?Bytes?????
+624u
-624u
?Time?????
+624u
-624u
0u

-compiler Option

0u
0
Number of compilation tasks that failed.
0u
0
Number of compilation tasks that were invalidated.
0u
0
Time spent performing compilation tasks.
0u
0
Compile type of the last failed compilation.
0u
0
Class name and method for the last failed compilation.
0u
?HotSpot Just-In-Time Compiler Statistics?????
?Column???Description??
?Compiled?????
+1032u
-1032u
?Failed?????
+1032u
-1032u
?Invalid?????
+1032u
-1032u
?Time?????
+1032u
-1032u
?FailedType?????
+1032u
-1032u
?FailedMethod?????
+1032u
-1032u
0u

-gc Option

0u
0
Current survivor space 1 capacity (KB).
0u
0
Survivor space 0 utilization (KB).
0u
0
Survivor space 1 utilization (KB).
0u
0
Current eden space capacity (KB).
0u
0
Eden space utilization (KB).
0u
0
Current old space capacity (KB).
0u
0
Old space utilization (KB).
0u
0
Current permanent space capacity (KB).
0u
0
Permanent space utilization (KB).
0u
0
Number of young generation GC Events.
0u
0
Young generation garbage collection time.
0u
0
Full garbage collection time.
0u
0
Total garbage collection time.
0u
?Garbage-collected heap statistics?????
?Column???Description??
?S0C?????
+864u
-864u
?S1C?????
+864u
-864u
?S0U?????
+864u
-864u
?S1U?????
+864u
-864u
?EC?????
+864u
-864u
?EU?????
+864u
-864u
?OC?????
+864u
-864u
?OU?????
+864u
-864u
?PC?????
+864u
-864u
?PU?????
+864u
-864u
?YGC?????
+864u
-864u
?YGCT?????
+864u
-864u
?FGC???Number of full GC events.??
?FGCT?????
+864u
-864u
?GCT?????
+864u
-864u
0u

-gccapacity Option

0u
0
Maximum new generation capacity (KB).
0u
0
Current new generation capacity (KB).
0u
0
Current survivor space 0 capacity (KB).
0u
0
Current survivor space 1 capacity (KB).
0u
0
Current eden space capacity (KB).
0u
0
Minimum old generation capacity (KB).
0u
0
Maximum old generation capacity (KB).
0u
0
Current old generation capacity (KB).
0u
0
Current old space capacity (KB).
0u
0
Minimum permanent generation capacity (KB).
0u
0
Maximum Permanent generation capacity (KB).
0u
0
Current Permanent generation capacity (KB).
0u
0
Current Permanent space capacity (KB).
0u
0
Number of Young generation GC Events.
0u
?Memory Pool Generation and Space Capacities?????
?Column???Description??
?NGCMN?????
+1104u
-1104u
?NGCMX?????
+1104u
-1104u
?NGC?????
+1104u
-1104u
?S0C?????
+1104u
-1104u
?S1C?????
+1104u
-1104u
?EC?????
+1104u
-1104u
?OGCMN?????
+1104u
-1104u
?OGCMX?????
+1104u
-1104u
?OGC?????
+1104u
-1104u
?OC?????
+1104u
-1104u
?PGCMN?????
+1104u
-1104u
?PGCMX?????
+1104u
-1104u
?PGC?????
+1104u
-1104u
?PC?????
+1104u
-1104u
?YGC?????
+1104u
-1104u
?FGC???Number of Full GC Events.??
0u

-gccause Option

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:

0u
0
Cause of current Garbage Collection.
0u
?Garbage Collection Statistics, Including GC Events?????
?Column???Description??
?LGCC?????
+1272u
-1272u
?GCC?????
+1272u
-1272u
0u

-gcnew Option

0u
0
Current survivor space 1 capacity (KB).
0u
0
Survivor space 0 utilization (KB).
0u
0
Survivor space 1 utilization (KB).
0u
0
Maximum tenuring threshold.
0u
0
Desired survivor size (KB).
0u
0
Current eden space capacity (KB).
0u
0
Eden space utilization (KB).
0u
0
Number of young generation GC events.
0u
0
Young generation garbage collection time.
0u
?New Generation Statistics?????
?Column???Description??
?S0C?????
+672u
-672u
?S1C?????
+672u
-672u
?S0U?????
+672u
-672u
?S1U?????
+672u
-672u
?TT???Tenuring threshold.??
?MTT?????
+672u
-672u
?DSS?????
+672u
-672u
?EC?????
+672u
-672u
?EU?????
+672u
-672u
?YGC?????
+672u
-672u
?YGCT?????
+672u
-672u
0u

-gcnewcapacity Option

0u
0
Maximum new generation capacity (KB).
0u
0
Current new generation capacity (KB).
0u
0
Maximum survivor space 0 capacity (KB).
0u
0
Current survivor space 0 capacity (KB).
0u
0
Maximum survivor space 1 capacity (KB).
0u
0
Current survivor space 1 capacity (KB).
0u
0
Maximum eden space capacity (KB).
0u
0
Current eden space capacity (KB).
0u
0
Number of young generation GC events.
0u
?New Generation Space Size Statistics?????
?Column???Description??
?NGCMN?????
+936u
-936u
?NGCMX?????
+936u
-936u
?NGC?????
+936u
-936u
?S0CMX?????
+936u
-936u
?S0C?????
+936u
-936u
?S1CMX?????
+936u
-936u
?S1C?????
+936u
-936u
?ECMX?????
+936u
-936u
?EC?????
+936u
-936u
?YGC?????
+936u
-936u
?FGC???Number of Full GC Events.??
0u

-gcold Option

0u
0
Permanent space utilization (KB).
0u
0
Current old space capacity (KB).
0u
0
old space utilization (KB).
0u
0
Number of young generation GC events.
0u
0
Full garbage collection time.
0u
0
Total garbage collection time.
0u
?Old and Permanent Generation Statistics?????
?Column???Description??
?PC?????
+1008u
-1008u
?PU?????
+1008u
-1008u
?OC?????
+1008u
-1008u
?OU?????
+1008u
-1008u
?YGC?????
+1008u
-1008u
?FGC???Number of full GC events.??
?FGCT?????
+1008u
-1008u
?GCT?????
+1008u
-1008u
0u

-gcoldcapacity Option

0u
0
Maximum old generation capacity (KB).
0u
0
Current old generation capacity (KB).
0u
0
Current old space capacity (KB).
0u
0
Number of young generation GC events.
0u
0
Full garbage collection time.
0u
0
Total garbage collection time.
0u
?Old Generation Statistics?????
?Column???Description??
?OGCMN?????
+672u
-672u
?OGCMX?????
+672u
-672u
?OGC?????
+672u
-672u
?OC?????
+672u
-672u
?YGC?????
+672u
-672u
?FGC???Number of full GC events.??
?FGCT?????
+672u
-672u
?GCT?????
+672u
-672u
0u

-gcpermcapacity Option

0u
0
Maximum permanent generation capacity (KB).
0u
0
Current permanent generation capacity (KB).
0u
0
Current permanent space capacity (KB).
0u
0
Number of young generation GC events.
0u
0
Full garbage collection time.
0u
0
Total garbage collection time.
0u
?Permanent Generation Statistics?????
?Column???Description??
?PGCMN?????
+816u
-816u
?PGCMX?????
+816u
-816u
?PGC?????
+816u
-816u
?PC?????
+816u
-816u
?YGC?????
+816u
-816u
?FGC???Number of full GC events.??
?FGCT?????
+816u
-816u
?GCT?????
+816u
-816u
0u

-gcutil Option

0u
0
Survivor space 1 utilization as a percentage of the space's current capacity.
0u
0
Eden space utilization as a percentage of the space's current capacity.
0u
0
Old space utilization as a percentage of the space's current capacity.
0u
0
Permanent space utilization as a percentage of the space's current capacity.
0u
0
Number of young generation GC events.
0u
0
Young generation garbage collection time.
0u
0
Full garbage collection time.
0u
0
Total garbage collection time.
0u
?Summary of Garbage Collection Statistics?????
?Column???Description??
?S0?????
+1032u
-1032u
?S1?????
+1032u
-1032u
?E?????
+1032u
-1032u
?O?????
+1032u
-1032u
?P?????
+1032u
-1032u
?YGC?????
+1032u
-1032u
?YGCT?????
+1032u
-1032u
?FGC???Number of full GC events.??
?FGCT?????
+1032u
-1032u
?GCT?????
+1032u
-1032u
0u

-printcompilation Option

0u
0
Number of bytes of bytecode for the method.
0u
0
Class name and method name identifying the compiled method. Class name uses "/" instead of "." as namespace separator. Method name is the method within the given class. The format for these two fields is consistent with the HotSpot \- \f3XX:+PrintComplation\fP option.
0u
?HotSpot Compiler Method Statistics?????
?Column???Description??
?Compiled?????
+888u
-888u
?Size?????
+888u
-888u
?Type???Compilation type.??
?Method?????
+888u
-888u
0u

EXAMPLES

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% utilized, 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 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

java(1) - the Java Application Launcher
jps(1) - the Java Process Status Application
jstatd(1) - the jvmstat daemon
rmiregistry(1) - the Java Remote Object Registry

16 Mar 2012