DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T m

⟦5f0886b9b⟧ TextFile

    Length: 6854 (0x1ac6)
    Types: TextFile
    Names: »musbus.sh«

Derivation

└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21E/musbus/musbus.sh« 

TextFile

#! /bin/sh
#
# Script : musbus.sh
#
version="5.2"
res=musbus.res
log=musbus.log
logwork=musbus.work
syn=musbus.syn
TIME=../config/chrono
umask 022	# at least mortals can read root's files this way
bell="▶07◀"
workdir=${workdir-Workload} ; export workdir

system="syscall pipe disktime"
misc="randmem"
args=""

iter=${iterations-6}
date=`date`
tmp=Tmp/$$.tmp
echo "" >>$res
echo "Start Benchmark Run (MUSBUS Version $version)" >>$res
echo "  $date (3 iterations)" >>$res
echo " " `who | wc -l` "interactive users." >>$res
if test $iter -eq 6
then
	longloop="1 2 3 4 5 6"
	shortloop="1 2 3"
else
	short=`expr \( $iter + 1 \) / 2`
	longloop=""
	shortloop=""
	while test $iter -gt 0
	do
		longloop="$iter $longloop"
		if test $iter -le $short
		then
			shortloop="$iter $shortloop"
		fi
		iter=`expr $iter - 1`
	done
fi
if test ! -f iamalive
then
    make iamalive -f musbus.mk
fi
for test
do
    need=$test
    prog=./$test
    paramlist="#"
    parammsg=""
    repeat="$longloop"
    stdout="$res"
    stdin=""
    cleanopt="-t $tmp"
    trap "./cleanup -l $res -a; exit" 1 2 3 15
    echo $test:
    echo "" >>$res
    case $test
    in

	disktime) repeat="$shortloop"
		where=${where-Tmp}
		options='$param '"$where"
		logmsg="Filesystem Throughput Test :"
		paramlist=${blocks-"62 125 250 500 1000"}
		parammsg='File Size: $param blocks'
		cleanopt="-f $tmp"
		;;

	work|x)
		ttys=${ttys-`tty`}
		if test "$ttys" = "not a tty"
		then
		    ttys=/dev/tty
		fi
		tty=`echo $ttys | sed 's/ .*//'` ; export tty
		rate=${rate-2} ; export rate
		dirs=${dirs-Tmp}
		need="makework keyb"
		prog=./makework
		options='$param'
		stdin=Tmp/workload
		stdout=`echo $ttys | sed 's/ .*//'`
		repeat="$shortloop"
		logmsg="Simulated Multi-user Workload Test :"
		paramlist=${nusers-"1 4 8 16 24 32"}
		parammsg='$param Concurrent Users, each with Input Keyboard Rate of $rate chars/sec'
		cleanopt="-w -t $tmp"
		maxusers=`echo $paramlist | awk '{for (i=1;i<=NF;i++) if ($i > maxu) maxu=$i; print maxu}'`
		if test $test = work
		then
		    ./iamalive "Check job streams and workload description ..."
		    rm -f Tmp/script.1
		    if make scripts ttychk clock WORKDIR=$workdir -f musbus.mk 2>$tmp 1>&2
		    then
			:
		    else
			cat $tmp
			cat $tmp >>$res
			./cleanup -l $res -r "\"make script\" failed!" -a
			exit 1
		    fi
		    scripts=`echo Tmp/script.?`
		    cmdline=`sed 1q $workdir/script.master | sed 's/%W%[ 	]*//'`
		    rm -f Tmp/workload
		    touch Tmp/workload
		    ( echo $dirs; echo $scripts; echo $ttys ) \
		    | awk '
		    NR==1 { for (i=1;i<=NF;i++) dir[i]=$i;nd=NF }
		    NR==2 { for (i=1;i<=NF;i++) script[i]=$i;ns=NF }
		    NR==3 { for (i=1;i<=NF;i++) tty[i]=$i;nt=NF }
		    END   { for (i=0;i<'$maxusers';i++)
			     print dir[i%nd+1] "/user" i " '"$cmdline"' <" script[i%ns+1] " >" tty[i%nt+1] }' \
			>>Tmp/workload
		    echo "done."
		    ./iamalive "Check tty bandwidth ..."
		    inch=`cat Tmp/script.1 | wc -c`
		    outch=`cat Tmp/script.out | wc -c`
		    orate=`expr $rate \* $outch / $inch`
		    if ./ttychk $maxusers $orate $ttys 2>$tmp
		    then
		        echo "OK."
		    else
			echo "FAILED!"
			cat $tmp
			cat $tmp >>$res
			rm -f $tmp
			./cleanup -l $res -a
			exit 1
		    fi
		fi
		./iamalive "Set up work directories ..."
		cd $workdir 
	        if make context WORKDIR=$workdir 2>../$tmp 1>&2
		then
		    :
		else
		    cd ..
		    cat $tmp
		    cat $tmp >>$res
		    rm -f $tmp
		    ./cleanup -l $res -r "\"make context\" failed in $workdir" -a
		    exit 1
		fi
	        if make manifest WORKDIR=$workdir 2>../$tmp 1>&2
		then
		    cd ..
		    manifest=`cat $tmp`
		    cplist=`cat $tmp | sed -e 's,^,$workdir/,' -e 's, , $workdir/,g'`
		else
		    cd ..
		    cat $tmp
		    cat $tmp >>$res
		    rm -f $tmp
		    ./cleanup -l $res -r "\"make manifest\" failed in $workdir" -a
		    exit 1
		fi
		user=0
		for dir in `sed 's/ .*//' Tmp/workload`
		do
			./iamalive $user
			rm -rf $dir
			mkdir $dir
			eval cp $cplist $dir
			user=`expr $user + 1`
		done
		echo "done."
		echo "" >>$res
echo "Current directory : " `pwd` >>$res
echo "Output sent to ... $ttys" >>$res
echo "Directory for temporary files ... $dirs" >>$res
		echo "" >>$res
		df >>$res
		echo "" >>$res
		if test $test = work
		then
		    ./iamalive '60 second wallclock accuracy check ...'
		    echo "SIGALRM check: " `./clock` >>$res
		    echo "SIGALRM check: " `./clock` >>$syn
		    echo "done."
		fi
 		./signature >>$res
 		echo "${bell}${bell}This test generates lots of tty output"
		;;

	*)	./cleanup -l $res -r "run: unknown test \"$test\"" -a
		exit 1
		;;
    esac
    for file in $need
    do
	if make $file WORKDIR=$workdir -f musbus.mk 2>$tmp 1>&2
	then
	    :
	else
	    cat $tmp
	    cat $tmp >>$res
	    rm -f $tmp
	    ./cleanup -l $res -r "\"make $file\" failed!" -a
	    exit 1
	fi
    done
    echo "$logmsg" >>$res
    echo "$logmsg" >>$syn
    for param in $paramlist
    do
	param=`echo $param | sed 's/_/ /g'`
	./iamalive "   [$param] -"
	eval msg='"'$parammsg'"'
	eval opt='"'$options'"'
	if test "$msg" != ""
	then
	    echo "" >>$res
	    echo "$msg" >>$res
	    echo "$msg" >>$syn
	fi
	rm -f $tmp
	for i in $repeat
	do
	    trap "./cleanup -l $res -i $i $cleanopt -a; exit" 1 2 3 15
	    ./iamalive $i
	    if test "$stdin" = ""
	    then
		$TIME $prog $opt 2>>$tmp >>$stdout
		status=$?
		cat $tmp >>$log
	    else
		$TIME $prog $opt <$stdin 2>>$tmp >>$stdout
		status=$?
		cat $tmp >>$log
	    fi
	    if test $status != 0
	    then
		if test -f $tmp
		then
		    cp $tmp Tmp/save.$test.$param
		    ./cleanup -l $res -i $i $cleanopt -r "run: test=$test param=$param fatalstatus=$status" -a
		else
		    ./cleanup -l $res -r "run: test=$test param=$param fatalstatus=$status" -a
		fi
		exit
	    fi
	    test $prog = ./makework && ./cleanup -w
	done
	./cleanup -l $res $cleanopt
    done
    case $test
    in
	work|x)
	    echo "Check for corpses ... " >>$logwork
	    if test "`echo Tmp/*.tmp`" != 'Tmp/*.tmp'
	    then
		echo "Unclaimed temporary workfiles?" >>$logwork
		ls -l Tmp/*.tmp >>$logwork
	    fi
	    echo USER $manifest \
	    | sed 's/  */\
/g' \
	    | sort >/tmp/work$$
	    for dir in `sed 's/ .*//' Tmp/workload`
	    do
		( cd $dir ; ls ) >/tmp/user$$
		comm -23 /tmp/work$$ /tmp/user$$ >/tmp/x$$
		if test -s /tmp/x$$
		then
		    echo "" >>$logwork
		    echo "Files missing from $dir ..." >>$logwork
		    pr -t -l1 -w80 -5 /tmp/x$$ >>$logwork
		fi
		comm -13 /tmp/work$$ /tmp/user$$ >/tmp/x$$
		if test -s /tmp/x$$
		then
		    echo "" >>$logwork
		    echo "Extra files in $dir ..." >>$logwork
		    pr -t -l1 -w80 -5 /tmp/x$$ >>$logwork
		fi
		rm -rf $dir
	    done
	    rm -f /tmp/*$$
	    ;;
    esac
    echo ""
done
echo "" >>$res
echo " " `who | wc -l` "interactive users." >>$res
echo "End Benchmark Run `date` ...." >>$res
echo "End Benchmark Run `date` ...."
exit