Overview
Jstat is a tool that you can use to observe information about the runtime of a Java application, which is very powerful and allows you to view the details of the heap information.
Basic usage
The basic usage syntax for the JSTAT command is as follows:
jstat-option [-T] [-h] pid [interval] [count]
- Options option can consist of the following values.
- -class: Displays information about the ClassLoader.
- -compiler: Displays information about JIT compilation.
- -GC: Displays heap information related to GC.
- -gccapacity: Displays the capacity and usage of each generation.
- -gccause: Displays information about garbage collection (same as-gcutil), and shows the cause of the last or current garbage collection that is taking place.
- -gcnew: Displays new generation information.
- -gcnewcapacity: Shows the Cenozoic size and usage.
- -gcold: Displays information for Laosheng generation and permanent generation.
- -gcoldcapacity: Shows the size of the old age.
- -gcpermcapacity: Displays the size of the permanent generation.
- -gcutil: Displays garbage collection information.
- -printcompilation: Output JIT-compiled method information.
- The-t parameter can precede the output information with a timestamp column that shows when the program is running.
- The-h parameter can then output a header message when the data is output for a periodic period of time, after outputting as many rows of data.
- The interval parameter is used to specify the period of the output statistic in milliseconds (ms).
- The count parameter specifies how many times the data is output altogether.
Use-class in detail
The following command outputs a PID of 2500 ClassLoader related information for this process, which counts information once per second and outputs two times.
Loaded represents the number of classes loaded, the first bytes represents the total size of the loaded class, unloaded represents the number of classes unloaded, the second bytes represents the total size of the unloaded class, and time represents the total amount of times the class is loaded and unloaded.
-compiler use
The following command looks at JIT-compiled information:
Compiled represents the number of compile task executions, failed indicates the number of compile failures, invalid indicates the number of times the compilation is unavailable, Time represents the total duration of compilation, and Failedtype represents the type of the last compilation. Failedmethod represents the class name and method name for the last compilation failure.
-GC use
The following command displays the output of the heap information associated with the GC:
- S0c:s0 (from) size (KB)
- S1C:S1 (from) size (KB)
- S0u:s0 (from) used Space (KB)
- S1U:S1 (from) already used space (KB)
- Ec:eden area size (KB)
- Space already used in the Eu:eden area (KB)
- OC: old age size (KB)
- OU: space already used in the old age (KB)
- PC: Permanent area size (KB)
- PU: space already used in the permanent Zone (KB)
- YGC: Number of new Generation GC
- YGCT: New Generation GC time consuming
- Fgc:full GC Times
- Fgct:full GC Time consuming
- GCT:GC Total time-consuming
-gccapacity use
The following command shows the information for each generation, compared to-GC, which not only outputs the current size of each generation, but also outputs the maximum and minimum values for each generation:
* NGCMN: Cenozoic minimum (KB)
* NGCMX: Cenozoic maximum (KB)
* NGC: Current Cenozoic size (KB)
* OGCMN: Old age large minimum (KB)
* OGCMX: Maximum value of the old age (KB)
* OGC: Current old age size (KB)
* PGCMN: Minimum value for permanent generation (KB)
* PGCMX: Maximum value for permanent generation (KB)
-gccause use
The following command shows the reason for the most recent GC, and the reason for the current GC:
- LGCC: The reason for the last GC, you can see that the reason for the last GC is allocation Failure
- GCC: Reason for current GC, no GC currently in the diagram
-gcnew use
The following command shows the details of the new generation:
* TT: The age of the new generation of objects promoted to the old age.
* MTT: The maximum value of the age of the new generation of objects promoted to the old age.
* DSS: The size of the desired survivor area.
-gcnewcapacity use
The following command details the size of each of the Cenozoic regions:
* Maximum value of S0cmx:s0 area (KB)
* Maximum value of s1cmx:s1 area (KB)
* Maximum value of Ecmx:eden area (KB)
-gcold use
The following command shows the old-age GC profile:
-gcoldcapacity use
The following commands are used to display the capacity information for the old age:
-gcpermcapacity use
The following commands are used to display the usage of the persistence zone:
The Jstat command uses