-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks-record.sh
executable file
·68 lines (48 loc) · 1.35 KB
/
benchmarks-record.sh
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
#!/usr/bin/env bash
BENCH_DIR=./benchmarks-out
BENCH_F_PREFIX=alloc-report-
die() {
echo "Error: $@" >&2
exit 1
}
check() {
if [[ "$?" != "0" ]]; then
die "$@"
fi
}
while getopts "h" opt; do
case "$opt" in
h)
cat <<EOF
benchmarks-record.sh - Run benchmarks to record relevant segments of data
USAGE
benchmarks-record.sh [-h]
OPTIONS
-h Prints help text.
BEHAVIOR
Runs benchmarks on all size classes. Saves reports to "$BENCH_DIR/${BENCH_F_PREFIX}-<size class>-<segments>.csv".
EOF
exit 0
;;
'?') die "Unknown option" ;;
esac
done
mkdir -p "$BENCH_DIR"
check "Failed to create benchmark directory"
make bench-build-host BENCH=alloc-report CARGO_BARGS=--features=metrics
check "Failed to build alloc-report benchmark program"
BENCH_PROG=./target/i686-unknown-linux-gnu/debug/bench-alloc-report
size_class=0
while (($size_class <= 11)); do
out_f="${BENCH_DIR}/${BENCH_F_PREFIX}${size_class}.csv"
$BENCH_PROG --csv-header > "$out_f"
check "Failed to write alloc-report CSV header to \"$out_f\""
i=1
while (($i < 10)); do
$BENCH_PROG "$size_class" "$i" >> "$out_f"
check "Failed to run alloc-report for size_class=$size_class i=$i to \"$out_f\""
i=$((i + 1))
done
echo "Finished size class $size_class benchmarks"
size_class=$(($size_class + 1))
done