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>
75 lines
1.8 KiB
Bash
Executable File
75 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Sampling profiler sweep across size ranges and threads.
|
|
# Default: short 2s runs; adjust with -d.
|
|
|
|
RUNTIME=2
|
|
THREADS="1,4"
|
|
CHUNK_PER_THREAD=10000
|
|
ROUNDS=1
|
|
SAMPLE_N=8 # 1/256
|
|
MIN=""
|
|
MAX=""
|
|
|
|
usage() {
|
|
cat << USAGE
|
|
Usage: scripts/prof_sweep.sh [options]
|
|
-d SEC runtime seconds (default: 2)
|
|
-t CSV threads CSV (default: 1,4)
|
|
-s N HAKMEM_PROF_SAMPLE exponent (default: 8 → 1/256)
|
|
-m BYTES min size override (optional)
|
|
-M BYTES max size override (optional)
|
|
|
|
Runs with HAKMEM_PROF=1 and prints profiler summary for each case.
|
|
USAGE
|
|
}
|
|
|
|
while getopts ":d:t:s:m:M:h" opt; do
|
|
case $opt in
|
|
d) RUNTIME="$OPTARG" ;;
|
|
t) THREADS="$OPTARG" ;;
|
|
s) SAMPLE_N="$OPTARG" ;;
|
|
m) MIN="$OPTARG" ;;
|
|
M) MAX="$OPTARG" ;;
|
|
h) usage; exit 0 ;;
|
|
:) echo "Missing arg -$OPTARG"; usage; exit 2 ;;
|
|
*) usage; exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
LARSON="$ROOT_DIR/mimalloc-bench/bench/larson/larson"
|
|
LIB="$(readlink -f "$ROOT_DIR/libhakmem.so")"
|
|
|
|
if [[ ! -x "$LARSON" ]]; then
|
|
echo "larson not found: $LARSON" >&2; exit 1
|
|
fi
|
|
|
|
runs=(
|
|
"tiny:8:1024"
|
|
"mid:2048:32768"
|
|
"gap:33000:65536"
|
|
"large:65536:1048576"
|
|
"big:2097152:4194304"
|
|
)
|
|
|
|
IFS=',' read -r -a TARR <<< "$THREADS"
|
|
|
|
echo "[CFG] runtime=$RUNTIME sample=1/$((1<<SAMPLE_N)) threads={$THREADS}"
|
|
|
|
for r in "${runs[@]}"; do
|
|
IFS=':' read -r name rmin rmax <<< "$r"
|
|
if [[ -n "$MIN" ]]; then rmin="$MIN"; fi
|
|
if [[ -n "$MAX" ]]; then rmax="$MAX"; fi
|
|
for t in "${TARR[@]}"; do
|
|
echo "\n== $name | ${t}T | ${rmin}-${rmax} | ${RUNTIME}s =="
|
|
HAKMEM_PROF=1 HAKMEM_PROF_SAMPLE="$SAMPLE_N" \
|
|
LD_PRELOAD="$LIB" "$LARSON" "$RUNTIME" "$rmin" "$rmax" "$CHUNK_PER_THREAD" "$ROUNDS" 12345 "$t" 2>&1 \
|
|
| tail -n 80
|
|
done
|
|
done
|
|
|
|
echo "\nSweep done."
|
|
|