Last active
March 25, 2016 13:32
-
-
Save aphor/509a7c7cab0d72efa2b0 to your computer and use it in GitHub Desktop.
If you don't have a tool like DynaTrace, maybe you can collect some trending heap histograms for analysis in pandas?
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 | |
[ -z "$PROJECT" ] && PROJECT=LitWR | |
[ -z "$HOST" ] && HOST=$( hostname ) | |
[ -z "$PGREPEXPR" ] && $PGREPEXPR="Xdock:name=Minecraft" | |
sleep 10 | |
PID=$( pgrep -f "$PGREPEXPR"|head -1 ) | |
while [ x != x$PID ] && [ "0$(pgrep -f "$PGREPEXPR"|head -1)" -eq "0$PID" ] | |
do | |
jcmd $PID GC.class_histogram > ${PROJECT}_$( hostname )_${PID}.Histogram.$( date +%Y%m%d%H%M%S ) | |
sleep 10 | |
done | |
ls ${PROJECT}_${HOST}_${PID}.Histogram.* | | |
sort -n | | |
awk '{n=split($0,array,"."); printf("%s %s\n", array[n], $0 ) }'| | |
( while read dt f | |
do | |
export dt | |
awk '/[0-9]:.*[0-9]/ {printf("%s,%s,'"$dt"'\n",$4,$2,$3)}' < "$f" | |
done ) | | |
( echo ",classname,instances,bytes,timestamp" | |
i=0 | |
while read csvline | |
do | |
echo "$i,$csvline" | |
i="$(( $i + 1 ))" | |
done | |
) > ${PROJECT}_${HOST}_${PID}.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment