首页  

jvm热点线程定位     所属分类 java 浏览量 1517
top -c   
-c 按cpu使用排序

按 数字1  , 查看各个核的cpu使用情况 ,可查看核数

top -bn1 -H -p $PID  (推荐使用这个)
-bn1  刷新一次后退出

-b 避免输出控制字符
top -n 1 只显示一屏信息 


top  -H -p $PID  (会一直刷新)

ps -mp $PID -o THREAD,tid,time | sort -rn
jstack $PID



printf "%x\n"  $threadid

top 显示的线程id 为 10进制  ,转成 16进制

printf "%x\n" 85032
14c28

jstack 84982 |grep 14c28
"Thread-12" #24 daemon prio=5 os_prio=0 tid=0x00007f3f5097b000 nid=0x14c28 waiting on condition [0x00007f3ebc627000]


jstack 84982 |grep -C30 14c28

grep -C30  显示匹配结果的前后30行


jstack 84982 |grep -C10 14c28
 

 
	- parking to wait for  <0x00000000c06066f8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
	at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
	at sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:262)
	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

"Thread-12" #24 daemon prio=5 os_prio=0 tid=0x00007f3f5097b000 nid=0x14c28 waiting on condition [0x00007f3ebc627000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000000c06066f8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
	at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
	at sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:262)
	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	


上一篇     下一篇
jcmd PerfCounter 说明

集合遍历删除注意点

java编码规范

并发编程模型

slf4j为什么用{}而不是%s

java获取系统信息