@@ -3,8 +3,9 @@
33SERIAL_O_1="linear base"
44SERIAL_O_n="serial-o-n-heap serial-o-n-stack serial-o-n-space \
55 base-o-n-heap base-o-n-stack base-o-n-space"
6+FOLD_BENCHMARKS="fold-o-1-space fold-o-n-heap"
67
7−SERIAL_BENCHMARKS="$SERIAL_O_1 $SERIAL_O_n"
8+SERIAL_BENCHMARKS="$SERIAL_O_1 $SERIAL_O_n $FOLD_BENCHMARKS"
89# parallel benchmark-suite is separated because we run it with a higher
910# heap size limit.
1011CONCURRENT_BENCHMARKS="linear-async linear-rate nested-concurrent parallel concurrent adaptive"
@@ -21,6 +22,33 @@ VIRTUAL_BENCHMARKS="array-cmp"
2122
2223ALL_BENCHMARKS="$SERIAL_BENCHMARKS $CONCURRENT_BENCHMARKS $ARRAY_BENCHMARKS $VIRTUAL_BENCHMARKS"
2324
25+# RTS options that go inside +RTS and -RTS while running the benchmark.
26+bench_rts_opts () {
27+ case "$1" in
28+ "fold-o-1-space") echo -n "-T -K36K -M16M" ;;
29+ "fold-o-n-heap") echo -n "-T -K36K -M128M" ;;
30+ *) echo -n "" ;;
31+ esac
32+}
33+
34+# The correct executable for the given benchmark name.
35+bench_exec () {
36+ case "$1" in
37+ "fold-o-1-space") echo -n "fold" ;;
38+ "fold-o-n-heap") echo -n "fold" ;;
39+ *) echo -n "$1" ;;
40+ esac
41+}
42+
43+# Specific gauge options for the given benchmark.
44+bench_gauge_opts () {
45+ case "$1" in
46+ "fold-o-1-space") echo -n "-m prefix o-1-space" ;;
47+ "fold-o-n-heap") echo -n "-m prefix o-n-heap" ;;
48+ *) echo -n "" ;;
49+ esac
50+}
51+
2452list_benches () {
2553 for i in $ALL_BENCHMARKS
2654 do
@@ -177,10 +205,11 @@ bench_output_file() {
177205
178206run_bench () {
179207 local bench_name=$1
208+ local bench_exe=$(bench_exec $bench_name)
180209 local output_file=$(bench_output_file $bench_name)
181210 local bench_prog
182211 local quick_bench=0
183− bench_prog=$($GET_BENCH_PROG $bench_name) || \
212+ bench_prog=$($GET_BENCH_PROG $bench_exe) || \
184213 die "Cannot find benchmark executable for benchmark $bench_name"
185214
186215 mkdir -p `dirname $output_file`
@@ -217,9 +246,11 @@ run_bench () {
217246 fi
218247
219248 $bench_prog $SPEED_OPTIONS \
249+ +RTS $(bench_rts_opts $bench_name) -RTS \
220250 --csvraw=$output_file \
221251 -v 2 \
222− --measure-with $bench_prog $GAUGE_ARGS || die "Benchmarking failed"
252+ --measure-with $bench_prog $GAUGE_ARGS \
253+ $(bench_gauge_opts $bench_name) || die "Benchmarking failed"
223254}
224255
225256run_benches() {
@@ -382,8 +413,17 @@ only_real_benchmarks () {
382413 done
383414}
384415
416+proper_executables () {
417+ for i in $BENCHMARKS
418+ do
419+ echo -n "$(bench_exec $i) "
420+ done
421+}
422+
423+
385424BENCHMARKS_ORIG=$BENCHMARKS
386425BENCHMARKS=$(only_real_benchmarks)
426+EXECUTABLES=$(proper_executables)
387427echo "Using benchmark suites [$BENCHMARKS]"
388428
389429has_benchmark () {
@@ -431,7 +471,7 @@ then
431471 then
432472 $BUILD_BENCH || die "build failed"
433473 else
434− $BUILD_BENCH $BENCHMARKS || die "build failed"
474+ $BUILD_BENCH $EXECUTABLES || die "build failed"
435475 fi
436476 run_measurements "$BENCHMARKS"
437477fi