1
1
mirror of https://github.com/mgree/ffs.git synced 2024-10-27 04:22:43 +03:00
ffs/run_bench.sh
Michael Greenberg 6ed74ee0c7
Timing support (#46)
Benchmarks, in two flavors: real-world benchmarks and synthetic microbenchmarks.

`--time` flag for benchmarking output on stderr.

Using R to generate pretty graphs. Some overhaul of build scripts and artifacts, with the hope of simplifying the release system.
2021-07-29 17:55:53 -07:00

48 lines
1002 B
Bash
Executable File

#!/bin/sh
set -e
TIMESTAMP=$(date +"%Y%m%d_%H:%M:%S")
usage() {
exec >&2
printf "Usage: %s [-n NUM_RUNS]\n\n" "$(basename $0)"
printf " -n NUM_RUNS the number of runs for each test case (defaults to $NUM_RUNS_DEFAULT)\n"
exit 2
}
ARGS=""
while getopts ":n:h" opt
do
case "$opt" in
(n) if [ $((OPTARG)) -le 0 ]
then
printf "NUM_RUNS must be a positive number; got '%s'\n\n" "$OPTARG"
usage
fi
ARGS="$ARGS -n $OPTARG"
;;
(h) usage
;;
(*) printf "Unrecognized argument '%s'\n\n" "$OPTARG"
usage
;;
esac
done
shift $((OPTIND - 1))
[ $# -eq 0 ] || usage
cd bench
BENCH="../${TIMESTAMP}_bench.log"
./bench.sh $ARGS >"$BENCH"
./mk_micro.sh
MICRO_RAW=$(mktemp)
./bench.sh -d micro $ARGS >"$MICRO_RAW"
MICRO="../${TIMESTAMP}_micro.log"
./fixup_micro.sh "$MICRO_RAW" >"$MICRO"
rm "$MICRO_RAW"
./generate_charts.R "$BENCH" "$MICRO"