jinfo
语法
jinfo [option] <pid>
$ jinfo --help
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Usage:
jinfo [option] <pid>
(to connect to running process)
jinfo [option] <executable <core>
(to connect to a core file)
jinfo [option] [server_id@]<remote server IP or hostname>
(to connect to remote debug server)
where <option> is one of:
-flag <name> to print the value of the named VM flag
-flag [+|-]<name> to enable or disable the named VM flag
-flag <name>=<value> to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
<no option> to print both of the above
-h | -help to print this help message
查看一个JVM进程的最大堆内存
# 这里的单位是 byte
$ jinfo -flag MaxHeapSize 13116
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
-XX:MaxHeapSize=4271898624
-flags
查看非JVM默认参数信息
# 这里查看的是一个 spring cloud 的一个网关程序
$ jinfo -flags 12299
Attaching to process ID 12299, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.111-b14
# 不是 JVM 默认参数,被修改过
Non-default VM flags: -XX:CICompilerCount=3 -XX:InitialHeapSize=62914560 -XX:MaxHeapSize=1048576000 -XX:MaxNewSize=349175808 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=20971520 -XX:OldSize=41943040 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseParallelGC
# 这里是前几天我通过命令行运行程序的时候加上的 java -Xmx1000m -jar xxx
Command line: -Xmx1000m
查看垃圾回收器
# 表示ConcMarkSweepGC是关闭状态的
$ jinfo -flag UseConcMarkSweepGC 12299
-XX:-UseConcMarkSweepGC
# 表示G1GC是关闭状态的
$ jinfo -flag UseG1GC 12299
-XX:-UseG1GC
# 表示ParallelGC是开启状态的
$ jinfo -flag UseParallelGC 12299
-XX:+UseParallelGC