Debug Counters Implementation - Clean History
Major Features: - Debug counter infrastructure for Refill Stage tracking - Free Pipeline counters (ss_local, ss_remote, tls_sll) - Diagnostic counters for early return analysis - Unified larson.sh benchmark runner with profiles - Phase 6-3 regression analysis documentation Bug Fixes: - Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB) - Fix profile variable naming consistency - Add .gitignore patterns for large files Performance: - Phase 6-3: 4.79 M ops/s (has OOM risk) - With SuperSlab: 3.13 M ops/s (+19% improvement) This is a clean repository without large log files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
63
benchmarks/scripts/utils/save_prof_sweep.sh
Executable file
63
benchmarks/scripts/utils/save_prof_sweep.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Save a short profiler sweep into docs/benchmarks/<YYYYMMDD_HHMMSS>/
|
||||
# Usage: scripts/save_prof_sweep.sh [-d SEC] [-t CSV] [-s N]
|
||||
|
||||
RUNTIME=2
|
||||
THREADS="1,4"
|
||||
SAMPLE_N=8
|
||||
BENCH_TIMEOUT=""
|
||||
KILL_GRACE=${KILL_GRACE:-2}
|
||||
|
||||
while getopts ":d:t:s:h" opt; do
|
||||
case $opt in
|
||||
d) RUNTIME="$OPTARG" ;;
|
||||
t) THREADS="$OPTARG" ;;
|
||||
s) SAMPLE_N="$OPTARG" ;;
|
||||
h) echo "Usage: $0 [-d SEC] [-t CSV] [-s N]"; exit 0 ;;
|
||||
:) echo "Missing arg -$OPTARG"; exit 2 ;;
|
||||
*) echo "Usage: $0 [-d SEC] [-t CSV] [-s N]"; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
OUTDIR="$ROOT_DIR/docs/benchmarks/$(date +%Y%m%d_%H%M%S)"
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
LIB="$(readlink -f "$ROOT_DIR/libhakmem.so" || true)"
|
||||
LARSON="$ROOT_DIR/mimalloc-bench/bench/larson/larson"
|
||||
|
||||
if [[ -z "${BENCH_TIMEOUT}" ]]; then
|
||||
BENCH_TIMEOUT=$(( RUNTIME + 3 ))
|
||||
fi
|
||||
|
||||
echo "Saving sweep into: $OUTDIR" | tee "$OUTDIR/summary.txt"
|
||||
echo "RUNTIME=$RUNTIME THREADS=$THREADS SAMPLE=1/$((1<<SAMPLE_N)) TIMEOUT=${BENCH_TIMEOUT}s" | tee -a "$OUTDIR/summary.txt"
|
||||
|
||||
declare -a RUNS=(
|
||||
"tiny 8 1024"
|
||||
"mid 2048 32768"
|
||||
"gap 33000 65536"
|
||||
"large 65536 1048576"
|
||||
)
|
||||
|
||||
IFS=',' read -r -a TARR <<< "$THREADS"
|
||||
|
||||
for r in "${RUNS[@]}"; do
|
||||
read -r name rmin rmax <<< "$r"
|
||||
for t in "${TARR[@]}"; do
|
||||
label="${name}_T${t}_${rmin}-${rmax}"
|
||||
echo "== $label ==" | tee -a "$OUTDIR/summary.txt"
|
||||
if [[ -f "$LARSON" && -f "$ROOT_DIR/libhakmem.so" ]]; then
|
||||
timeout -k "${KILL_GRACE}s" "${BENCH_TIMEOUT}s" \
|
||||
env HAKMEM_PROF=1 HAKMEM_PROF_SAMPLE="$SAMPLE_N" \
|
||||
LD_PRELOAD="$LIB" "$LARSON" "$RUNTIME" "$rmin" "$rmax" 10000 1 12345 "$t" 2>&1 \
|
||||
| tee "$OUTDIR/${label}.log" | tail -n 80 | tee -a "$OUTDIR/summary.txt"
|
||||
else
|
||||
echo "Skip: missing larson or libhakmem.so" | tee -a "$OUTDIR/summary.txt"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "Done. See $OUTDIR" | tee -a "$OUTDIR/summary.txt"
|
||||
Reference in New Issue
Block a user