From: Ben Gras Date: Wed, 5 Sep 2012 21:42:41 +0000 (+0200) Subject: worldstone: add -s for statistical profiling X-Git-Tag: v3.2.1~317 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-dsfromkey.html?a=commitdiff_plain;h=24776434f5b260a935649258eec745d63183ddfd;p=minix.git worldstone: add -s for statistical profiling --- diff --git a/commands/worldstone/worldstone.1 b/commands/worldstone/worldstone.1 index b21384d5f..834b47a93 100644 --- a/commands/worldstone/worldstone.1 +++ b/commands/worldstone/worldstone.1 @@ -6,6 +6,7 @@ .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 @@ -44,6 +45,11 @@ branch in /usr/src. 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. diff --git a/commands/worldstone/worldstone.sh b/commands/worldstone/worldstone.sh index 54dfafc40..0868219fe 100644 --- a/commands/worldstone/worldstone.sh +++ b/commands/worldstone/worldstone.sh @@ -7,9 +7,10 @@ TAG=time.$(basename $(git --git-dir=/usr/src/.git describe --all --dirty)) 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" ;; @@ -43,12 +44,17 @@ echo "First run." 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."