This PR adds a new [radar]-based [temci]-less bench suite that replaces the `stdlib` benchmarks from the old suite and also measures per-module instruction counts. All other benchmarks from the old suite are unaffected. The readme at `tests/bench-radar/README.md` explains in more detail how the bench suite is structured and how it works. The readmes in the benchmark subdirectories explain what each benchmark does and which metrics it collects. All metrics except `stdlib//max dynamic symbols` were ported to the new suite, though most have been renamed. [radar]: https://github.com/leanprover/radar [temci]: https://github.com/parttimenerd/temci
40 lines
1.3 KiB
Bash
Executable file
40 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
|
|
BENCH="tests/bench-radar"
|
|
STAGE2="build/release/stage2"
|
|
STAGE3="build/release/stage3"
|
|
|
|
# Build previous stages and warm up stage3
|
|
cmake --preset release
|
|
timeout -s KILL 1h time make -C build/release -j"$(nproc)" stage3
|
|
find "$STAGE3" -name "*.olean" -delete
|
|
|
|
# Use stage2 binaries from now on
|
|
#
|
|
# Otherwise, tools like lakeprof use the global lean installation,
|
|
# which may not exist or be the right version.
|
|
export PATH="$PWD/$STAGE2/bin:$PATH"
|
|
|
|
# Substitute our own wrapper script
|
|
mv "$STAGE2/bin/lean" "$STAGE2/bin/lean.wrapped"
|
|
cp "$BENCH/build/lean_wrapper.py" "$STAGE2/bin/lean"
|
|
|
|
# Build stage3
|
|
"$BENCH/measure.py" -t build \
|
|
-m instructions -m maxrss -m task-clock -m wall-clock -- \
|
|
lakeprof record -- \
|
|
make -C build/release -j"$(nproc)" stage3
|
|
|
|
# Analyze lakeprof data
|
|
mv lakeprof.log src
|
|
pushd src
|
|
lakeprof report -pj | jq -r '"radar::measurement=\({metric: "build/lakeprof/longest build path//wall-clock", value: .[-1][2], unit: "s"})"'
|
|
lakeprof report -rj | jq -r '"radar::measurement=\({metric: "build/lakeprof/longest rebuild path//wall-clock", value: .[-1][2], unit: "s"})"'
|
|
popd
|
|
|
|
# Upload lakeprof report
|
|
# Guarded to prevent accidental uploads (which wouldn't work anyways) during local runs.
|
|
if [ -f build_upload_lakeprof_report ]; then
|
|
python3 "$BENCH/build/lakeprof_report_upload.py"
|
|
fi
|