#!/bin/bash # # compute_avg --wf # # --wf (with failure): Compute also averages of runs that failed. # # with_stats=no if test x$1 = x--wf ; then WITH_FAILURE=1 else WITH_FAILURE=0 fi NB_RUNS=3 BENCHMARKS="check compress db jack javac jess mpegaudio mtrt raytrace sablecc soot" VM="switch direct inlined switch-jit direct-jit inlined-jit" for b in $BENCHMARKS; do echo $b for v in $VM; do sum=0 n=0 comp_sum=0 if test -e $b-$v--run-1-result.txt; then success=true for r in `seq 1 $NB_RUNS`; do result_file=$b-$v--run-$r-result.txt if test -e $result_file ; then if test $WITH_FAILURE != 1 -a x`tail -n 1 $result_file` = xFAILURE -o x$success = xfalse ; then success=false else usertime=`tail -n 4 $result_file | grep user | cut -d' ' -f2` systime=`tail -n 4 $result_file | grep sys | cut -d' ' -f2` exectime=`echo "$usertime + $systime" | bc` sum=`echo "$sum + $exectime" | bc` n=`expr $n + 1` if test x$with_stats = xyes ; then ### compilation time ### # Note: For now, not using the ^ like ^STATS ... # because STATS of db doesn't start on its own line. raw_comp_time=`grep 'STATS: Total compilation time: ' $result_file | cut -d':' -f3` sec_comp_time=`echo $raw_comp_time | cut -d' ' -f1` usec_comp_time=`echo $raw_comp_time | cut -d' ' -f3` # adds usec to second sec_comp_time=`echo "scale=6; $sec_comp_time + $usec_comp_time / 1000000" | bc` comp_sum=`echo "$comp_sum + $sec_comp_time" | bc` fi fi fi done if test x$success = xtrue ; then avg=`echo "scale=2; $sum / $n" | bc` if test x$with_stats = xyes ; then avg_comp=`echo "scale=2; $comp_sum / $n" | bc` else avg_comp= fi echo " $v $avg ($n runs) comp: $avg_comp" else echo " $v FAILED!" fi fi done done