1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 10:50:37 +02:00

m1/perf/: scripts for bulk test runs and tabulating the results

This commit is contained in:
Werner Almesberger 2011-09-18 11:06:35 -03:00
parent c02c02903d
commit 3727324a2c
3 changed files with 150 additions and 0 deletions

26
m1/perf/all-runs Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh -ex
rm -rf data
mkdir data
for n in ref new opt; do
case $n in
ref) flags=;;
new) flags=-n;;
opt) flags="-n -o";;
esac
mkdir data/$n
for m in out expr prof; do
case $m in
out) more=-s;;
expr) more=-e;;
prof) more=-p;;
esac
mkdir data/$n/$m
./runs $flags $more data/$n/$m || exit
done
done

64
m1/perf/runs Executable file
View File

@ -0,0 +1,64 @@
#!/bin/sh -x
sanitize()
{
basename "$1" .fnp | tr ' ' _ | tr -cd 'A-Za-z0-9_-' | tr -s _ _
}
usage()
{
cat <<EOF 1>&2
usage: $0 [-e|-p] [-n [-o] [-s]] dir
-e generate the calculated expression (default: just dump debug output)
-p profile 10000 runs (default: just dump debug output)
-n use "new" scheduler
-o enable LCPF optimizer
-s enable register pressure statistics
EOF
}
M1=`make path`
extra=
sched=
profile=false
evaluate=false
while [ "${1#-}" != "$1" ]; do
case "$1" in
-e) evaluate=true;;
-p) profile=true;;
-n) sched=SCHED=sched.o;;
-o) extra="$extra -DLCPF";;
-s) extra="$extra -DREG_STATS";;
*) usage;;
esac
shift
done
[ -z "$1" -o "$2" ] && usage
if [ ! -d "$1" ]; then
echo "$1: directory not found" 1>&2
exit 1
fi
$profile || extra="$extra -DCOMP_DEBUG"
make CFLAGS_EXTRA="$extra" $sched clean all
for n in $M1/flickernoise/patches/*/*.fnp; do
s=`sanitize "$n"`
if $profile; then
./main "$n" 10000 || exit
gprof main >"$1"/$s
elif $evaluate; then
./main "$n" | ./eval.pl >"$1"/$s || exit
else
./main "$n" >"$1"/$s || exit
fi
done

60
m1/perf/tabulate Executable file
View File

@ -0,0 +1,60 @@
#!/bin/sh -x
M1=`make path`
time()
{
sed '/^.*of \([0-9.]*\) seconds.*/s//\1/p;d' <data/$1/prof/$2
}
size()
{
sed '/^0*\([1-9][0-9]*\): VECTOUT.*/s//\1/p;d' <data/$1/out/$2 |
tail -n 1
}
eff()
{
sed '/^Efficiency: \([0-9.]*\)%/s//\1/p;d' <data/$1/out/$2 | tail -n 1
}
regs()
{
sed '/^regs: 0/s///p;d' <data/$1/out/$2 | tail -n 1
}
sum()
{
md5sum <data/$1/expr/$2 | sed 's/ .*//'
}
eq()
{
if [ "$1" = "$2" ]; then
echo Y
else
echo N
fi
}
echo "Original Unoptimized Optimized Equiv Name"
echo "Time Size Eff Time Size Eff Regs Time Size Eff Regs"
for n in `ls -1 data/ref/out`; do
ref=`sum ref $n`
new=`sum new $n`
opt=`sum opt $n`
printf "%5.1f %4d%3d%% %5.1f %4d%3d%% %4d %5.1f %4d%3d%% %4d %s " \
`time ref $n` `size ref $n` `eff ref $n` \
`time new $n` `size new $n` `eff new $n` `regs new $n` \
`time opt $n` `size opt $n` `eff opt $n` `regs opt $n` \
`eq $ref $new`/`eq $ref $opt`/`eq $new $opt`
echo $n
done