Created
March 20, 2013 06:01
-
-
Save jamesdbowman/5202634 to your computer and use it in GitHub Desktop.
Bash script to run valgrind a number of times and collect the peak memory usages.
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 | |
echo "Size, Max Heap" | |
for i in {1..10} | |
do | |
SIZE=$(echo "2^"$i | bc) | |
RES=$(valgrind --tool=massif --time-unit=B ./a.out 0 $SIZE &> /dev/null) | |
MEM=$(grep -B 2 "heap_tree=peak" massif.out.* | awk -F '\n' 'ln ~ /^$/ { ln = "matched"; print $1 } $1 ~ /^--$/ { ln = "" }') | |
MEMARR=(${MEM//=/ }) | |
echo $SIZE", "${MEMARR[1]} | |
rm massif.out.* | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment