Skip to content

Instantly share code, notes, and snippets.

@Dieterbe
Created November 7, 2018 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dieterbe/8add09eeebca324e360afd2a21d66f61 to your computer and use it in GitHub Desktop.
Save Dieterbe/8add09eeebca324e360afd2a21d66f61 to your computer and use it in GitHub Desktop.
#!/bin/bash
log () {
echo "$(date +'%Y/%m/%d %H:%M:%S') $@"
}
for commit in $(cat commits); do
echo
log "doing $commit"
echo
git checkout $commit
make
./carbon-relay-ng dieter-configs/carbon-relay-ng.ini.anderender &> out-$commit.txt &
pid=$!
echo "pid is $pid"
> memory-$commit.txt
for i in {1..600}; do
sleep 1
rss=$(ps --no-headers -o rss -p $pid | sed 's#$#000#')
heap=$(curl -s 'http://127.0.0.1:8082/debug/pprof/heap?debug=1' | awk '/HeapAlloc/ {print $NF}')
echo "$rss $heap" >> memory-$commit.txt
if [ $i -eq 1 -o $((i % 60)) -eq 0 ]; then
wget http://127.0.0.1:8082/debug/pprof/heap -O heap-$commit-$i
fi
done
kill $pid
gnuplot -p -e "set terminal png size 1280,720; set output '${commit}.png'; set format y '%.0s%cB'; plot 'memory-$commit.txt' using 1 title 'rss' with lines, 'memory-$commit.txt' using 2 title 'heap' with lines";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment