Minor adjustments

This commit is contained in:
@CarlWachter 2024-01-24 21:21:59 +01:00 committed by Lars Wilko Sentse
parent ff1cbf8473
commit 4904098944
2 changed files with 2 additions and 18 deletions

View File

@ -11,7 +11,7 @@
#include <sta/config.hpp> #include <sta/config.hpp>
#ifdef STA_DEBUGGING_ENABLED #ifdef STA_DEBUGGING_ENABLED_NP
#include <sta/debug/debug.hpp> #include <sta/debug/debug.hpp>

View File

@ -7,7 +7,7 @@
#include <sta/rtos/debug/heap_stats.hpp> #include <sta/rtos/debug/heap_stats.hpp>
#ifdef STA_DEBUGGING_ENABLED #ifdef STA_DEBUGGING_ENABLED_NP
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include <cmsis_os2.h> #include <cmsis_os2.h>
@ -19,40 +19,24 @@ namespace sta
{ {
size_t getAvailableHeapSpace() size_t getAvailableHeapSpace()
{ {
xHeapStats stats;
vPortGetHeapStats(&stats);
return stats.xAvailableHeapSpaceInBytes; return stats.xAvailableHeapSpaceInBytes;
} }
size_t getNumAllocs() size_t getNumAllocs()
{ {
xHeapStats stats;
vPortGetHeapStats(&stats);
return stats.xNumberOfSuccessfulAllocations; return stats.xNumberOfSuccessfulAllocations;
} }
size_t getNumFrees() size_t getNumFrees()
{ {
xHeapStats stats;
vPortGetHeapStats(&stats);
return stats.xNumberOfSuccessfulFrees; return stats.xNumberOfSuccessfulFrees;
} }
void printHeapStats() void printHeapStats()
{ {
xHeapStats stats;
vPortGetHeapStats(&stats);
STA_DEBUG_PRINTF(
"[HEAP STATS] \n Available: %d\n Lowest: %d\n Mallocs: %d\n Frees: %d",
stats.xAvailableHeapSpaceInBytes,
stats.xMinimumEverFreeBytesRemaining,
stats.xNumberOfSuccessfulAllocations,
stats.xNumberOfSuccessfulFrees
);
} }
} // namespace rtos } // namespace rtos
} // namespace sta } // namespace sta