1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#!/bin/sh
#
# A program to test different versions of the compiler.
usage="Usage: speedtest [-c cmd] [-dns] batchname"
limit=4
cmd="mmc -C -O2 -I../compiler make_hlds.m"
debug=false
size=false
while test $# -gt 0
do
case $1 in
-c|--cmd)
cmd="$2" ; shift ;;
-c*)
cmd="` expr $1 : '-c\(.*\)' `" ;;
-d)
debug=true ;;
-n)
limit="$2" ; shift ;;
-n*)
limit="` expr $1 : '-n\(.*\)' `" ;;
-s)
size=true ;;
-*) echo "$0: unknown option \`$1'" 2>&1
echo $usage
exit 1 ;;
*) break ;;
esac
shift
done
if test $# != 1
then
echo $usage
exit 1
fi
batch=$1
root=`/bin/pwd`
files=`ls batch/$batch.mercury_compile.*`
trap 'gzip $root/batch/$batch.mercury_compile.*[0-9] > /dev/null 2>&1; exit 0' 0 1 2 3 15
if test -x /usr/ucb/echo
then
ECHO=/usr/ucb/echo
else
ECHO=echo
fi
for file in $files
do
case $file in
*.gz)
gunzip $file
file=batch/`basename $file .gz`
;;
esac
paramfile=`echo $file | sed 's/mercury_compile/params/'`
if test -r $paramfile
then
cat $paramfile
fi
if $size
then
size $file
fi
MERCURY_COMPILER=$root/$file
export MERCURY_COMPILER
cd trial
count=1
while test $count -le $limit
do
$ECHO -n "$file "
if $debug
then
echo "c" | $root/tools/dotime mdb $cmd
else
$root/tools/dotime $cmd
fi
count=`expr $count + 1`
done
cd $root
gzip $file
done
exit 0
|