[repo] Bench: ss in the CI shell and in bench.sh's tool check; no pid found no longer ends the run silently

This commit is contained in:
2026-12-02 19:57:50 +01:00
parent 35852030bf
commit 42127ed919
3 changed files with 6 additions and 22 deletions
+4 -3
View File
@@ -8,7 +8,7 @@
# (tests/diff/src/bin/pair.rs) to the same upstream; oha drives each in turn. Results are
# committed as data: bench/results/<date>-<label>.csv and the raw oha JSON beside it.
#
# scripts/bench.sh [label] # needs caddy, oha, jq on PATH
# scripts/bench.sh [label] # needs caddy, oha, jq, ss on PATH
# nix shell nixpkgs#caddy nixpkgs#oha nixpkgs#jq -c scripts/bench.sh wsl2-ryzen
#
# Environment: DURATION (each load run, default 20s), SOAK (the soak run, default 300s; 0 skips
@@ -23,7 +23,7 @@ duration=${DURATION:-20s}
soak=${SOAK:-300}
conns=${CONNS:-"1 16 64 256"}
profile=${BUILD:-release}
for tool in caddy oha jq; do
for tool in caddy oha jq ss; do
command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; }
done
@@ -66,7 +66,8 @@ done
# The process to sample for memory: edge runs inside ianitor-pair; each Caddy is a child of it.
pid_of() {
local port=$1
ss -Hltnp "sport = :$port" 2>/dev/null | grep -Eo 'pid=[0-9]+' | head -1 | cut -d= -f2
# No pid found is not an error (the row says 0); set -e and pipefail would end the run here, silently.
ss -Hltnp "sport = :$port" 2>/dev/null | grep -Eo 'pid=[0-9]+' | head -1 | cut -d= -f2 || true
}
rss_kb() { awk '/VmRSS/ {print $2}' "/proc/$1/status" 2>/dev/null || echo 0; }