41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
|
|
#!/usr/bin/env bash
|
|||
|
|
set -euo pipefail
|
|||
|
|
|
|||
|
|
# Random mixed (16–1024B) matrix runner
|
|||
|
|
# Usage: benchmarks/scripts/run_random_mixed_matrix.sh [cycles] [ws] [reps]
|
|||
|
|
|
|||
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd)"
|
|||
|
|
cd "$ROOT_DIR"
|
|||
|
|
|
|||
|
|
cycles=${1:-1000000}
|
|||
|
|
ws=${2:-8192}
|
|||
|
|
reps=${3:-5}
|
|||
|
|
|
|||
|
|
outdir="bench_results/auto/random_mixed_$(date +%Y%m%d_%H%M%S)"
|
|||
|
|
mkdir -p "$outdir"
|
|||
|
|
csv="$outdir/results.csv"
|
|||
|
|
echo "ts,scenario,allocator,env,cycles,ws,rep,throughput_ops_s" >"$csv"
|
|||
|
|
|
|||
|
|
run_case() {
|
|||
|
|
local alloc="$1"; shift
|
|||
|
|
local envstr="$1"; shift
|
|||
|
|
local bin="$1"; shift
|
|||
|
|
for ((i=1;i<=reps;i++)); do
|
|||
|
|
local ts=$(date +%H%M%S)
|
|||
|
|
local out
|
|||
|
|
out=$($envstr "$bin" "$cycles" "$ws" 123 2>/dev/null || true)
|
|||
|
|
local tput=$(echo "$out" | awk '/Throughput =/{print $3; exit}')
|
|||
|
|
if [[ -n "${tput:-}" ]]; then
|
|||
|
|
echo "$ts,random_mixed,$alloc,$(echo "$envstr" | sed 's/,/;/g'),$cycles,$ws,$i,$tput" >>"$csv"
|
|||
|
|
fi
|
|||
|
|
done
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[[ -x ./bench_random_mixed_system ]] || make -s bench_random_mixed_system >/dev/null
|
|||
|
|
[[ -x ./bench_random_mixed_hakmem ]] || make -s bench_random_mixed_hakmem >/dev/null
|
|||
|
|
|
|||
|
|
echo "[info] writing CSV to $csv"
|
|||
|
|
run_case "system" "env -i" ./bench_random_mixed_system
|
|||
|
|
run_case "hakmem" "env -i HAKMEM_WRAP_TINY=1" ./bench_random_mixed_hakmem
|
|||
|
|
echo "[done] $csv"
|