You can use R to quickly compute the mean, standard-deviation and other interesting values.
For example, you can use GNU time to write several runtime measurements into a CSV file:
function measure
{
f=$1; shift
n=$2; shift
echo wall,user,sys,rss > "$f"
for i in $(seq $n); do
/usr/bin/time --output "$f" --append --format '%e,%U,%S,%M' "$@" >/dev/null
done
}
Then you can generate the values with R like this:
Rscript --vanilla -e "b=read.csv(file='$f');summary(b);sapply(b, sd);"
I've created a small benchmark script that also does some pretty printing of the R output, e.g.:
$ benchmark.sh 100 ./some_prog arg1 arg2
n=100 | min | Q1 | med | mean | Q3 | max | std
wall | 0.0400 | 0.0400 | 0.0500 | 0.0471 | 0.0500 | 0.0800 | 0.00624
user | 0.0400 | 0.0400 | 0.0400 | 0.0426 | 0.0400 | 0.0700 | 0.00562
sys | 0 | 0 | 0 | 0 | 0 | 0 | 0.00000
rss | 2608 | 2657 | 2704 | 2728 | 2764 | 2920 | 95.06524