language agnostic - Calculate the average of several "time" commands in Linux -


i'm profiling program on linux, using "time" command. problem it's output not statistically relevant run program once. there tool or way average of several "time" runs? possibly aswel statistical information such deviation?

here script wrote similar looking for. runs provided command 10 times, logging real, user cpu , system cpu times file, , echoing tham after each command output. uses awk provide averages of each of 3 columns in file, not (yet) include standard deviation.

#!/bin/bash  rm -f /tmp/mtime.$$  x in {1..10}   /usr/bin/time -f "real %e user %u sys %s" -a -o /tmp/mtime.$$ $@   tail -1 /tmp/mtime.$$ done  awk '{ et += $2; ut += $4; st += $6; count++ } end {  printf "average:\nreal %.3f user %.3f sys %.3f\n", et/count, ut/count, st/count }' /tmp/mtime.$$ 

Comments