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