KNELPerf v2 wave 1: Ultix scheduler breakout + loop skeleton + reports (#826)
ci / audit (push) Failing after 26s
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
This commit is contained in:
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# KNELPerf CPU benchmark — the missing CPU leg of the perf loop (#826).
|
||||
# Runs ON the target host (or locally). Zero-install friendly: uses openssl
|
||||
# (always present) plus sysbench when available. Output = TSV tag/value.
|
||||
#
|
||||
# Design notes:
|
||||
# - openssl speed = single+multi core crypto throughput (stable, comparable)
|
||||
# - sysbench cpu (if installed) = integer event rate
|
||||
# - /proc-derived context: governor, PSI at capture time
|
||||
set -u
|
||||
DUR=${KNELPERF_CPUBENCH_SECS:-10}
|
||||
|
||||
echo -e "metric\tvalue\tunit"
|
||||
|
||||
gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo none)
|
||||
echo -e "governor\t$gov\t-"
|
||||
nproc=$(nproc)
|
||||
echo -e "nproc\t$nproc\t-"
|
||||
|
||||
# openssl: 1 thread then all threads, aes-256-cbc (avx-sensitive) and sha256.
|
||||
# Parse: LAST line whose first field is the algo; value = last numeric field
|
||||
# (per-thread rows precede the aggregate row in -multi output).
|
||||
for algo in aes-256-cbc sha256; do
|
||||
v=$(openssl speed -seconds "$DUR" "$algo" 2>/dev/null \
|
||||
| awk -v a="$algo" '$1==a{v=$NF} END{print v}')
|
||||
[ -n "${v:-}" ] && echo -e "openssl_${algo}_1t\t$v\tk/s"
|
||||
# -multi: per-thread rows precede the aggregate; keep the LAST match
|
||||
v=$(openssl speed -multi "$nproc" -seconds "$DUR" "$algo" 2>/dev/null \
|
||||
| awk -v a="$algo" '$1==a{v=$NF} END{print v}')
|
||||
[ -n "${v:-}" ] && echo -e "openssl_${algo}_${nproc}t\t$v\tk/s"
|
||||
done
|
||||
|
||||
# sysbench (optional, if installed)
|
||||
if command -v sysbench >/dev/null 2>&1; then
|
||||
ev=$(sysbench cpu --time=$((DUR*1000)) --threads=1 run 2>/dev/null \
|
||||
| awk -F'/s|events per second:/{for(i=1;i<=NF;i++) if($i ~ /^[0-9.]+$/){print $i; exit}}')
|
||||
[ -n "${ev:-}" ] && echo -e "sysbench_cpu_1t\t$ev\tevents/s"
|
||||
ev=$(sysbench cpu --time=$((DUR*1000)) --threads="$nproc" run 2>/dev/null \
|
||||
| awk -F'/s|events per second:/{for(i=1;i<=NF;i++) if($i ~ /^[0-9.]+$/){print $i; exit}}')
|
||||
[ -n "${ev:-}" ] && echo -e "sysbench_cpu_${nproc}t\t$ev\tevents/s"
|
||||
else
|
||||
echo -e "sysbench_cpu\tabsent\t-"
|
||||
fi
|
||||
|
||||
# PSI snapshot at capture time (context for the numbers above)
|
||||
for res in cpu memory io; do
|
||||
v=$(awk '$1=="some"{for(i=2;i<=NF;i++) if($i ~ /^avg60=/){sub("avg60=","",$i); print $i; exit}}' \
|
||||
"/proc/pressure/$res" 2>/dev/null || echo 0)
|
||||
echo -e "psi_${res}_avg60\t$v\t%"
|
||||
done
|
||||
exit 0
|
||||
Reference in New Issue
Block a user