Adds a memory_stats metrics component - #152
Conversation
| stats->free_bytes = (uint32_t)heap_stats.xAvailableHeapSpaceInBytes; | ||
| stats->min_free_bytes = (uint32_t)heap_stats.xMinimumEverFreeBytesRemaining; | ||
| stats->largest_free_block = | ||
| (uint32_t)heap_stats.xSizeOfLargestFreeBlockInBytes; |
There was a problem hiding this comment.
I think having xNumberOfSuccessfulAllocations and xNumberOfSuccessfulFrees would be very beneficial as well. As it can help us determine if there is a leak somewhere 🥬
There was a problem hiding this comment.
We should also probably update the bm_posix.c file to make sure bm_sbc apps do not break.
matt001k
left a comment
There was a problem hiding this comment.
I am a bit on the fence on whether or not this should be something that bm_core handles or bm_protocol, what was the rational of placing this here rather than bm_protocol?
Also @victorsowa12 what are your thoughts on where the memory statistics should live?
|
I put the PR in bm_core following the ADIN component, but ADIN has its own reason to live here since core hardcodes the ADIN2111 as the network device. For memory, bm_core makes me add a bm_heap_stats() accessor to bm_os/bm_freertos; in bm_protocol I'd just call vPortGetHeapStats() directly. The one real tradeoff is that core lets memory_metrics self-register once in bristlemouth_init, whereas in bm_protocol I'd wire it into each app_main. I'm leaning bm_protocol so I am happy to move it! @matt001k @victorsowa12 |
|
@Davidbick personally I am ok with either direction you want to go. |
|
Ended up going with bm_protocol: bristlemouth/bm_protocol#416 |
What changed?
memory_statsmetrics component to the generic metrics registry, reporting FreeRTOS heap health (heap_free,heap_min_free,heap_largest_block, in bytes).How does it make Bristlemouth better?
heap_min_freeis a low-water leak signal,heap_largest_blockcatches fragmentation.Where should reviewers focus?
HeapStats_tfields, free + low-water + largest-block.Checklist