home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- #################### set your default list of tests here ##############
-
- FULL_SUITE="dhry2 dhry2reg arithoh register short int long float double syscall pipe context1 spawn execl fstime shell dc hanoi"
-
- ###############################################################################
- # The BYTE UNIX Benchmarks - Release 2
- # Module: Run SID: 2.6 4/17/90 16:45:27
- #
- ###############################################################################
- # Bug reports, patches, comments, suggestions should be sent to:
- #
- # Ben Smith, Rick Grehan, or Tom Yager at BYTE Magazine
- # ben@bytepb.UUCP rick_g@bytepb.UUCP tyager@bytepb.UUCP
- # BIX: bensmith rick_g tyager
- #
- ###############################################################################
- # Modification Log:
- # $Header: run,v 5.2 88/01/12 06:23:43 kenj Exp $
- # Ken McDonell, Computer Science, Monash University
- # August 1, 1983
- # 3/89 - Ben Smith - BYTE: globalized many variables, modernized syntax
- # 5/89 - commented and modernized. Removed workload items till they
- # have been modernized. Added database server test.
- # 11/14/89 - Made modifications to reflect new version of fstime
- # and elimination of mem tests.
- #
- ###############################################################################
- ID="@(#)Run:2.6 -- 4/17/90 16:45:27";
- version="2.6"
- #######################################################################
- # General Purpose Benchmark
- # based on the work by Ken McDonell, Computer Science, Monash University
- #
- # You will need ...
- # awk cat cc chmod comm cp date dc df echo ed expr
- # kill ls make mkdir rm sed test time touch tty umask who
- #
- # The following variables may be assigned external values to overide defaults
- #
- # Test Variable Default Use
- # all iterations 6 repeat count for timing
- # dhry dhryloops 10000 no. of loops to test
- # arithmetic arithloop 10000 no. of summations
- # hanoi ndisk 17 list of nos. of disks
- # syscall ncall 4000 no. iterations, each of
- # 5 system calls
- # context1 switch1 500 no. of switches
- # pipe io 2048 no. 512 byte blocks to read
- # and write
- # spawn children 100 no. of child processes
- # execl nexecs 100 no. of execs
- # fstime seconds 1 10 20 seconds
- #
- umask 022 # at least mortals can read root's files this way
- # establish full paths to directories
- PWD=`pwd`
- HOMEDIR=${HOMEDIR-.}
- cd $HOMEDIR
- HOMEDIR=`pwd`
- cd $PWD
-
- BINDIR=${BINDIR-${HOMEDIR}/pgms}
- cd $BINDIR
- BINDIR=`pwd`
- cd $PWD
- # let's extend the path to this directory
- PATH="${PATH}:${BINDIR}"
-
- SCRPDIR=${SCRPDIR-${HOMEDIR}/pgms}
- cd $SCRPDIR
- SCRPDIR=`pwd`
- cd $PWD
-
- TMPDIR=${HOMEDIR}/tmp
- cd $TMPDIR
- TMPDIR=`pwd`
- cd $PWD
-
- RESULTDIR=${RESULTDIR-${HOMEDIR}/results}
- cd $RESULTDIR
- RESULTDIR=`pwd`
- cd $PWD
-
- TIMEACCUM=${TIMEACCUM-${RESULTDIR}/times}
-
- TESTDIR=${TESTDIR-${HOMEDIR}/testdir}
- cd $TESTDIR
- TESTDIR=`pwd`
- cd $PWD
-
- export BINDIR TMPDIR RESULTDIR PATH TESTDIR TIMEACCUM
- #
- bell=""
- break1="============================================================================="
- break2="-----------------------------------------------------------------------------"
- #
- cat ${BINDIR}/byte.logo # display banner
- rm -f ${TIMEACCUM} # clean out old time accumulation file
- echo "kill -9 $$" > ${TMPDIR}/kill_run ; chmod u+x ${TMPDIR}/kill_run
- #
- arithmetic="arithoh register short int long float double"
- system="syscall pipe context1 spawn execl"
- misc="C dc hanoi"
- dhry="dhry2 dhry2reg" # dhrystone loops
- load="shell" # cummulative load tests
- db="dbmscli" # add to as new database engines are developed
- #
- args="" # the accumulator for the bench units to be run
- runoption="N"
- # generate list of bench programs
- for word
- do # do level 1
- case $word
- in
- all)
- ;;
- arithmetic)
- args="$args $arithmetic"
- ;;
- db)
- args="$args $db"
- ;;
- dhry)
- args="$args $dhry"
- ;;
- load)
- args="$args $load"
- ;;
- misc)
- args="$args $misc"
- ;;
- speed)
- args="$args $arithmetic $system"
- ;;
- system)
- args="$args $system"
- ;;
- -q|-Q)
- runoption="Q" #quiet
- ;;
- -v|-V)
- runoption="V" #verbose
- ;;
- -d|-D)
- runoption="D" #debug
- ;;
- *)
- args="$args $word"
- ;;
- esac
-
- done # end do level 1
- #if no benchmark units have be specified, do them all
- # the - option of set implies no options; any list following
- # becomes the line arguments (replacing any that may exist)
- set - $args
- if test $# -eq 0 #no arguments specified
- then
- set - $FULL_SUITE
- fi
-
- if test "$runoption" = 'D'
- then
- set -x
- set -v
- fi
-
- date=`date`
- tmp=${TMPDIR}/$$.tmp
- timeaccum=${TMPDIR}/time.accum
- LOGFILE=${RESULTDIR}/log
- #add old log to accumulated log or move it
- if test -w ${RESULTDIR}/log
- then
- if test -w ${RESULTDIR}/log.accum
- then
- cat ${RESULTDIR}/log >> ${RESULTDIR}/log.accum
- rm ${RESULTDIR}/log
- else
- mv ${RESULTDIR}/log ${RESULTDIR}/log.accum
- fi
- fi
- echo "Start Benchmark Run (BYTE Version $version)" >>$LOGFILE
- echo " $date " >>$LOGFILE
- echo " " `who | wc -l` "interactive users." >>$LOGFILE
- #if SysV use 'uname -a' -- if BSD use 'hostname'
- uname -a >>$LOGFILE
- # hostname >>$LOGFILE
- #
- #if not specified, do each bench 6 iterations
- iter=${iterations-6}
- if test $iter -eq 6
- then
- longloop="1 2 3 4 5 6"
- shortloop="1 2 3"
- else # generate list of loop numbers
- short=`expr \( $iter + 1 \) / 2`
- longloop=""
- shortloop=""
- while test $iter -gt 0
- do # do level 1
- longloop="$iter $longloop"
- if test $iter -le $short
- then
- shortloop="$iter $shortloop"
- fi
- iter=`expr $iter - 1`
- done # end do level 1
- fi #loop list genration
- ####################################################################
- ############## the major control loop ##############################
- ####################################################################
- for bench # line argument processing
- do # do level 1
- # set some default values
- prog=${BINDIR}/$bench # the bench name is default program
- need=$prog # we need the at least the program
- paramlist="#" # a dummy parameter to make anything run
- testdir="${TESTDIR}" # the directory in which to run the test
- prepcmd="" # preparation command or script
- parammsg=""
- repeat="$longloop"
- stdout="$LOGFILE"
- stdin=""
- cleanopt="-t $tmp"
- bgnumber=""
- trap "${SCRPDIR}/cleanup -l $LOGFILE -a; exit" 1 2 3 15
- if [ $runoption != 'Q' ]
- then
- echo "$bench: \c"
- fi
- echo "" >>$LOGFILE
- ###################### select the bench specific values ##########
- case $bench
- in
- dhry2)
- options=${dhryloops-10000}
- logmsg="Dhrystone 2 without register variables"
- cleanopt="-d $tmp"
- ;;
-
- dhry2reg)
- options=${dhryloops-10000}
- logmsg="Dhrystone 2 using register variables"
- cleanopt="-d $tmp"
- ;;
-
- arithoh|register|short|int|long)
- options=${arithloop-10000}
- logmsg="Arithmetic Test (type = $bench): $options Iterations"
- ;;
-
- float|double)
- options=${arithloop-10000}
- logmsg="Arithmetic Test (type = $bench): $options Iterations"
- ;;
-
- dc) need=dc.dat
- prog=dc
- options=""
- stdin=dc.dat
- stdout=/dev/null
- logmsg="Arithmetic Test (sqrt(2) with dc to 99 decimal places)"
- ;;
-
- hanoi) options='$param'
- stdout=/dev/null
- logmsg="Recursion Test: Tower of Hanoi Problem"
- paramlist="${ndisk-17}"
- parammsg='$param Disk Problem:'
- ;;
-
- syscall)
- options=${ncall-4000}
- logmsg="System Call Overhead Test: 5 x $options Calls"
- ;;
-
- context1)
- options=${switch1-500}
- logmsg="Pipe-based Context Switching Test: 2 x $options Switches"
- ;;
-
- pipe) options=${io-2048}
- logmsg="Pipe Throughput Test: read & write $options x 512 byte blocks"
- ;;
-
- spawn) options=${children-100}
- logmsg="Process Creation Test: $options forks"
- ;;
-
- execl) options=${nexecs-100}
- logmsg="Execl Throughput Test: $options execs"
- ;;
-
- fstime)
- where=${where-${TMPDIR}}
- options='$param '"$where"
- logmsg="Filesystem Throughput Test:"
- paramlist=${seconds-"1 10 20"}
- parammsg='Test Time: $param secs'
- cleanopt="-f $tmp"
- ;;
-
- C) need=cctest.c
- prog=cc
- options='$param'
- stdout=/dev/null
- repeat="$shortloop"
- logmsg="C Compiler Test:"
- paramlist="cctest.c"
- parammsg='cc $param'
- rm -f a.out
- ;;
- dbmscli)
- repeat="$shortloop"
- need="db.dat"
- # records queuespace
- prepcmd='${BINDIR}/dbprep ${testdir}/db.dat 1000 1024'
- paramlist=${clients-"1 2 4 8"}
- parammsg='$param client processes.'
- logmsg="Client/Server Database Engine:"
- options='${testdir}/db.dat $param 0 1000' # $param clients;
- # 0 sleep; 1000 iterations
- ;;
- shell)
- prog="multi.sh"
- repeat="$shortloop"
- logmsg="Bourne shell script and Unix utilities"
- paramlist=${background-"1 2 4 8 "}
- parammsg='$param concurrent background processes'
- bgnumber='$param'
- ;;
- *) ${BINDIR}/cleanup -l $LOGFILE -r "run: unknown benchmark \"$bench\"" -a
- exit 1
- ;;
- esac
- ################################################################
- ###################### the main task ###########################
- ###################### run the bench ###########################
- ################################################################
- # each of those variables are now used in a general way
- #
- echo "$break1" >>$LOGFILE # break between bench pgms
- echo "$logmsg" >>$LOGFILE # benchmark name
- for param in $paramlist
- do # level 2
- param=`echo $param | sed 's/_/ /g'` # be sure that spaces are used
- # underscore can couple params
- if [ "$runoption" != "Q" ]
- then
- echo "\n [$param] -\c" # generate message to user
- fi
- eval msg='"'$parammsg'"' # the eval is used to
- echo "$break2" >>$LOGFILE # break between bench pgms
- if test "$msg" # evaluate any embedded
- then # variables in the parammsg
- echo "$msg" >>$LOGFILE
- fi
-
- eval opt='"'$options'"' # evaluate any vars in options
- eval prep='"'$prepcmd'"' # evaluate any prep command
- eval bg='"'$bgnumber'"' # evaluate bgnumber string
- rm -f $tmp # remove any tmp files
-
- # if the test requires mulitple concurrent processes,
- # prepare the background process string (bgstr)
- # this is just a string of "+"s that will provides a
- # parameter count for a "for" loop
- bgstr=""
- if test "$bg" != ""
- then
- count=`expr "$bg"`
- while test $count -gt 0
- do
- bgstr="+ $bgstr"
- count=`expr $count - 1`
- done
- fi
- #
- for i in $repeat # loop for the specified number
- do # do depth 3
- if [ "$runoption" != 'D' ] # level 1
- then
- # regular Run - set logfile to go on signal
- trap "${BINDIR}/cleanup -l $LOGFILE -i $i $cleanopt -a; exit" 1 2 3 15
- else
- trap "exit" 1 2 3 15
- fi #end level 1
- if [ "$runoption" != 'Q' ]
- then
- echo " $i\c" # display repeat number
- fi
- pwd=`pwd` # remember where we are
- cd $testdir # move to the test directory
- if [ "$runoption" = "V" ]
- then
- echo
- echo "BENCH COMMAND TO BE EXECUTED:"
- echo "$prog $opt"
- fi
-
- # execute any prepratory command string
- if [ -n "$prep" ]
- then
- $prep 2>&1 >>$stdout
- fi
- ############ THE BENCH IS TIMED ##############
- if test "$stdin" = ""
- then # without redirected stdin
- time $prog $opt $bgstr 2>>$tmp >>$stdout
- else # with redirected stdin
- time $prog $opt $bgstr <$stdin 2>>$tmp >>$stdout
- fi
- time $benchcmd
- ###############################################
- cd $pwd # move back home
- status=$? # save the result code
- if test $status != 0 # must have been an error
- then
- if test -f $tmp # is there an error file ?
- then
- cp $tmp ${TMPDIR}/save.$bench.$param
- ${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -r \
- "run: bench=$bench param=$param fatalstatus=$status" -a
- else
- ${SCRPDIR}/cleanup -l $LOGFILE -r \
- "run: bench=$bench param=$param fatalstatus=$status" -a
- fi
- exit # leave the script if there are errors
- fi # end level 1
- done # end do depth 3 - repeat of bench
- if [ "$runoption" != 'D' ]
- then
- ${SCRPDIR}/cleanup -l $LOGFILE $cleanopt # finalize this bench
- # with these options
- # & calculate results
- fi
- done # end do depth 2 - end of all options for this bench
-
- ########### some specific cleanup routines ##############
- case $bench
- in
- C)
- rm -f cctest.o a.out
- ;;
-
- fstime)
- sync; sleep 20
- ;;
- esac
- if [ "$runoption" != 'Q' ]
- then
- echo ""
- fi
- done # end do level 1 - all benchmarks requested
- ########## a few last items for the end ##############
- echo "" >>$LOGFILE
- echo " " `who | wc -l` "interactive users." >>$LOGFILE
- echo "End Benchmark Run ($date) ...." >>$LOGFILE
- if [ "$runoption" != 'Q' ]
- then
- pg $LOGFILE
- fi
- exit
- ########################### Amen ######################
-