diff options
| author | Luke Hoersten <[email protected]> | 2026-06-20 20:16:01 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-20 20:16:01 -0500 |
| commit | 19c090566fc15e72508166d81fd42eb46ac8efd5 (patch) | |
| tree | bbbc9ff3bc08e0a65b55b89c686d999ec3ea19b0 /main/stream_server.h | |
| parent | e5acf936ea641c88c10bf50862602289235ae888 (diff) | |
firmware: recv-throughput instrumentation (FIONREAD pre-body, recv() call/chunk stats, SO_RCVBUF probe)
Per-frame samples aggregated over the existing 30-frame window:
- queued_at_body_start (FIONREAD just before body recv loop): how much
of the frame the kernel already absorbed during the previous
decode+paint. Close to jpeg_len → wire delivered the full frame
while we were busy (we're decode/paint-bound). Much smaller →
wire is throttled (window or buffer too small to absorb a frame
in our paint window).
- recv_calls: number of recv() syscalls the body read needed per
frame. High → small chunks → window-throttled sender.
- recv_chunk min/avg/max: bytes returned per recv() return in the
window. Avg = window body bytes / total syscalls.
- SO_RCVBUF: one-shot getsockopt at accept, logged and stashed in
stats. Confirms whether sdkconfig values reached the build —
TCP_WND_DEFAULT discrepancies are otherwise invisible.
All surfaced in the windowed log and in /state JSON alongside the
existing recv/dec/paint/idle stats. No behavior change yet.
Diffstat (limited to 'main/stream_server.h')
| -rw-r--r-- | main/stream_server.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/main/stream_server.h b/main/stream_server.h index 1d13457..5de1e1f 100644 --- a/main/stream_server.h +++ b/main/stream_server.h @@ -51,6 +51,17 @@ typedef struct { uint32_t dec_min_us, dec_avg_us, dec_max_us; uint32_t pnt_min_us, pnt_avg_us, pnt_max_us; uint32_t idle_min_us, idle_avg_us, idle_max_us; + // Recv-throughput diagnostics. Per-frame samples aggregated over the + // window. queued_at_body_start = FIONREAD just before the body recv + // loop runs; if it's close to jpeg_len the wire delivered the whole + // frame while we were decoding the previous one (we're not the bottleneck). + // recv_calls = number of recv() syscalls the body read needed (high → + // many small chunks → window-throttled sender). recv_chunk = body + // bytes returned per single recv() call within the window. + uint32_t queued_min, queued_avg, queued_max; // bytes + uint32_t recv_calls_min, recv_calls_avg, recv_calls_max; // syscalls per frame body + uint32_t recv_chunk_min, recv_chunk_avg, recv_chunk_max; // bytes per recv() return + uint32_t so_rcvbuf; // SO_RCVBUF observed at accept (0 = unknown) uint32_t last_paint_event_us_low; // last v1 frame's event_us_low, // 0 if none seen yet on this // boot or last frame was v0 |
