52 lines
1.3 KiB
Bash
52 lines
1.3 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Lists "knobs" that easily cause benchmark drift:
|
||
|
|
# - bench_profile defaults (core/bench_profile.h)
|
||
|
|
# - getenv-based gates (core/**)
|
||
|
|
# - cleanenv forced OFF/ON (scripts/*cleanenv*.sh + allocator matrix scripts)
|
||
|
|
#
|
||
|
|
# Usage:
|
||
|
|
# scripts/list_hakmem_knobs.sh
|
||
|
|
|
||
|
|
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
|
|
cd "${root_dir}"
|
||
|
|
|
||
|
|
if ! command -v rg >/dev/null 2>&1; then
|
||
|
|
echo "[list_hakmem_knobs] ripgrep (rg) not found" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
print_block() {
|
||
|
|
local title="$1"
|
||
|
|
echo ""
|
||
|
|
echo "== ${title} =="
|
||
|
|
}
|
||
|
|
|
||
|
|
uniq_sort() {
|
||
|
|
sort -u | sed '/^$/d'
|
||
|
|
}
|
||
|
|
|
||
|
|
print_block "bench_profile defaults (core/bench_profile.h)"
|
||
|
|
rg -n 'bench_setenv_default\("HAKMEM_[A-Z0-9_]+",' core/bench_profile.h \
|
||
|
|
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||
|
|
| uniq_sort
|
||
|
|
|
||
|
|
print_block "getenv gates (core/**)"
|
||
|
|
rg -n 'getenv\("HAKMEM_[A-Z0-9_]+"\)' core \
|
||
|
|
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||
|
|
| uniq_sort
|
||
|
|
|
||
|
|
print_block "cleanenv forced exports (scripts/*cleanenv*.sh)"
|
||
|
|
rg -n 'export HAKMEM_[A-Z0-9_]+=|unset HAKMEM_[A-Z0-9_]+' scripts \
|
||
|
|
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||
|
|
| uniq_sort
|
||
|
|
|
||
|
|
print_block "allocator matrix scripts (scripts/run_allocator_*matrix*.sh)"
|
||
|
|
rg -n 'export HAKMEM_[A-Z0-9_]+=|HAKMEM_PROFILE=|LD_PRELOAD=' scripts/run_allocator_*matrix*.sh \
|
||
|
|
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||
|
|
| uniq_sort
|
||
|
|
|
||
|
|
echo ""
|
||
|
|
echo "Done."
|