Created
April 28, 2014 20:50
-
-
Save markito/11383612 to your computer and use it in GitHub Desktop.
Takes live histograms every $2 seconds of $1 process
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 | |
### | |
# Takes live histograms every $2 seconds of $1 process | |
### | |
## set your java home | |
#JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Hom | |
if [[ ! -x "$JAVA_HOME/bin/jmap" ]]; then | |
echo "Script not able to find JAVA_HOME/bin/jmap - Please set JAVA_HOME environment variable" | |
exit -1 | |
fi | |
## params | |
PID=$1 | |
OUTPUT=histoDump-$PID.$(date +"%m%d%Y-%H%M%S").log | |
## INTERVAL | |
if [[ -z "$2" ]]; then | |
INTERVAL=15 | |
else | |
INTERVAL=$2 | |
fi | |
for i in {1..3}; do | |
NOW=`date` | |
echo "Dump $i - $NOW" | |
echo $NOW >> $OUTPUT | |
$JAVA_HOME/bin/jmap -histo:live $PID >> $OUTPUT | |
sleep $INTERVAL | |
done | |
echo "Done." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment