feat(bench): harness v1.1 — PSI latency, load, device identity context [#709]

Replaces unavailable latencytop; sysstat/iotop deployed fleet-wide
separately. Redmine: https://projects.knownelement.com/issues/709
This commit is contained in:
2026-09-03 16:55:28 -05:00
parent abb725be85
commit a2a45ea9d8
+19
View File
@@ -30,6 +30,20 @@ b meta path "$BENCH_DIR"
b meta runtime "$RUNTIME" b meta runtime "$RUNTIME"
b meta size "$SIZE" b meta size "$SIZE"
# context: load, PSI latency (pressure stall info — the latencytop
# replacement on modern kernels), and the backing device of BENCH_DIR
b meta load "$(cat /proc/loadavg)"
if [ -d /proc/pressure ]; then
for rsc in io cpu memory; do
[ -r "/proc/pressure/$rsc" ] && \
b "psi_${rsc}_some_avg10" "$(awk '{for(i=1;i<=NF;i++) if($i ~ /^avg10=/) sub("avg10=","",$i)} /^some/ {print $2; exit}' "/proc/pressure/$rsc" 2>/dev/null)"
done
fi
DEV=$(df -P "$BENCH_DIR" | awk 'NR==2 {print $1}')
b meta bench_device "$DEV"
[ -r "/sys/block/$(basename "$DEV")/queue/rotational" ] && \
b meta bench_device_rotational "$(cat "/sys/block/$(basename "$DEV")/queue/rotational")"
# fio may print human notes (e.g. sync-engine warnings) before the JSON on # fio may print human notes (e.g. sync-engine warnings) before the JSON on
# stdout; strip everything before the opening brace so jq always gets JSON. # stdout; strip everything before the opening brace so jq always gets JSON.
parse_fio() { # $1=json-file $2=testname $3=read|write parse_fio() { # $1=json-file $2=testname $3=read|write
@@ -58,6 +72,11 @@ run_fio seqwrite1m write --filename="$BENCH_DIR/perf-test-file" --rw=write -
rm -f "$BENCH_DIR/.fio-out.json" "$BENCH_DIR/.fio-err" rm -f "$BENCH_DIR/.fio-out.json" "$BENCH_DIR/.fio-err"
# post-run pressure + load (did the bench itself saturate the box?)
b meta load_end "$(cat /proc/loadavg)"
[ -r /proc/pressure/io ] && \
b psi_io_some_avg10_end "$(awk '/^some/ {for(i=1;i<=NF;i++) if($i ~ /^avg10=/) {sub("avg10=","",$i); print $i; exit}}' /proc/pressure/io)"
# network: only when a server is provided # network: only when a server is provided
if [ -n "${IPERF_SERVER:-}" ] && command -v iperf3 >/dev/null 2>&1; then if [ -n "${IPERF_SERVER:-}" ] && command -v iperf3 >/dev/null 2>&1; then
NET=$(iperf3 -c "$IPERF_SERVER" -t 10 -P 4 -J 2>/dev/null | jq -r '.end.sum_received.bits_per_second' 2>/dev/null) NET=$(iperf3 -c "$IPERF_SERVER" -t 10 -P 4 -J 2>/dev/null | jq -r '.end.sum_received.bits_per_second' 2>/dev/null)