Mercurial > hg > Members > toma > benchmark
changeset 4:081e4ac89157
add calc_avg
author | Daichi TOMA |
---|---|
date | Tue, 02 Jul 2013 18:03:37 +0900 |
parents | df590d4c29bd |
children | 91b6bf5c7a39 |
files | calc_avg.sh loop_qsub.sh |
diffstat | 2 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/calc_avg.sh Tue Jul 02 18:03:37 2013 +0900 @@ -0,0 +1,18 @@ +#!/bin/sh + +function average() { + total=0.0 + count=0 + while read time + do + total=`echo $total + $time | bc` + count=`echo $count + 1 | bc` + done + avg=`echo "scale=4;$total/$count" | bc` + echo "$count,$avg" +} + +for arg in $@ +do + average < $arg +done