blob: fec1a7c5a1bb30829d8ebf16fc8acf6f1358a949 [file] [log] [blame]
#!/bin/sh
#
# Program: TimeProgram.sh
#
# Synopsis: Get reliable timing results for a program
#
# Syntax: ./TimeProgram <name> Program args...
#
NAME=$1
shift
echo "Timing $NAME"
# discard first output
time -p $* > /dev/null 2>&1
# Gather three data points
(time -p $* > /dev/null) 2>&1 | grep user | sed 's/user //'
(time -p $* > /dev/null) 2>&1 | grep user | sed 's/user //'
(time -p $* > /dev/null) 2>&1 | grep user | sed 's/user //'