stats - Added stats for reserved heap space for consistency

pull/3141/head
Christopher Haster 2016-10-26 17:49:29 -05:00
parent b6e8f44c0d
commit 14aa57f81c
2 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,9 @@ static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0};
void mbed_stats_heap_get(mbed_stats_heap_t *stats)
{
#ifdef MBED_HEAP_STATS_ENABLED
extern uint32_t mbed_heap_size;
heap_stats.reserved_size = mbed_heap_size;
malloc_stats_mutex->lock();
memcpy(stats, &heap_stats, sizeof(mbed_stats_heap_t));
malloc_stats_mutex->unlock();

View File

@ -28,6 +28,7 @@ typedef struct {
uint32_t current_size; /**< Bytes allocated currently. */
uint32_t max_size; /**< Max bytes allocated at a given time. */
uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */
uint32_t reserved_size; /**< Current number of bytes allocated for the heap. */
uint32_t alloc_cnt; /**< Current number of allocations. */
uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
} mbed_stats_heap_t;