.Nd shell script to consistently execute benchmarks
.Sh SYNOPSIS
.Nm worldstone
+.Op Fl s
.Op Fl n Ar iterations
.Op Fl c Ar command
.Op Fl p Ar command
The options are as follows:
.Bl -tag -width Ds
+.It Fl s
+If set, perform statistical profiling by invoking
+.Xr profile 1
+and executing sprofalyze, suitable for feeding to sprofdiff. This
+requires building world with SPROFILE.
.It Fl n Ar iterations
Set the number of iterations to perform, after the initial run.
The default is 5.
set -e
-while getopts "n:d:p:c:r:" c
+while getopts "n:d:p:c:r:s" c
do
case "$c" in
+ s) PROFILE=1 ;;
n) ITERATIONS=$OPTARG ;;
p) PRECMD="$OPTARG" ;;
c) COMMAND="$OPTARG" ;;
sh -c "$PRECMD"
sh -c "$COMMAND"
+if [ "$PROFILE" ]; then profile stop || true; fi
+
for n in `seq 1 $ITERATIONS`
do echo -n "$n"
sh -c "$PRECMD >/dev/null 2>&1"
echo -n "."
sync
+ PROF=$LOGFILE.p.$n
+ if [ "$PROFILE" ]; then profile start --rtc -o $PROF -f 3; fi
time -C sh -c "$COMMAND >/dev/null 2>&1; sync" 2>>$LOGFILE
+ if [ "$PROFILE" ]; then profile stop; sprofalyze -d $PROF >$PROF.d; fi
echo -n " "
done
echo "Done."