docs/adr/ADR-163-edge-latency-measurement.md
Prior milestones (M5/M6, ADR-159/ADR-160) flagged measurement debt: edge latency budgets asserted in doc-comments and manifests but never reproduced by a committed benchmark. Specifically:
wifi-densepose-wasm-edge skill modules document a timing budget "on
ESP32-S3 WASM3" (e.g. exo_time_crystal: "H (heavy, <10 ms)"). These were
CLAIMED, not benchmarked. ADR-160's deferred backlog named exactly this:
"Criterion benches for process_frame budget claims — ACCEPTED-FUTURE."cog-pose-estimation's manifest cites cold_start_ms_avg: 5.4, but neither
cog had a benches/ directory or any committed inference-latency number.Under the project's prove-everything / anti-"AI-slop" directive, a CLAIMED latency budget that a skeptic cannot reproduce is debt. M9 pays it down — benches and docs only, no production-code behavior change (so nothing republishes).
Converted the CLAIMED edge-latency budgets into MEASURED-on-host numbers, with the honest host-vs-ESP32 caveat stated everywhere. Added committed criterion benches over the heaviest hot paths and a results file a skeptic can re-run. The ESP32-on-hardware figure remains explicitly UNMEASURED — this milestone does not pretend a laptop reproduces an Xtensa/WASM3 budget.
process_frame budget benchesv2/crates/wifi-densepose-wasm-edge/benches/process_frame_bench.rs (criterion,
harness = false, required-features = ["std"]). The crate is excluded from
the v2 workspace, so it runs from the crate dir. Benches the M6-audit-named
heaviest hot paths over a fixed synthetic CSI frame, each driven through the
public process_frame after warming the relevant ring/phase buffers so the
expensive path actually executes:
exo_time_crystal::process_frame — full 256-pt × 128-lag autocorrelation.exo_ghost_hunter::process_frame — empty-room periodicity / hidden-breathing.sec_weapon_detect::process_frame — per-subcarrier (MAX_SC=32) Welford.med_seizure_detect::process_frame — clonic-rhythm path (#[cfg(feature = "medical-experimental")], only built/run with that gate).The lib's bench = false was set so the libtest harness does not intercept
criterion CLI flags; the ghost_hunter bin is already standalone-bin-gated and
not built under --features std.
Measured host medians (Intel Core Ultra 9 285H, native --release):
exo_time_crystal 17.3 µs · exo_ghost_hunter 1.44 µs ·
sec_weapon_detect 0.42 µs · med_seizure_detect 0.10 µs.
v2/crates/cog-person-count/benches/infer_bench.rs and
v2/crates/cog-pose-estimation/benches/infer_bench.rs (criterion,
harness = false). Each loads the real shipped weights from the in-repo
cog/artifacts/, asserts the Candle CPU backend (so the stub can never be
silently benched), warms one forward, then times steady-state
InferenceEngine::infer over a fixed CSI window on Device::Cpu.
Measured host medians: cog-person-count 305 µs · cog-pose-estimation 305 µs (steady-state, CPU, real weights).
benchmarks/edge-latency/RESULTS.md, in the benchmarks/wiflow-std/RESULTS.md
style: each number with its exact reproduce command, the machine, the
MEASURED-on-host grade, and the honest caveat.
-O. A host median under budget does not prove the ESP32 meets it.
The ESP32 figure is NOT reproduced here — it needs hardware.infer. We report both, labelled, and do not
conflate them. Empirically, pose steady-state (305 µs host) is ~18× under the
5.4 ms cold-start — the expected shape, and exactly why conflating would lie.process_frame latency — PENDING (hardware). Needs
the wasm32-unknown-unknown target built + flashed to an ESP32-S3 and timed
under WASM3. The host bench is the algorithm-cost proxy until then.# T1 — wasm-edge (workspace-excluded → run from the crate dir)
cd v2/crates/wifi-densepose-wasm-edge
cargo bench --features std -- --warm-up-time 1 --measurement-time 2
cargo bench --features std,medical-experimental -- --warm-up-time 1 --measurement-time 2 med_seizure
# T2 — cogs (workspace members)
cd v2
cargo bench -p cog-person-count --no-default-features --bench infer_bench
cargo bench -p cog-pose-estimation --no-default-features --bench infer_bench
# existing tests still green (behavior unchanged)
cargo test -p cog-person-count -p cog-pose-estimation --no-default-features
process_frame budget claims" line
is now DONE (host); the ESP32-on-hardware confirmation is explicitly the
one remaining pending item.PROOF.md's performance
table and scripts/prove.sh's gated section reference the new benches.