-
Notifications
You must be signed in to change notification settings - Fork 0
/
peak-memory.sh
executable file
·30 lines (24 loc) · 946 Bytes
/
peak-memory.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
#!/usr/bin/env bash
# taken from:
# https://gitlab.com/FinnBender/haskell-parsing-benchmarks
# This is needed for Gitlab CI, so I don't need cabal in the bench-stage
if [ -z "$1" ]; then
cabal build bench:pcap-replicator || exit 1
benchmark_exe="$(cabal list-bin bench:pcap-replicator)"
else
benchmark_exe="./$1"
fi
for group in FileParse StreamParse; do
# Get a list of all benchmarks
readarray -t benchmarks < <("${benchmark_exe}" -l -p '$2 == "'$group'"')
echo "$group:"
for benchmark in "${benchmarks[@]}"; do
# Escape '/' in benchmark names
benchmark_pattern=${benchmark//\//\\\/}
# Only show relevant lines and remove execution time, since it is
# not going to be accurate.
"${benchmark_exe}" --stdev Infinity --pattern "/$benchmark_pattern/" +RTS -T \
| grep "OK\\|peak memory" \
| sed -e 's/[0-9][0-9. ]\+\(ms\|s\),[ ]\+/\t/'
done
done