Introduction to jcmd
After JDK1.7, Java added a new command line tool jcmd. jcmd is a versatile tool that can be used to implement the functions of all the previous commands except jstat. For example: use it to export heap, memory usage, view Java processes, export thread information, perform GC, JVM runtime, etc.
jcmd has most of the functions of jmap, and it is also recommended to use the jcmd command instead of the jmap command on Oracle's official website.
官网:https://docs.oracle.com/en/java/javase/11/tools/jcmd.html
View the process number (same as jps)
See which commands the specified process applies to
View thread information (same as jstack)
View the histogram of classes (same as jmap -histo)
Heap dump function (same as jmap -dump)
View the running time of the Java process
[root@bogon ~]# jstat -class -t 4622
Timestamp Loaded Bytes Unloaded Bytes Time
893.4 425 880.7 0 0.0 0.11
[root@bogon ~]# jcmd 4622 VM.uptime
4622:
897.023 s
Print system property information (jinfo -sysprops process ID)
View modified parameters after JVM startup
jcmd 4622 VM.flags
jinfo -flags 4622