2 if [ ! "$MAKE" ]; then MAKE
=make; fi
6 TAG
=time.$
(basename $
(git
--git-dir=/usr
/src
/.git describe
--all --dirty))
10 while getopts "n:d:p:c:r:s" c
14 n
) ITERATIONS
=$OPTARG ;;
15 p
) PRECMD
="$OPTARG" ;;
16 c
) COMMAND
="$OPTARG" ;;
18 r
) echo "Reading settings from $OPTARG"; cat $OPTARG; .
$OPTARG ; echo "Reading done.";;
23 CONFIGPREFIX
=".worldstone"
24 CONFIGVARS
="ITERATIONS PRECMD COMMAND MAKE"
25 TMPF
=.worldstone.tmpconfig.$$
28 do eval "echo $d=\\\"\$$d\\\"" >>$TMPF
30 CONFIGTAG
=`crc <$TMPF | awk '{ print $1 }'`
31 CONFIGFILE
=$CONFIGPREFIX.
$CONFIGTAG
32 mv -f $TMPF $CONFIGFILE
34 LOGFILE
=$TAG.worldstone.log
37 do echo "$0: WARNING: $LOGFILE already exists, appending."
41 echo "Logging to $LOGFILE."
47 if [ "$PROFILE" ]; then profile stop || true
; fi
49 for n
in `seq 1 $ITERATIONS`
51 sh
-c "$PRECMD >/dev/null 2>&1"
55 if [ "$PROFILE" ]; then profile start
--rtc -o $PROF -f 3; fi
56 time -C sh
-c "$COMMAND >/dev/null 2>&1; sync" 2>>$LOGFILE
57 if [ "$PROFILE" ]; then profile stop
; sprofalyze
-d $PROF >$PROF.d
; fi
61 echo "Time measurements logfile is $LOGFILE."
62 echo "Config file is $CONFIGFILE."