jcmd
Contents
jcmd
New Features in JDK7 update 4
JRockit command line utility JRCMD (JRockit Command). JRCMD was a command line tool to enumerate the Java processes running on the local machine, and to send commands (referred to as “Diagnostic Commands”) to them. JRCMD has been renamed JCMD (Java Command).
jcmd用于向正在运行的JVM发送诊断信息请求,是从JDK1.7开始提供可以说是jstack和jps的结合体
|
|
jcmd [ pid | main-class ] command [ arguments ]
JFR
JFR需要JDK的商业证书,需要解锁jdk的商业特性。
JFR.stop
JFR.start
JFR.dump
JFR.check
NMT
VM.native_memory
解锁jdk的商业特性
VM.check_commercial_features
VM.unlock_commercial_features
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html
JMX
http://blog.wiloon.com/?p=9748
ManagementAgent.stop
ManagementAgent.start_local
ManagementAgent.start
rotate GC log
GC.rotate_log
#类元数据大小的详细信息。使用这个功能启动程序时需要加上-XX:+UnlockDiagnosticVMOptions选项。
#Provide statistics about Java class meta data. Requires -XX:+UnlockDiagnosticVMOptions.
GC.class_stats
#查看系统中类统计信息,类型的存活对象数目。 jmap -histo:live ,这里的以byte为单位的占用大小是浅尺寸(shallow size),并没有包括子对象的大小。
GC.class_histogram
#Generate a HPROF format dump of the Java heap,jmap dump
GC.heap_dump
#Call java.lang.System.runFinalization()
#强制调用已经失去引用的对象的finalize方法
GC.run_finalization
#Call java.lang.System.gc()
#告诉垃圾收集器打算进行垃圾收集,而垃圾收集器进不进行收集是不确定的
GC.run
#系统变量
VM.system_properties
#版本信息
VM.version
http://qkxue.net/info/188931/jcmd-jmc
http://0opslab.com/2016/01/19/JDK%E5%91%BD%E4%BB%A4jcmd/
https://segmentfault.com/a/1190000007518014
http://www.rowkey.me/blog/2016/11/16/java-trouble-shooting/
Author -
LastMod 2017-02-06