Created
April 25, 2017 14:06
-
-
Save bubba-h57/e6f9822486ae6c8de394ac1dada814b7 to your computer and use it in GitHub Desktop.
Run a command 100 times and get the average.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -f /tmp/mtime.$$ | |
for x in {1..100} | |
do | |
/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.$$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment