Skip to content

Commit 14aa57f

Browse files
committed
stats - Added stats for reserved heap space for consistency
1 parent b6e8f44 commit 14aa57f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

platform/mbed_alloc_wrappers.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0};
5757
void mbed_stats_heap_get(mbed_stats_heap_t *stats)
5858
{
5959
#ifdef MBED_HEAP_STATS_ENABLED
60+
extern uint32_t mbed_heap_size;
61+
heap_stats.reserved_size = mbed_heap_size;
62+
6063
malloc_stats_mutex->lock();
6164
memcpy(stats, &heap_stats, sizeof(mbed_stats_heap_t));
6265
malloc_stats_mutex->unlock();

platform/mbed_stats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ typedef struct {
2828
uint32_t current_size; /**< Bytes allocated currently. */
2929
uint32_t max_size; /**< Max bytes allocated at a given time. */
3030
uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */
31+
uint32_t reserved_size; /**< Current number of bytes allocated for the heap. */
3132
uint32_t alloc_cnt; /**< Current number of allocations. */
3233
uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
3334
} mbed_stats_heap_t;

0 commit comments

Comments
 (0)