From 77d3e18cce7227b2e1b40bed4a5bf746c18fe213 Mon Sep 17 00:00:00 2001 From: cjkas Date: Mon, 12 Oct 2026 17:57:47 +0200 Subject: [PATCH] fix: log only timings of 100ms or more by default Every HTTP request logged two timing lines and every socket connect five, all from the async_tcp task, at several ms each on a 115200 baud console. Raise the default TIMING_LOG_MIN_MS to 100 and drop the unused ScopeTimer. Co-Authored-By: Claude Opus 5.5 --- src/Timing.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Timing.h b/src/Timing.h index 160b8fc..1367ec9 100644 --- a/src/Timing.h +++ b/src/Timing.h @@ -4,10 +4,11 @@ #include "esp_log.h" // Timings shorter than this are not logged. Every line costs several ms on a -// 115200 baud console so raise it (e.g. -DTIMING_LOG_MIN_MS=50) to see only -// the calls worth looking at. +// 115200 baud console, and per-request timings would add dozens of lines to +// every page load on the task that serves the sockets. Build with +// -DTIMING_LOG_MIN_MS=0 to see every timing. #ifndef TIMING_LOG_MIN_MS -#define TIMING_LOG_MIN_MS 0 +#define TIMING_LOG_MIN_MS 100 #endif // Anything that takes at least this long is logged as a warning so the slow // calls stand out from the routine timings. @@ -37,14 +38,4 @@ static inline void logElapsed(const char *tag, const char *what, uint32_t us) { static inline void logIfSlow(const char *tag, const char *what, uint32_t us, uint32_t minMs) { if(us >= minMs * 1000) logElapsed(tag, what, us); } - -// Logs the time the enclosing scope took when it ends. -class ScopeTimer { - const char *_tag; - const char *_what; - ElapsedTimer _timer; - public: - ScopeTimer(const char *tag, const char *what) : _tag(tag), _what(what) {} - ~ScopeTimer() { logElapsed(_tag, _what, _timer.us()); } -}; #endif