mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-06 11:07:34 +00:00
Added updated heap stats
This commit is contained in:
@@ -12,20 +12,52 @@
|
||||
#include <FreeRTOS.h>
|
||||
#include <cmsis_os2.h>
|
||||
|
||||
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 sta
|
||||
{
|
||||
namespace rtos
|
||||
{
|
||||
size_t getAvailableHeapSpace()
|
||||
{
|
||||
xHeapStats stats;
|
||||
vPortGetHeapStats(&stats);
|
||||
|
||||
return stats.xAvailableHeapSpaceInBytes;
|
||||
}
|
||||
|
||||
size_t getNumAllocs()
|
||||
{
|
||||
xHeapStats stats;
|
||||
vPortGetHeapStats(&stats);
|
||||
|
||||
return stats.xNumberOfSuccessfulAllocations;
|
||||
}
|
||||
|
||||
size_t getNumFrees()
|
||||
{
|
||||
xHeapStats stats;
|
||||
vPortGetHeapStats(&stats);
|
||||
|
||||
return stats.xNumberOfSuccessfulFrees;
|
||||
}
|
||||
|
||||
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 sta
|
||||
|
||||
#endif // STA_DEBUGGING_ENABLED
|
||||
|
||||
|
||||
|
||||
|
@@ -78,7 +78,7 @@ namespace sta
|
||||
return terminate_;
|
||||
}
|
||||
|
||||
void RtosThread::terminate()
|
||||
void RtosThread::kill()
|
||||
{
|
||||
STA_ASSERT(handle_.get() != nullptr);
|
||||
osThreadTerminate(handle_.get());
|
||||
|
Reference in New Issue
Block a user