home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # Incomplete.
- # $Header: mkprofile,v 1.2 87/06/23 17:07:28 kjmcdonell Beta $
- profilework)
- echo ""
- echo "Profile Work Load Test:" >>$LOG
- rate=${rate-2}
- echo "" >>$LOG
- echo "Control parameters: rate=$rate script=script.1" >>$LOG
- echo "" >>$LOG
- if test ! -f makework
- then
- make makework
- fi
- if test ! -f keyb
- then
- make keyb
- fi
- tty=${tty-`tty`}
- if test "$tty" = "not a tty"
- then
- tty=/dev/tty
- fi
- chmod +w script.1
- ed - script.1 <<EOF
- g/^R=/s/=.*/=$rate/
- g/^C=/s,=.*,=$tty,
- g/^H=/s,=.*,=.,
- g/PATH=/s,=[^:]*:,=`pwd`:,
- w
- q
- EOF
- chmod -w script.1
- log=`pwd`/log.profile
- ( echo "export log;log=$log" ; sed \
- -e 's/^export/##&/' \
- -e 's/^cd/##&/' \
- -e 's,^\([^:][a-zA-Z0-9./]*\)[ ].*,time sh -cx '"'&'"' 2>>$log,' \
- -e "s/\('[^$][^$][^']*\)"'\$\$'"/\1'"'$$'"'/g" \
- -e "s/\('[^$][^$][^']*\)"'\$\$'"/\1'"'$$'"'/g" \
- -e "s/\('[^$][^$][^']*\)"'\$\$'"/\1'"'$$'"'/g" \
- -e "s/''//g" \
- -e 's/^##//' \
- -e 's/^\([a-zA-Z][a-zA-Z0-9]*\)=/export \1;&/' script.1 ) >script.1.time
- s=`cat script.1 | wc -c`
- ts=`cat script.1.time | wc -c`
- rate=`echo "scale=2;$rate*$ts/$s" | bc`
- ed - script.1.time << End-of-File
- g/R=/s/=.*/=$rate/
- w
- q
- End-of-File
- echo "Profile run starts ..."
- echo '/bin/sh -ie <script.1.time' >./Workload/workload.time
- trap "./cleanup -w -i $i -t $tmp -a; exit" 1 2 3 4 5 6 7 8 9 10 12 13 14 15
- time ./makework -rc $rate $tty 1 <./Workload/workload.time >$tty 2>>$tmp
- if test $? != 0
- then
- # makework was aborted
- cp $tmp Tmp/save.$n.abort
- ./cleanup -w -i $i -t $tmp -a
- exit
- fi
- ./cleanup -w -t $tmp
- echo "" >>$LOG
- echo "Profile run finished, collect and summarize results ..."
- sed \
- -e 's/[ ]*\([0-9][0-9]*\.[0-9]*\) *real/real \1\
- /' \
- -e 's/[ ]*\([0-9][0-9]*\.[0-9]*\) *user/user \1\
- /' \
- -e 's/[ ]*\([0-9][0-9]*\.[0-9]*\) *sys/sys \1\
- /' \
- $log \
- | awk '
- BEGIN { printf "\t Real (percent)\t User (percent)\t Sys (percent)\n" }
- /^\+/ { if ($2 != "keyb") {
- c=$2
- cmd[c]=c
- }
- next
- }
- /^real/ { r[c]+=$2; totr+=$2; }
- /^user/ { u[c]+=$2; totu+=$2; }
- /^sys/ { s[c]+=$2; tots+=$2; }
- END { for (c in cmd) {
- printf cmd[c]
- printf "\t%6.1f (%5.2f%%)",r[c],100*r[c]/totr
- printf "\t%6.1f (%5.2f%%)",u[c],100*u[c]/totu
- printf "\t%6.1f (%5.2f%%)\n",s[c],100*s[c]/tots
- }
- printf "-------\n"
- printf "Totals:\t%6.1f\t\t%6.1f\t\t%6.1f\n",totr,totu,tots
- } ' >>$LOG
- ;;
-
-