refactor: time steps with ElapsedTimer::lap()

loop(), socket client init and /discovery each read a step's time and
restarted the timer by hand. lap() does both. Also put the request timing
comment back on timeRequest() and say why /discovery logs its steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-13 15:39:14 +02:00
parent 293e013aa2
commit 4544eb6469
6 changed files with 53 additions and 28 deletions

View file

@ -140,19 +140,16 @@ void SocketEmitter::initClients() {
esp_task_wdt_reset();
ElapsedTimer total, step;
settings.emitSockets(slot);
logElapsed(TAG, "Socket init settings", step.us());
logElapsed(TAG, "Socket init settings", step.lap());
if(!ws.hasClient(asyncId)) { this->newClients[i] = 255; continue; }
step.restart();
somfy.emitState(slot);
logElapsed(TAG, "Socket init somfy state", step.us());
logElapsed(TAG, "Socket init somfy state", step.lap());
if(!ws.hasClient(asyncId)) { this->newClients[i] = 255; continue; }
step.restart();
git.emitUpdateCheck(slot);
logElapsed(TAG, "Socket init update check", step.us());
logElapsed(TAG, "Socket init update check", step.lap());
if(!ws.hasClient(asyncId)) { this->newClients[i] = 255; continue; }
step.restart();
net.emitSockets(slot);
logElapsed(TAG, "Socket init network", step.us());
logElapsed(TAG, "Socket init network", step.lap());
logElapsed(TAG, "Socket init total", total.us());
esp_task_wdt_reset();
}