JVM 找出最耗 cpu的线程 并打印线程栈

 
监控JVM中最占cpu的线程
top -Hp pid

 

JVM中最占cpu的线程ID
ps -mp 20081 -o THREAD,tid,time | awk 'BEGIN {count=0; } { if($2>0.3&&$8!="-") { a[count]=$8; count++ } } END { printf " \n'\''"; for(i=0;i<count;i++) { if (i==0) { printf "%x",a[i] } else { printf "|%x",a[i] } } printf "'\'' \n" }'


打印线程栈
jstack 20081 | egrep '5ead|5ed6' -A 10

 

posted @ 2017-01-08 19:39  番茄瓜园  阅读(494)  评论(0编辑  收藏  举报