一、JDK命令行工具
1. jps 查看Java进程
C:\Users\Another>jps
7488 OmsOperationServiceApplication
10500 RemoteMavenServer
17432 Launcher
24024 Jps
4152 jar
10508
2. jinfo 查看和调整JVM配置参数
The jinfo command prints Java configuration information for a specified Java process or core file or a remote debug server. The configuration information includes Java system properties and Java Virtual Machine (JVM) command-line flags.
# 查看某个java进程的name属性的值
jinfo -flag name PID
#比如:
jinfo -flag MaxHeapSize PID
jinfo -flag UseG1GC PID
#查询曾经赋过值的一些参数
jinfo -flags PID
C:\Users\Another>jinfo -flag MaxHeapSize 7488
-XX:MaxHeapSize=2136997888
3. jsta 统计信息监视工具
查看虚拟机性能统计信息
The jstat command displays performance statistics for an instrumented Java HotSpot VM. The target JVM is identified by its virtual machine identifier, or vmid option.
#查询类装信息
jstat -class PID 1000 10 #查看某个java进程的类装载信息,每1000毫秒输出一次,共输出10次 比如: jstat -class PID 1000 10
C:\Users\Another>jstat -class 7488 1000 10
Loaded Bytes Unloaded Bytes Time
16772 30822.0 221 336.2 14.57
16772 30822.0 221 336.2 14.57
16772 30822.0 221 336.2 14.57
#查看垃圾收集信息
jstat -gc PID 1000 10
C:\Users\Another>jstat -gc 7488 1000 10
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
8192.0 8192.0 7840.0 0.0 240640.0 123256.5