mirror of https://github.com/ARMmbed/mbed-os.git
stats - Added stats for reserved heap space for consistency
parent
b6e8f44c0d
commit
14aa57f81c
|
@ -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)
|
void mbed_stats_heap_get(mbed_stats_heap_t *stats)
|
||||||
{
|
{
|
||||||
#ifdef MBED_HEAP_STATS_ENABLED
|
#ifdef MBED_HEAP_STATS_ENABLED
|
||||||
|
extern uint32_t mbed_heap_size;
|
||||||
|
heap_stats.reserved_size = mbed_heap_size;
|
||||||
|
|
||||||
malloc_stats_mutex->lock();
|
malloc_stats_mutex->lock();
|
||||||
memcpy(stats, &heap_stats, sizeof(mbed_stats_heap_t));
|
memcpy(stats, &heap_stats, sizeof(mbed_stats_heap_t));
|
||||||
malloc_stats_mutex->unlock();
|
malloc_stats_mutex->unlock();
|
||||||
|
|
|
@ -28,6 +28,7 @@ typedef struct {
|
||||||
uint32_t current_size; /**< Bytes allocated currently. */
|
uint32_t current_size; /**< Bytes allocated currently. */
|
||||||
uint32_t max_size; /**< Max bytes allocated at a given time. */
|
uint32_t max_size; /**< Max bytes allocated at a given time. */
|
||||||
uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */
|
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_cnt; /**< Current number of allocations. */
|
||||||
uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
|
uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
|
||||||
} mbed_stats_heap_t;
|
} mbed_stats_heap_t;
|
||||||
|
|
Loading…
Reference in New Issue