JDK 14 调试神器了解一下?
Posted 朱小厮的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JDK 14 调试神器了解一下?相关的知识,希望对你有一定的参考价值。
后台回复"加群",加入新技术
jcmd [pid | main-class] command... | PerfCounter.print | -f filename
jcmd [-l]
jcmd -h
./jcmd 93989 help
93989:
The following commands are available:
Compiler.CodeHeap_Analytics
Compiler.codecache
Compiler.codelist
Compiler.directives_add
Compiler.directives_clear
Compiler.directives_print
Compiler.directives_remove
Compiler.queue
GC.class_histogram
GC.class_stats
GC.finalizer_info
GC.heap_dump
GC.heap_info
GC.run
GC.run_finalization
JFR.check
JFR.configure
JFR.dump
JFR.start
JFR.stop
JVMTI.agent_load
JVMTI.data_dump
ManagementAgent.start
ManagementAgent.start_local
ManagementAgent.status
ManagementAgent.stop
Thread.print
VM.class_hierarchy
VM.classloader_stats
VM.classloaders
VM.command_line
VM.dynlibs
VM.events
VM.flags
VM.info
VM.log
VM.metaspace
VM.native_memory
VM.print_touched_methods
VM.set_flag
VM.stringtable
VM.symboltable
VM.system_properties
VM.systemdictionary
VM.uptime
VM.version
help
-f filename表示从文本文件中读取要运行的命令。
-l 列出不是运行在docker中JVM。
-h 表示帮助。
下面我们举几个常用的例子。
./jcmd -l
98109 jdk.jcmd/sun.tools.jcmd.JCmd -l
./jcmd 93989 Thread.print -l
Full thread dump Java HotSpot(TM) 64-Bit Server VM (14.0.1+7 mixed mode, sharing):
Threads class SMR info:
_java_thread_list=0x00007fbeb1c4cb10, length=12, elements={
0x00007fbeb282a800, 0x00007fbeb282d800, 0x00007fbeb282e800, 0x00007fbeb2830800,
0x00007fbeb2831800, 0x00007fbeb2832000, 0x00007fbeb2833000, 0x00007fbeb3831000,
0x00007fbeb3822000, 0x00007fbeb3174000, 0x00007fbeb3815000, 0x00007fbeb226f800
}
"Reference Handler" #2 daemon prio=10 os_prio=31 cpu=0.64ms elapsed=8996.59s tid=0x00007fbeb282a800 nid=0x4703 waiting on condition [0x000070000440d000]
java.lang.Thread.State: RUNNABLE
at java.lang.ref.Reference.waitForReferencePendingList(java.base@14.0.1/Native Method)
at java.lang.ref.Reference.processPendingReferences(java.base@14.0.1/Reference.java:241)
at java.lang.ref.Reference$ReferenceHandler.run(java.base@14.0.1/Reference.java:213)
Locked ownable synchronizers:
- None
./jcmd 93989 GC.heap_dump heap_dump.out
93989:
Dumping heap to heap_dump.out ...
Heap dump file created [27727979 bytes in 0.643 secs]
./jcmd 93989 GC.heap_dump heap_dump.out
93989:
Dumping heap to heap_dump.out ...
Heap dump file created [27727979 bytes in 0.643 secs]
./jcmd 93989 GC.class_histogram
93989:
num #instances #bytes class name (module)
-------------------------------------------------------
1: 25826 11748304 [B (java.base@14.0.1)
2: 2233 1971800 [I (java.base@14.0.1)
3: 5154 614928 java.lang.Class (java.base@14.0.1)
4: 24757 594168 java.lang.String (java.base@14.0.1)
5: 4491 439432 [Ljava.lang.Object; (java.base@14.0.1)
6: 13177 421664 java.util.concurrent.ConcurrentHashMap$Node (java.base@14.0.1)
7: 5025 160800 java.util.HashMap$Node (java.base@14.0.1)
8: 8793 140688 java.lang.Object (java.base@14.0.1)
9: 212 103584 [Ljava.util.concurrent.ConcurrentHashMap$Node; (java.base@14.0.1)
想知道更多?扫描下面的二维码关注我
当当618图书优惠活动,每满100-50,我这里还有一批“实付满200再减30”的优惠码TEGNC6 ,囤书薅羊毛再走一波~~(使用时间:5月18~6月1日,使用渠道:当当小程序或当当APP)
朕已阅
以上是关于JDK 14 调试神器了解一下?的主要内容,如果未能解决你的问题,请参考以下文章
新手入门Python,也会调试代码了,这款 “神器“ 真的超赞!
新手入门Python,也会调试代码了,这款 “神器“ 真的超赞!
新手入门Python,也会调试代码了,这款 “神器“ 真的超赞!