#!/bin/sh usage() { echo "*** usage: $0 ..." 2>&1 exit 1 } match="" while [ x"$match" = x ] do echo "Choose a statistic:" echo "" echo " (a) Elapsed Time" echo " (b) CPU Time" echo " (c) Memory (Max Heap Usage)" echo " (d) Number of Page Faults" echo " (e) Number of Operations" echo " (f) Number of GCs" echo " (g) GC Time" echo " (h) Expansion Time" echo " (i) Reduction Time" echo " (j) Peak number of BDD nodes" echo " (k) BDD avg nodes visit length" echo " (l) Peak number of cache nodes" echo " (m) Cache avg nodes visit length" echo " (n) Number of cache lookups" echo " (o) Cache hit rate" echo " (p) Number of variable reordering" echo " (q) Time on variable reorderings" echo check=x`echo -n x` case $check in x-*) printf "What statistic (a-q) ? [a] ";; x*) echo -n "What statistic (a-q) ? [a] ";; esac read answer case x"$answer" in x | xa | xA) match="Elapsed Time:";; xb | xB) match="CPU Time:";; xc | xC) match="Memory (Max Heap Usage):";; xd | xD) match="Number of Page Faults:";; xe | xE) match="Number of Operations:";; xf | xF) match="Number of GCs:";; xg | xG) match="GC Time:";; xh | xH) match="Expansion Time:";; xi | xI) match="Reduction Time:";; xj | xJ) match="Peak number of BDD nodes:";; xk | xK) match="BDD avg nodes visit length:";; xl | xL) match="Peak number of cache nodes:";; xm | xM) match="Cache avg nodes visit length:";; xn | xN) match="Number of cache lookups:";; xo | xO) match="Cache hit rate:";; xp | xP) match="Number of variable reordering:";; xq | xQ) match="Time on variable reorderings:";; *) match=""; echo "*** non valid answer";; esac done if [ -d "$match" ] then echo "*** $match is a directory" 2>&1 usage fi dirs="" while [ $# -gt 0 ] do if [ -d $1 ] then dirs="$dirs $1" else echo "*** $1 is not a directory" 2>&1 usage fi shift done if [ x"$dirs" = x ]; then usage; fi tmp=/tmp/plotit-$$ if [ ! -d $tmp ]; then mkdir $tmp; fi stats="plot " i=1 mbs="" for dir in $dirs do echo "processing $dir" data="$tmp/`echo /$dir | sed -e 's,/*$,,' -e 's,.*/,,'`.$i" cat /dev/null > $data for out in $dir/*.out do mb=`basename $out .out` stat=`fgrep "$match" $out | sed -e 's,.*:[ ]*,,' -e 's,[^0-9]*$,,'` if [ x"$stat" = x ] then echo "*** $0: $out does not contain \"$match\"" 2>&1 else echo "$mb $stat" >> $data mbs="$mbs $mb" fi done if [ $i -ne 1 ]; then stats="$stats,"; fi stats="$stats \"$data\" title \"$dir\" with linespoints" i=`expr $i + 1` done cat /dev/null > $tmp/script mbs=`echo $mbs | sort -n | uniq` if [ ! x"$mbs" = x ] then tics="" for mb in $mbs do if [ x"$tics" = x ] then tics="set xtics ($mb" else if [ x`expr 50 \* \( $mb / 50 \)` = x$mb ] then tics="$tics, \"$mb\" $mb" else tics="$tics, \"\" $mb" fi fi done tics="${tics})" echo $tics >> $tmp/script fi echo "set xlabel \"MB\"" >> $tmp/script echo "set ylabel \" $match\"" >> $tmp/script echo "set grid" >> $tmp/script echo $stats >> $tmp/script echo "pause -1 \"press return to exit\"" >> $tmp/script gnuplot $tmp/script rm -rf $tmp