src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/http_api.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-20 20:16:01 -0500
committerLuke Hoersten <[email protected]>2026-06-20 20:16:01 -0500
commit19c090566fc15e72508166d81fd42eb46ac8efd5 (patch)
treebbbc9ff3bc08e0a65b55b89c686d999ec3ea19b0 /main/http_api.c
parente5acf936ea641c88c10bf50862602289235ae888 (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/http_api.c')
-rw-r--r--main/http_api.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/http_api.c b/main/http_api.c
index 238514b..ccd795b 100644
--- a/main/http_api.c
+++ b/main/http_api.c
@@ -101,6 +101,17 @@ static esp_err_t state_get_handler(httpd_req_t *req)
cJSON_AddNumberToObject(s, "idle_min_us", (double)stream.idle_min_us);
cJSON_AddNumberToObject(s, "idle_avg_us", (double)stream.idle_avg_us);
cJSON_AddNumberToObject(s, "idle_max_us", (double)stream.idle_max_us);
+ // Recv-throughput diagnostics. See stream_server.h for semantics.
+ cJSON_AddNumberToObject(s, "queued_min", (double)stream.queued_min);
+ cJSON_AddNumberToObject(s, "queued_avg", (double)stream.queued_avg);
+ cJSON_AddNumberToObject(s, "queued_max", (double)stream.queued_max);
+ cJSON_AddNumberToObject(s, "recv_calls_min", (double)stream.recv_calls_min);
+ cJSON_AddNumberToObject(s, "recv_calls_avg", (double)stream.recv_calls_avg);
+ cJSON_AddNumberToObject(s, "recv_calls_max", (double)stream.recv_calls_max);
+ cJSON_AddNumberToObject(s, "recv_chunk_min", (double)stream.recv_chunk_min);
+ cJSON_AddNumberToObject(s, "recv_chunk_avg", (double)stream.recv_chunk_avg);
+ cJSON_AddNumberToObject(s, "recv_chunk_max", (double)stream.recv_chunk_max);
+ cJSON_AddNumberToObject(s, "so_rcvbuf", (double)stream.so_rcvbuf);
cJSON_AddNumberToObject(s, "last_paint_event_us_low",
(double)stream.last_paint_event_us_low);
cJSON_AddItemToObject(root, "stream", s);