Created
April 30, 2015 22:38
-
-
Save phact/22aa5085e58a43de7425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 3 ]; then | |
echo "Usage: $0 pid interval count" | |
exit 1 | |
fi | |
PID=$1 | |
INTERVAL=$2 | |
COUNT=$3 | |
top -bH -d $INTERVAL -n $COUNT -p $PID >> top.out 2>&1 & | |
for i in `seq $COUNT`; do | |
echo "stack trace $i of $COUNT" >> jstack.out | |
jstack -l $PID >> jstack.out | |
echo "--------------------" >> jstack.out | |
sleep $INTERVAL | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment