mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
Also refactor util.sh in the process, so test scripts become easier to write (inspired in part by lake's test suite).
72 lines
2.0 KiB
Bash
Executable File
72 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
source ../../env_bench.sh
|
|
|
|
STAGE_THIS="stage$STAGE"
|
|
STAGE_NEXT="stage$((STAGE + 1))"
|
|
|
|
BUILD_ROOT="$(realpath "$BUILD_DIR/..")"
|
|
BUILD_THIS="$(realpath "$BUILD_ROOT/$STAGE_THIS")"
|
|
BUILD_NEXT="$(realpath "$BUILD_ROOT/$STAGE_NEXT")"
|
|
|
|
OUT="$(realpath measurements.jsonl)"
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Configuring $STAGE_NEXT..."
|
|
echo ">"
|
|
|
|
# Building a stage mostly affects files in that stage's build directory.
|
|
# However, the bench suite runs inside the source directory for developer UX
|
|
# reasons, so some stage-specific bench suite files are generated in the source
|
|
# directory (namely the env_*.sh files).
|
|
#
|
|
# To avoid messing up the rest of the bench suite, we restore those files to
|
|
# STAGE_THIS's versions immediately after we configure STAGE_NEXT. Yes, this is
|
|
# a big hack, but it allows running the build benchmark as part of the bench
|
|
# suite instead of completely separately.
|
|
#
|
|
# Configuring STAGE_NEXT also builds all stages up to and including STAGE_THIS.
|
|
make -C "$BUILD_ROOT" -j"$(nproc)" "$STAGE_NEXT-configure"
|
|
make -C "$BUILD_ROOT" -j"$(nproc)" "$STAGE_THIS-configure"
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Warming up $STAGE_NEXT..."
|
|
echo ">"
|
|
|
|
make -C "$BUILD_NEXT" -j"$(nproc)"
|
|
find "$BUILD_NEXT/lib" -name "*.olean" -delete
|
|
rm -f measurements.jsonl
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Building $STAGE_NEXT..."
|
|
echo ">"
|
|
|
|
LAKE_OVERRIDE_LEAN=true LEAN="$(realpath fake_root/bin/lean)" \
|
|
WRAPPER_PREFIX="$(realpath fake_root)" WRAPPER_OUT="$OUT" \
|
|
lakeprof record -- \
|
|
"$TEST_DIR/measure.py" -t build -d -a -- \
|
|
make -C "$BUILD_NEXT" -j"$(nproc)"
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Analyzing lakeprof data..."
|
|
echo ">"
|
|
|
|
# Lakeprof must be executed in the src dir because it obtains some metadata by
|
|
# calling lake in its current working directory.
|
|
mv lakeprof.log "$SRC_DIR"
|
|
pushd "$SRC_DIR"
|
|
lakeprof report -pj | jq '{metric: "build/lakeprof/longest build path//wall-clock", value: .[-1][2], unit: "s"}' -c >> "$OUT"
|
|
lakeprof report -rj | jq '{metric: "build/lakeprof/longest rebuild path//wall-clock", value: .[-1][2], unit: "s"}' -c >> "$OUT"
|
|
popd
|