ci / audit (push) Failing after 26s
- scheduler/: day/night engine (conf-driven redesign), psi/perfsnap collectors, proxmox-ctl, systemd timer templates — ported from ~/projects/ultix per the breakout map in scheduler/README.md - loop/: perf-loop driver (baseline/audit/tweak/rebaseline), cpu-bench (new CPU leg), baseline-diff (tolerance compare) — smoke-tested locally - docs/ARCHITECTURE.md: full program design (loop, resource groups, VM/spindle balancing, k8s-vs-Slurm, beszel+RAPL/iDRAC telemetry spine, workload classes, solar/HA + two-site power economics) - docs/report-amt-power-telemetry.md + docs/report-moonlight-desktop.md Redmine: https://projects.knownelement.com/issues/826#note-2
36 lines
1.7 KiB
Bash
Executable File
36 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# KNELPerf baseline diff — compares two baseline bundles (or live-audits one).
|
|
#
|
|
# baseline-diff.sh <dirA> <dirB> compare two stored bundles
|
|
# Values are TSV metric/value/unit rows from cpu-bench.tsv. Numeric metrics
|
|
# compare with a tolerance (default 10%); non-numeric metrics compare for
|
|
# equality (governor flips are exactly what we want to catch).
|
|
set -euo pipefail
|
|
TOL_PCT=${KNELPERF_DIFF_TOL:-25} # 1-thread openssl on a busy host swings >10% run-to-run
|
|
[ $# = 2 ] || { echo "usage: $0 <dirA> <dirB>" >&2; exit 2; }
|
|
A=$1; B=$2
|
|
[ -r "$A/cpu-bench.tsv" ] || { echo "no cpu-bench.tsv in $A" >&2; exit 3; }
|
|
[ -r "$B/cpu-bench.tsv" ] || { echo "no cpu-bench.tsv in $B" >&2; exit 3; }
|
|
|
|
join_tsv() { awk -F'\t' 'NR==FNR{a[$1]=$2;next} {print $1"\t"a[$1]"\t"$2"\t"$3}' "$1" "$2"; }
|
|
|
|
# shellcheck disable=SC2034 # exit-status reserved for future strictness
|
|
status=0
|
|
join_tsv "$A/cpu-bench.tsv" "$B/cpu-bench.tsv" | while IFS=$'\t' read -r metric va vb unit; do
|
|
[ -n "$va" ] && [ -n "$vb" ] || continue
|
|
if [ "$va" = "$vb" ]; then
|
|
printf 'OK %-28s %s = %s %s\n' "$metric" "$va" "$vb" "$unit"
|
|
elif [ "$va" = "${va#[-+0-9.]}" ] || [ "$vb" = "${vb#[-+0-9.]}" ]; then
|
|
printf 'DRIFT %-28s %s -> %s %s\n' "$metric" "$va" "$vb" "$unit"
|
|
else
|
|
delta=$(awk -v a="$va" -v b="$vb" 'BEGIN{d=(b-a)/((a==0)?1:a)*100; printf "%+.1f", d}')
|
|
flag=$(awk -v d="${delta#+}" -v t="$TOL_PCT" 'BEGIN{m=d<0?-d:d; if(m>t) print "DELTA"; else print "OK"}')
|
|
if [ "$flag" = OK ]; then
|
|
printf 'OK %-28s %s -> %s (%s%%) %s\n' "$metric" "$va" "$vb" "$delta" "$unit"
|
|
else
|
|
printf 'DELTA %-28s %s -> %s (%s%%) %s\n' "$metric" "$va" "$vb" "$delta" "$unit"
|
|
fi
|
|
fi
|
|
done
|
|
echo "tolerance: ${TOL_PCT}% (set KNELPERF_DIFF_TOL to change)"
|