mm_heap: dump and stat the mm_heapend node also
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
4b8db6f22c
commit
372fba70bb
@ -94,6 +94,7 @@ void mm_foreach(FAR struct mm_heap_s *heap, mm_node_handler_t handler,
|
|||||||
minfo("region=%d node=%p heapend=%p\n",
|
minfo("region=%d node=%p heapend=%p\n",
|
||||||
region, node, heap->mm_heapend[region]);
|
region, node, heap->mm_heapend[region]);
|
||||||
DEBUGASSERT(node == heap->mm_heapend[region]);
|
DEBUGASSERT(node == heap->mm_heapend[region]);
|
||||||
|
handler(node, arg);
|
||||||
|
|
||||||
mm_unlock(heap);
|
mm_unlock(heap);
|
||||||
}
|
}
|
||||||
|
@ -140,11 +140,6 @@ struct mallinfo mm_mallinfo(FAR struct mm_heap_s *heap)
|
|||||||
struct mallinfo info;
|
struct mallinfo info;
|
||||||
#if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
|
#if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
|
||||||
struct mallinfo poolinfo;
|
struct mallinfo poolinfo;
|
||||||
#endif
|
|
||||||
#if CONFIG_MM_REGIONS > 1
|
|
||||||
int region = heap->mm_nregions;
|
|
||||||
#else
|
|
||||||
# define region 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
@ -158,15 +153,6 @@ struct mallinfo mm_mallinfo(FAR struct mm_heap_s *heap)
|
|||||||
info.fordblks += poolinfo.fordblks;
|
info.fordblks += poolinfo.fordblks;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Account for the heap->mm_heapend[region] node overhead and the
|
|
||||||
* heap->mm_heapstart[region]->preceding:
|
|
||||||
* heap->mm_heapend[region] overhead size = OVERHEAD_MM_ALLOCNODE
|
|
||||||
* heap->mm_heapstart[region]->preceding size = sizeof(mmsize_t)
|
|
||||||
* and SIZEOF_MM_ALLOCNODE = OVERHEAD_MM_ALLOCNODE + sizeof(mmsize_t).
|
|
||||||
*/
|
|
||||||
|
|
||||||
info.uordblks += region * SIZEOF_MM_ALLOCNODE;
|
|
||||||
|
|
||||||
DEBUGASSERT((size_t)info.uordblks + info.fordblks == heap->mm_heapsize);
|
DEBUGASSERT((size_t)info.uordblks + info.fordblks == heap->mm_heapsize);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
Loading…
Reference in New Issue
Block a user