chore(tools): fail the bench when neferwl does not start
- commit
- 0002628d706d188aee9a9a59838141a52bff8d33
- author
- brice · · 2026-10-13 17:58 UTC
- committer
- brice · · 2026-10-14 04:34 UTC
- parent
- 7f86f64
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +14 -3
M tools/bench/bench.sh +14 -3
| @@ -39,6 +39,11 @@ nwl=$! | |||
| 39 | 39 | pids+=("$nwl") | |
| 40 | 40 | log=$tmp/state/neferwl/runs/headless/latest.log | |
| 41 | 41 | for _ in $(seq 50); do [ -S "$tmp/rt/wayland-1" ] && break; sleep 0.1; done | |
| 42 | + | if [ ! -S "$tmp/rt/wayland-1" ]; then | |
| 43 | + | echo "neferwl did not start: no wayland-1 socket; its output:" >&2 | |
| 44 | + | cat "$tmp/nwl.out" >&2 | |
| 45 | + | exit 1 | |
| 46 | + | fi | |
| 42 | 47 | ||
| 43 | 48 | if [ -n "${BENCH_X11:-}" ]; then | |
| 44 | 49 | disp= | |
| @@ -59,12 +64,18 @@ sleep 8 | |||
| 59 | 64 | ||
| 60 | 65 | cs() { cat /proc/"$nwl"/task/*/status | awk '/^voluntary_ctxt/{v+=$2} END{print v}'; } | |
| 61 | 66 | # CPU time in ns summed over threads (schedstat is finer than stat's ticks). | |
| 62 | - | ticks() { cat /proc/"$nwl"/task/*/schedstat | awk '{v+=$1} END{printf "%d\n", v}'; } | |
| 67 | + | cpu_ns() { cat /proc/"$nwl"/task/*/schedstat | awk '{v+=$1} END{printf "%d\n", v}'; } | |
| 63 | 68 | frames() { grep -c '"message":"frame"' "$log" || true; } | |
| 64 | 69 | ||
| 65 | - | t0=$(ticks); f0=$(frames); c0=$(cs) | |
| 70 | + | t0=$(cpu_ns); f0=$(frames); c0=$(cs) | |
| 66 | 71 | sleep "$secs" | |
| 67 | - | t1=$(ticks); f1=$(frames); c1=$(cs) | |
| 72 | + | t1=$(cpu_ns); f1=$(frames); c1=$(cs) | |
| 73 | + | ||
| 74 | + | if [ "$((f1 - f0))" -le 0 ]; then | |
| 75 | + | echo "no frame presented in ${secs}s: the page did not animate or neferwl stalled" >&2 | |
| 76 | + | tail -n 20 "$tmp/nwl.out" >&2 | |
| 77 | + | exit 1 | |
| 78 | + | fi | |
| 68 | 79 | ||
| 69 | 80 | python3 - "$((t1 - t0))" "$((f1 - f0))" "$((c1 - c0))" "$secs" "$page" <<'EOF' | |
| 70 | 81 | import sys | |
| @@ -39,6 +39,11 @@ nwl=$! | |||||
| 39 | pids+=("$nwl") | 39 | pids+=("$nwl") | ||
| 40 | log=$tmp/state/neferwl/runs/headless/latest.log | 40 | log=$tmp/state/neferwl/runs/headless/latest.log | ||
| 41 | for _ in $(seq 50); do [ -S "$tmp/rt/wayland-1" ] && break; sleep 0.1; done | 41 | for _ in $(seq 50); do [ -S "$tmp/rt/wayland-1" ] && break; sleep 0.1; done | ||
| 42 | + | if [ ! -S "$tmp/rt/wayland-1" ]; then | |||
| 43 | + | echo "neferwl did not start: no wayland-1 socket; its output:" >&2 | |||
| 44 | + | cat "$tmp/nwl.out" >&2 | |||
| 45 | + | exit 1 | |||
| 46 | + | fi | |||
| 42 | 47 | ||||
| 43 | if [ -n "${BENCH_X11:-}" ]; then | 48 | if [ -n "${BENCH_X11:-}" ]; then | ||
| 44 | disp= | 49 | disp= | ||
| @@ -59,12 +64,18 @@ sleep 8 | |||||
| 59 | 64 | ||||
| 60 | cs() { cat /proc/"$nwl"/task/*/status | awk '/^voluntary_ctxt/{v+=$2} END{print v}'; } | 65 | cs() { cat /proc/"$nwl"/task/*/status | awk '/^voluntary_ctxt/{v+=$2} END{print v}'; } | ||
| 61 | # CPU time in ns summed over threads (schedstat is finer than stat's ticks). | 66 | # CPU time in ns summed over threads (schedstat is finer than stat's ticks). | ||
| 62 | - | ticks() { cat /proc/"$nwl"/task/*/schedstat | awk '{v+=$1} END{printf "%d\n", v}'; } | 67 | + | cpu_ns() { cat /proc/"$nwl"/task/*/schedstat | awk '{v+=$1} END{printf "%d\n", v}'; } |
| 63 | frames() { grep -c '"message":"frame"' "$log" || true; } | 68 | frames() { grep -c '"message":"frame"' "$log" || true; } | ||
| 64 | 69 | ||||
| 65 | - | t0=$(ticks); f0=$(frames); c0=$(cs) | 70 | + | t0=$(cpu_ns); f0=$(frames); c0=$(cs) |
| 66 | sleep "$secs" | 71 | sleep "$secs" | ||
| 67 | - | t1=$(ticks); f1=$(frames); c1=$(cs) | 72 | + | t1=$(cpu_ns); f1=$(frames); c1=$(cs) |
| 73 | + | ||||
| 74 | + | if [ "$((f1 - f0))" -le 0 ]; then | |||
| 75 | + | echo "no frame presented in ${secs}s: the page did not animate or neferwl stalled" >&2 | |||
| 76 | + | tail -n 20 "$tmp/nwl.out" >&2 | |||
| 77 | + | exit 1 | |||
| 78 | + | fi | |||
| 68 | 79 | ||||
| 69 | python3 - "$((t1 - t0))" "$((f1 - f0))" "$((c1 - c0))" "$secs" "$page" <<'EOF' | 80 | python3 - "$((t1 - t0))" "$((f1 - f0))" "$((c1 - c0))" "$secs" "$page" <<'EOF' | ||
| 70 | import sys | 81 | import sys | ||