jsp(JVM Process Status Tool) 命令参数详解
jstat(JVM Statistics Monitoring Tool) 命令参数详解
jinfo (Configuration Info for java) 命令参数详解
jmap (Memmory Map for java) 命令参数详解
jhat(Heap Analysis Tool) 命令参数详解
专业分析dumpy文件的工具 Eclipse Memory Analyzer、IBM HeapAnalyzer
jstack (Stack Trace for java) 命令参数详解
- 查看cpu占用高进程: top:
- 查看cpu占用高线程: top -H -p 12345
- 转换线程ID: printf “%x\n” 17880
- 定位cpu占用线程: jstack 17850|grep 45d8 -A 30
jstack 17850|grep 45d8 -A 30
"pool-1-thread-11" #20 prio=5 os_prio=0 tid=0x00007fc860352800 nid=0x45d8 runnable [0x00007fc8417d2000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:326)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
- locked <0x00000006c6c2e708> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(PrintStream.java:482)
- locked <0x00000006c6c10178> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
- locked <0x00000006c6c26620> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
at java.io.PrintStream.write(PrintStream.java:527)
- eliminated <0x00000006c6c10178> (a java.io.PrintStream)
at java.io.PrintStream.print(PrintStream.java:597)
at java.io.PrintStream.println(PrintStream.java:736)
- locked <0x00000006c6c10178> (a java.io.PrintStream)
at com.demo.guava.HardTask.call(HardTask.java:18)
at com.demo.guava.HardTask.call(HardTask.java:9)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"pool-1-thread-10" #19 prio=5 os_prio=0 tid=0x00007fc860345000 nid=0x45d7 waiting on condition [0x00007fc8418d3000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006c6c14178> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
[**HSDIS (HotSpot JIT 编译代码的反汇编工具) **]
-XX:+PrintAssembly 通过这个指令可以把动态生成的本地代码 还原为汇编代码,同时,还带有大量有价值的注释;
可以 在Project Kenai 下载编译好的插件,直接放到JDK_HOME/jre/bin/client 和 JDK_HOME/jre/bin/server 目录下即可。
注: debug 版 -XX:+PrintAssembly 即可;product版 还要加上 -XX: +UnlockDiagnosticVMOptions ;