diff options
Diffstat (limited to 'tests/bench/bench.sh')
| -rw-r--r-- | tests/bench/bench.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/bench/bench.sh b/tests/bench/bench.sh index 4032aa0..68232c6 100644 --- a/tests/bench/bench.sh +++ b/tests/bench/bench.sh @@ -24,13 +24,14 @@ if command -v aarch64-linux-gnu-gcc >/dev/null && command -v qemu-aarch64 >/dev/ fi # seconds per run of kernel $2 on vm $1: the slope between $3 runs and 1 run, # best of three each, so starting up and compiling cancel out -# a nonzero zy exit (1 compile error, 2 trap) fails the whole bench, with the stderr tail +# a nonzero zy exit (1 compile error, 2 runtime trap) fails the whole bench, with the tail of +# stderr and stdout (zy reports a trap on stdout) t(){ local s e c err=$(mktemp); s=$(date +%s.%N) - (cat tests/programs/bench.zc; printf '`%s%s' $2 $3) | $1 >/dev/null 2>$err; c=$? + (cat tests/programs/bench.zc; printf '`%s%s' $2 $3) | $1 >$err.out 2>$err; c=$? e=$(date +%s.%N) - if [ $c != 0 ]; then echo "bench.sh: tests/programs/bench.zc kernel $2 ($3 reps) on $1: zy exited $c; stderr tail:" >&2; tail -n 8 $err >&2; rm -f $err; return 1; fi - rm -f $err; echo "$e - $s" | bc + if [ $c != 0 ]; then echo "bench.sh: tests/programs/bench.zc kernel $2 ($3 reps) on $1: zy exited $c ($([ $c = 2 ] && echo runtime trap || { [ $c = 1 ] && echo compile error || echo failed; })); stderr and stdout tail:" >&2; tail -n 8 $err $err.out >&2; rm -f $err $err.out; return 1; fi + rm -f $err $err.out; echo "$e - $s" | bc } best(){ local b=999 x i; for i in 1 2 3; do x=$(t "$1" $2 $3) || return 1; b=$(echo "if ($x < $b) $x else $b" | bc); done; echo $b; } # grows the run count until the difference is at least a second, so the noise |
