Skip to content

Instantly share code, notes, and snippets.

@ninozhang
Created June 11, 2013 16:19
Show Gist options
  • Save ninozhang/5758292 to your computer and use it in GitHub Desktop.
Save ninozhang/5758292 to your computer and use it in GitHub Desktop.
jmap.sh
#!/bin/bash
if [ $# -eq 0 ]; then
echo >&2 "Usage: jstackSeries <pid> [ <count> [ <delay> ] ]"
echo >&2 " Defaults: count = 1000, delay = 10 (seconds)"
exit 1
fi
pid=$1 # required
count=${2:-1000} # defaults to 10 times
delay=${3:-10} # defaults to 0.5 seconds
while [ $count -gt 0 ]
do
jmap -dump:format=b,file=jmap.$pid.$(date +%H%M%S.%N).hprof $pid
sleep $delay
let count--
echo -n "."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment