打印耗CPU高的java进程中对应的线程dump shell脚本
#!/bin/bash pid=$1 if test -z $pid if test -z "$(jps -l | cut -d '' -f 1 | grep $pid)" lineNum=$2 jstack $pid >> "$pid".bak ps -mp $pid -o THREAD,tid,time | sort -k2r | awk '{if ($1 !="USER" && $2 != "0.0" && $8 !="-") print $8;}' | xargs printf "%x\n" >> "$pid".tmp tidArray="$( cat $pid.tmp)" for tid in $tidArray rm -rf $pid.bak |
本文来自博客园,作者:up~up,转载请注明原文链接:https://www.cnblogs.com/soft-engineer/p/15342899.html