1*433d6423SLionel Sambuc.Dd $Mdocdate: September 22 2011 $ 2*433d6423SLionel Sambuc.Dt WORLDSTONE 1 3*433d6423SLionel Sambuc.Os 4*433d6423SLionel Sambuc.Sh NAME 5*433d6423SLionel Sambuc.Nm worldstone 6*433d6423SLionel Sambuc.Nd shell script to consistently execute benchmarks 7*433d6423SLionel Sambuc.Sh SYNOPSIS 8*433d6423SLionel Sambuc.Nm worldstone 9*433d6423SLionel Sambuc.Op Fl s 10*433d6423SLionel Sambuc.Op Fl n Ar iterations 11*433d6423SLionel Sambuc.Op Fl c Ar command 12*433d6423SLionel Sambuc.Op Fl p Ar command 13*433d6423SLionel Sambuc.Op Fl t Ar tag 14*433d6423SLionel Sambuc.Sh DESCRIPTION 15*433d6423SLionel SambucThe 16*433d6423SLionel Sambuc.Nm 17*433d6423SLionel Sambucutility is a shell script and takes care of some of the 18*433d6423SLionel Sambucgrunt work around benchmarking, in order to make it easier 19*433d6423SLionel Sambucto get consistent and comparable benchmark results. Its basic 20*433d6423SLionel Sambucoperation is: execute the precommand, then execute and time 21*433d6423SLionel Sambucthe command, and do this a set number of iterations, and record 22*433d6423SLionel Sambucthe times in a logfile. 23*433d6423SLionel Sambuc 24*433d6423SLionel SambucIts features are: 25*433d6423SLionel Sambuc.Bl -tag -width Ds 26*433d6423SLionel Sambuc.It - 27*433d6423SLionel SambucIt executes the precommand and command once without timing it 28*433d6423SLionel Sambucin order to mitigate cold cache effects. 29*433d6423SLionel Sambuc.It - 30*433d6423SLionel SambucIt allows a precommand to run before the command, so that the initial 31*433d6423SLionel Sambucstate can be set up by the precommand without it being part of the timing 32*433d6423SLionel Sambuc(e.g. make clean). 33*433d6423SLionel Sambuc.It - 34*433d6423SLionel SambucIt redirects the stdout and stderr to /dev/null so that lots of output 35*433d6423SLionel Sambucgoing over a network connection doesn't influence timing. 36*433d6423SLionel Sambuc.It - 37*433d6423SLionel SambucIt does a sync before running the timed command, and makes sure a final 38*433d6423SLionel Sambucsync is part of the timed command, to make the i/o more consistent. 39*433d6423SLionel Sambuc.It - 40*433d6423SLionel SambucIt logs the times of each iteration in an easy-to-parse logfile. 41*433d6423SLionel Sambuc.It - 42*433d6423SLionel SambucIt tries to guess a sensible log file name based on the current git 43*433d6423SLionel Sambucbranch in /usr/src. 44*433d6423SLionel Sambuc.El 45*433d6423SLionel Sambuc 46*433d6423SLionel SambucThe options are as follows: 47*433d6423SLionel Sambuc.Bl -tag -width Ds 48*433d6423SLionel Sambuc.It Fl s 49*433d6423SLionel SambucIf set, perform statistical profiling by invoking 50*433d6423SLionel Sambuc.Xr profile 1 51*433d6423SLionel Sambucand executing sprofalyze, suitable for feeding to sprofdiff. This 52*433d6423SLionel Sambucrequires building world with SPROFILE. 53*433d6423SLionel Sambuc.It Fl n Ar iterations 54*433d6423SLionel SambucSet the number of iterations to perform, after the initial run. 55*433d6423SLionel SambucThe default is 5. 56*433d6423SLionel Sambuc.It Fl c Ar command 57*433d6423SLionel SambucSet the command to run to be timed. This is passed to sh -c, so shell constructs 58*433d6423SLionel Sambuclike loops etc. are okay to do. Default: make all. 59*433d6423SLionel Sambuc.It Fl p Ar command 60*433d6423SLionel SambucSet the pre-command to run. This command gets run before the timed command in order 61*433d6423SLionel Sambucto make the timed command get a consistent state before it starts. 62*433d6423SLionel SambucDefault: make clean. 63*433d6423SLionel Sambuc.It Fl t Ar tag 64*433d6423SLionel SambucUse the given tag name to modify the logfile that the utility uses 65*433d6423SLionel Sambucto write its results in. The default is just 'time' plus the git branch you 66*433d6423SLionel Sambucare currently on in /usr/src. In order for this to be useful you have to make sure the 67*433d6423SLionel Sambucgit branch you are on reflects the system you wish to benchmark of course. 68*433d6423SLionel SambucThe script checks /usr/src/.git even if you are outside the /usr/src hierarchy 69*433d6423SLionel Sambuc(such as in pkgsrc). 70*433d6423SLionel Sambuc.El 71*433d6423SLionel Sambuc 72*433d6423SLionel SambucThe script executes the commands the set number of iterations, redirecting stdout 73*433d6423SLionel Sambucand stderr to /dev/null, and records the timed results in the logfile tagged with 74*433d6423SLionel Sambucthe given tag. 75*433d6423SLionel Sambuc.Nm 76*433d6423SLionel Sambucexecutes 77*433d6423SLionel Sambuc.Xr time 1 78*433d6423SLionel Sambucwith the -C option, resulting in printing the 64-bit cpu cycle counter 79*433d6423SLionel Sambucfor both HZ-independent high resolution and an easy way not to have to convert minutes 80*433d6423SLionel Sambucand seconds to seconds when parsing the results. 81*433d6423SLionel Sambuc.Pp 82*433d6423SLionel SambucYou can feed the two separate logfiles directly to 83*433d6423SLionel Sambuc.Xr ministat 1 84*433d6423SLionel Sambucto have it tell you the statistical properties of the two datasets, and judge whether 85*433d6423SLionel Sambucthere is a statistically significant difference. 86*433d6423SLionel Sambuc.Sh ENVIRONMENT 87*433d6423SLionel SambucThe default commands, i.e. make all and make clean, can be modified by supplying a MAKE 88*433d6423SLionel Sambucenvironment variable, so e.g. MAKE=bmake worldstone still does something sensible 89*433d6423SLionel Sambucby default in /usr/pkgsrc directories. 90*433d6423SLionel Sambuc.Sh SEE ALSO 91*433d6423SLionel Sambuc.Xr ministat 1 92