From 8364c2b1471771b630e17030eb436302213079d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 30 Dec 2022 17:03:48 +0100 Subject: [PATCH] more verbose thread debug --- src/Power.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index d2c5b01a0..550c8ad37 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -287,8 +287,18 @@ void Power::readPowerStatus() powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); newStatus.notifyObservers(&powerStatus2); #ifdef DEBUG_HEAP - if (lastheap != ESP.getFreeHeap()){ - DEBUG_MSG("Heap status: %d/%d bytes free (%d), running %d threads\n", ESP.getFreeHeap(), ESP.getHeapSize(), ESP.getFreeHeap() - lastheap , concurrency::mainController.size(false)); + if (lastheap != ESP.getFreeHeap()) { + DEBUG_MSG("Threads running:"); + int running = 0; + for(int i = 0; i < MAX_THREADS; i++){ + auto thread = concurrency::mainController.get(i); + if((thread != nullptr) && (thread->enabled)) { + DEBUG_MSG(" %s", thread->ThreadName.c_str()); + running++; + } + } + DEBUG_MSG("\n"); + DEBUG_MSG("Heap status: %d/%d bytes free (%d), running %d/%d threads\n", ESP.getFreeHeap(), ESP.getHeapSize(), ESP.getFreeHeap() - lastheap, running, concurrency::mainController.size(false)); lastheap = ESP.getFreeHeap(); } #endif