From 4287edfaf94ba7fab4bdf305581b535892d569e2 Mon Sep 17 00:00:00 2001 From: Tomas Galbicka Date: Mon, 11 Nov 2024 15:09:47 +0100 Subject: [PATCH] Heap: add new API to reset xMinimumEverFreeBytesRemaining. This commit adds new API functionality to reset xMinimumEverFreeBytesRemaining. This functionality provides ability to get heap statistics during a particular period of time. Signed-off-by: Tomas Galbicka --- include/portable.h | 1 + portable/MemMang/heap_4.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/portable.h b/include/portable.h index 1b088b4278a..68e11e79311 100644 --- a/include/portable.h +++ b/include/portable.h @@ -193,6 +193,7 @@ void vPortFree( void * pv ) PRIVILEGED_FUNCTION; void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; +void xPortResetHeapMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; #if ( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 ) void * pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION; diff --git a/portable/MemMang/heap_4.c b/portable/MemMang/heap_4.c index f3cab000d0f..acb3347574d 100644 --- a/portable/MemMang/heap_4.c +++ b/portable/MemMang/heap_4.c @@ -422,6 +422,12 @@ size_t xPortGetMinimumEverFreeHeapSize( void ) } /*-----------------------------------------------------------*/ +void xPortResetHeapMinimumEverFreeHeapSize( void ) +{ + xMinimumEverFreeBytesRemaining = xFreeBytesRemaining; +} +/*-----------------------------------------------------------*/ + void vPortInitialiseBlocks( void ) { /* This just exists to keep the linker quiet. */