cc_bench_hot.sh (1641B)
1 #!/usr/bin/env bash 2 # Targeted hotspot sampler: drive cc_bench.sh one axis at a time at a size tuned 3 # for a ~1.5-3s run, so macOS `sample` captures a reliable call graph (it needs 4 # >=1s). The normal sweep tops out under 400ms now (Rounds 1-4), so sampling is 5 # skipped there. Output: build/bench/hot/<axis>/{raw/<axis>.sample.txt,scaling.*}. 6 # 7 # Usage: KIT=build/bench/kit bash scripts/cc_bench_hot.sh [axis ...] 8 set -uo pipefail 9 ROOT="$(cd "$(dirname "$0")/.." && pwd)" 10 KIT="${KIT:-$ROOT/build/bench/kit}" 11 12 # Per-axis single big size tuned for ~1.5-3s at the per-unit ns measured in the 13 # normal sweep. Two points where cheap so the reporter can still fit an exponent. 14 declare -A SIZES=( 15 [fn-count]="256000 512000" 16 [body-size]="512000 1024000" 17 [global-decl]="1024000 2048000" 18 [type-decl]="512000 1024000" 19 [locals-per-fn]="512000 1024000" 20 [pp-macro]="512000 1024000" 21 [pp-include]="64000 128000" 22 [ref-density]="256000 512000" 23 [symbol-count]="1024000 2048000" 24 [obj-count]="4096 8192" 25 ) 26 27 AXES="${*:-fn-count body-size global-decl type-decl locals-per-fn pp-macro pp-include ref-density symbol-count obj-count}" 28 for axis in $AXES; do 29 sizes="${SIZES[$axis]:-}" 30 [ -z "$sizes" ] && { echo "skip unknown axis $axis"; continue; } 31 echo "===== hot: $axis sizes=$sizes =====" 32 KIT="$KIT" \ 33 KIT_CC_BENCH_OUT="$ROOT/build/bench/hot/$axis" \ 34 KIT_CC_BENCH_AXES="$axis" \ 35 KIT_CC_BENCH_SIZES="$sizes" \ 36 KIT_CC_BENCH_REPEATS=2 \ 37 KIT_CC_BENCH_SKIP_CLANG=1 \ 38 KIT_CC_BENCH_MAX_MS=0 \ 39 KIT_CC_BENCH_SAMPLE=1 \ 40 KIT_CC_BENCH_SAMPLE_MIN_MS=800 \ 41 bash "$ROOT/scripts/cc_bench.sh" 42 done 43 echo "===== hot sampling done ====="