]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Average and standard deviation are now rounded at two digits past the decimal point.
authorBart Van Assche <bvanassche@acm.org>
Wed, 18 Jun 2008 14:14:03 +0000 (14:14 +0000)
committerBart Van Assche <bvanassche@acm.org>
Wed, 18 Jun 2008 14:14:03 +0000 (14:14 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8253

exp-drd/scripts/measurement-functions

index d90a2921ddda476a081625edd68c4061bd1fe853..ab02d39ada0c3ec450e05d15d5e4c79568a16db8 100644 (file)
@@ -35,7 +35,7 @@ function get_cache_size {
 ## Read a stream of numbers from stdin (one per line), and print the average
 #  and standard deviation.
 function avgstddev {
-  awk '{n++;m=NF;for(i=1;i<=NF;i++){sum[i]+=$i;sumsq[i]+=$i*$i}}END{for(i=1;i<=m;i++){d=sumsq[i]/n-sum[i]*sum[i]/n/n;printf "%g %g ",sum[i]/n,(d>0?sqrt(d):0)}}'
+  awk '{n++;m=NF;for(i=1;i<=NF;i++){sum[i]+=$i;sumsq[i]+=$i*$i}}END{for(i=1;i<=m;i++){d=sumsq[i]/n-sum[i]*sum[i]/n/n;printf "%.2f %.2f ",sum[i]/n,(d>0?sqrt(d):0)}}'
 }
 
 ## Query the virtual memory size for the last invocation of command $1 from
@@ -116,6 +116,6 @@ function print_runtime_ratio {
   measure_runtime "$@" | avgstddev > "$tmp"
   read avg2 stddev2 vsz2 vszdev2 < "$tmp"
   echo "Average time: ${avg2} +/- ${stddev2} seconds / VSZ ${vsz2} +/- ${vszdev2} KB"
-  awk "END{print "'"'"Ratio ="'"'", ${avg2}/${avg1}, "'"'"+/-"'"'", ${avg2}/${avg1}*(${stddev1}/${avg1}+${stddev2}/${avg2}), "'"; VSZ ratio: "'", ${vsz2:-0}/${vsz1}, "'"'"+/-"'"'", ${vsz2:-0}/${vsz1}*(${vszdev1}/${vsz1}+${vszdev2:-0}/${vsz2:-1})}" </dev/null
+  awk "END{printf "'"'"Ratio = %.2f +/- %.2f; VSZ ratio: %.2f +/- %.2f\n"'"'", ${avg2}/${avg1}, ${avg2}/${avg1}*(${stddev1}/${avg1}+${stddev2}/${avg2}), ${vsz2}/${vsz1}, ${vsz2}/${vsz1}*(${vszdev1}/${vsz1}+${vszdev2}/${vsz2})}" </dev/null
 }