2 umask 022 # at least mortals can read root's files this way
8 BINDIR=${BINDIR:-${HOMEDIR}/pgms}
12 PATH="${PATH}:${BINDIR}"
13 SCRPDIR=${SCRPDIR:-${HOMEDIR}/pgms}
21 RESULTDIR=${RESULTDIR:-${HOMEDIR}/results}
25 TESTDIR=${TESTDIR:-${HOMEDIR}/testdir}
29 export BINDIR TMPDIR RESULTDIR PATH
30 echo "kill -9 $$" > ${TMPDIR}/kill_run ; chmod u+x ${TMPDIR}/kill_run
31 arithmetic="arithoh register short int long float double dc"
32 system="syscall pipe context1 spawn execl fstime"
35 dhry="dhry2 dhry2reg" # dhrystone loops
36 db="dbmscli" # add to as new database engines are developed
37 load="shell" # cummulative load tests
38 args="" # the accumulator for the bench units to be run
47 args="$args $arithmetic"
65 args="$args $arithmetic $system"
74 runoption="V" #verbose
85 if test $# -eq 0 #no arguments specified
87 set - $dhry $arithmetic $system $misc # db and work not included
89 if test "$runoption" = 'D'
96 LOGFILE=${RESULTDIR}/log
97 if test -w ${RESULTDIR}/log
99 if test -w ${RESULTDIR}/log.accum
101 cat ${RESULTDIR}/log >> ${RESULTDIR}/log.accum
104 mv ${RESULTDIR}/log ${RESULTDIR}/log.accum
106 echo "Start Benchmark Run (BYTE Version $version)" >>$LOGFILE
107 echo " $date (long iterations $iter times)" >>$LOGFILE
108 echo " " `who | wc -l` "interactive users." >>$LOGFILE
113 longloop="1 2 3 4 5 6"
115 else # generate list of loop numbers
116 short=`expr \( $iter + 1 \) / 2`
119 while test $iter -gt 0
121 longloop="$iter $longloop"
122 if test $iter -le $short
124 shortloop="$iter $shortloop"
126 iter=`expr $iter - 1`
127 done # end do level 1
128 fi #loop list genration
129 for bench # line argument processing
131 # set some default values
132 prog=${BINDIR}/$bench # the bench name is default program
133 need=$prog # we need the at least the program
134 paramlist="#" # a dummy parameter to make anything run
135 testdir="${TESTDIR}" # the directory in which to run the test
136 prepcmd="" # preparation command or script
143 trap "${SCRPDIR}/cleanup -l $LOGFILE -a; exit" 1 2 3 15
144 if [ $runoption != 'Q' ]
149 ###################### select the bench specific values ##########
153 options=${dhryloops-10000}
154 logmsg="Dhrystone 2 without register variables"
158 options=${dhryloops-10000}
159 logmsg="Dhrystone 2 using register variables"
162 arithoh|register|short|int|long|float|double)
163 options=${arithloop-10000}
164 logmsg="Arithmetic Test (type = $bench): $options Iterations"
171 logmsg="Arithmetic Test (sqrt(2) with dc to 99 decimal places)"
173 hanoi) options='$param'
175 logmsg="Recursion Test: Tower of Hanoi Problem"
176 paramlist="${ndisk-17}"
177 parammsg='$param Disk Problem:'
180 options=${ncall-4000}
181 logmsg="System Call Overhead Test: 5 x $options Calls"
184 options=${switch1-500}
185 logmsg="Pipe-based Context Switching Test: 2 x $options Switches"
187 pipe) options=${io-2048}
188 logmsg="Pipe Throughput Test: read & write $options x 512 byte blocks"
190 spawn) options=${children-100}
191 logmsg="Process Creation Test: $options forks"
193 execl) options=${nexecs-100}
194 logmsg="Execl Throughput Test: $options execs"
197 if test $bench = seqmem
204 options='-s$param '"-n$poke"
205 logmsg="$type Memory Access Test: $poke Accesses"
206 paramlist=${arrays-"512 1024 2048 8192 16384"}
207 parammsg='Array Size: $param bytes'
210 fstime) repeat="$shortloop"
211 where=${where-${TMPDIR}}
212 options='$param '"$where"
213 logmsg="Filesystem Throughput Test:"
214 paramlist=${blocks-"512 1024 2048 8192"}
215 parammsg='File Size: $param blocks'
223 logmsg="C Compiler Test:"
231 prepcmd='${BINDIR}/dbprep ${testdir}/db.dat 10000'
232 paramlist=${clients-"1 2 4 8"}
233 parammsg='$param client processes. (filesize `cat ${testdir}/db.dat|wc -c` bytes)'
234 logmsg="Client/Server Database Engine:"
235 options='${testdir}/db.dat $param 0 1000' # $param clients;
236 # 0 sleep; 1000 iterations
241 logmsg="Bourne shell script and Unix utilities"
242 paramlist=${background-"1 2 4 8"}
243 parammsg='$param concurrent background processes'
247 *) ${BINDIR}/cleanup -l $LOGFILE -r "run: unknown benchmark \"$bench\"" -a
251 echo "$logmsg" >>$LOGFILE
252 for param in $paramlist
254 param=`echo $param | sed 's/_/ /g'` # be sure that spaces are used
255 # underscore can couple params
256 if [ "$runoption" != "Q" ]
258 echo "\n [$param] -\c" # generate message to user
260 eval msg='"'$parammsg'"' # the eval is used to
261 if test "$msg" # evaluate any embedded
262 then # variables in the parammsg
264 echo "$msg" >>$LOGFILE
266 eval opt='"'$options'"' # evaluate any vars in options
267 eval prep='"'$prepcmd'"' # evaluate any prep command
268 eval bg='"'$bgnumber'"' # evaluate bgnumber string
269 rm -f $tmp # remove any tmp files
270 # if the test requires mulitple concurrent processes,
271 # prepare the background process string (bgstr)
272 # this is just a string of "+"s that will provides a
273 # parameter count for a "for" loop
278 while test $count -gt 0
281 count=`expr $count - 1`
285 for i in $repeat # loop for the specified number
287 if [ "$runoption" != 'D' ] # level 1
289 # regular Run - set logfile to go on signal
290 trap "${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -a; exit" 1 2 3 15
294 if [ "$runoption" != 'Q' ]
296 echo " $i\c" # display repeat number
298 pwd=`pwd` # remember where we are
299 cd $testdir # move to the test directory
300 if [ "$runoption" = "V" ]
303 echo "BENCH COMMAND TO BE EXECUTED:"
306 # execute any prepratory command string
311 ############ THE BENCH IS TIMED ##############
312 if test "$stdin" = ""
313 then # without redirected stdin
314 time $prog $opt $bgstr 2>>$tmp >>$stdout
315 else # with redirected stdin
316 time $prog $opt $bgstr <$stdin 2>>$tmp >>$stdout
319 ###############################################
320 cd $pwd # move back home
321 status=$? # save the result code
322 if test $status != 0 # must have been an error
324 if test -f $tmp # is there an error file ?
326 cp $tmp ${TMPDIR}/save.$bench.$param
327 ${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -r \
328 "run: bench=$bench param=$param fatalstatus=$status" -a
330 ${SCRPDIR}/cleanup -l $LOGFILE -r \
331 "run: bench=$bench param=$param fatalstatus=$status" -a
333 exit # leave the script if there are errors
335 done # end do depth 3 - repeat of bench
336 if [ "$runoption" != 'D' ]
338 ${SCRPDIR}/cleanup -l $LOGFILE $cleanopt # finalize this bench
340 # & calculate results
342 done # end do depth 2 - end of all options for this bench
343 ########### some specific cleanup routines ##############
350 if [ "$runoption" != 'Q' ]
354 done # end do level 1 - all benchmarks requested
356 echo " " `who | wc -l` "interactive users." >>$LOGFILE
357 echo "End Benchmark Run ($date) ...." >>$LOGFILE
358 if [ "$runoption" != 'Q' ]