Created
November 14, 2011 18:52
-
-
Save tmoreira2020/1364754 to your computer and use it in GitHub Desktop.
Gets a thread dump and memory photo of a Java application
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/bash | |
if [ -n "$1" ]; then | |
for (( ; ; )) | |
do | |
echo "infinite loops [ hit CTRL+C to stop]" | |
pid=`jps | grep $1 | awk '{print $1}'` | |
echo "Getting dump from process $pid" | |
jstat -gcutil $pid 250 3 >> dump-memory-$pid.txt | |
jstack -l $pid >> dump-thread-$pid.trc | |
jstat -gcutil $pid 250 3 | grep -v YGC >> dump-memory-$pid.txt | |
time=20; | |
echo "Sleeping for $time seconds" | |
sleep $time; | |
done | |
else | |
You have to provide a process name, like "Bootstrap". | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment