jstat
Introduction
You can run the jstat command to view the usage of each part of the heap memory and the number of loaded classes.
Installation Mode
Use OpenJDK to install this tool. For Bisheng JDK, it is a built-in tool.
Usage
- If a Java environment is configured, you can directly run the jstat command.
- If no Java environment is not configured, run the ps -ef | grep java command to find the Java process. Then, switch to the JDK bin directory and run the ./jstat command.
Syntax:
jstat -gcutil $pid 1000
1000 indicates that statistics are output every 1000 ms.
Common parameters are as follows:
Parameter
Description
-gc
Displays garbage collection statistics (value).
-gcutil
Displays garbage collection statistics (percentage).
-class
Displays class loading statistics.
-compiler
Displays compilation statistics.
-gccapacity
Displays the capacity and space usage of three generation objects in the VM memory.
-gcnew
Displays information about young-generation objects.
-gcnewcapacity
Displays information about young-generation objects and their space usage.
-gcold
Displays information about old-generation objects.
-gcoldcapacity
Displays information about old-generation objects and their space usage.
-printcompilation
Displays execution information about the current VM.