mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 20:08:40 +08:00
jstack 导出堆栈信息
This commit is contained in:
parent
26b9667ee7
commit
c97cd35661
35
bin/command/java_Analy.sh
Normal file
35
bin/command/java_Analy.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
T=`ps -mp $1 -o THREAD,tid,time|sort -k 2 -nr|awk '{print $2","$8","$9}'|head -n 11|grep -v "-"`
|
||||
|
||||
Count=$2
|
||||
Name=$3
|
||||
if [ "$Name" = "" ]; then
|
||||
Name="java_Analy.txt";
|
||||
fi
|
||||
|
||||
touch $Name
|
||||
|
||||
: > $Name
|
||||
|
||||
cur_dateTime="`date +%Y-%m-%d_%H:%M:%S`"
|
||||
|
||||
echo "生成时间:$cur_dateTime" >>$Name
|
||||
|
||||
echo "进程id:$T"
|
||||
|
||||
for i in $T
|
||||
do
|
||||
consum=`echo $i |awk -F"," '{print $1}'`
|
||||
tid=`echo $i |awk -F"," '{print $2}'`
|
||||
dtime=`echo $i |awk -F"," '{print $3}'`
|
||||
|
||||
echo "线程id:$tid"
|
||||
|
||||
id=`printf "%x\n" $tid`
|
||||
echo "线程消耗CPU:$consum% 运行时间:$dtime 线程id:$id" >> $Name
|
||||
jstack $1 |grep $id -A $Count >> $Name
|
||||
echo "">> $Name
|
||||
echo "===========================================================================================" >> $Name
|
||||
|
||||
done
|
Loading…
Reference in New Issue
Block a user