From 2c768db542e109c49fe4f4130ac4288c3b10e0d7 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Thu, 19 May 2022 14:53:02 +0300 Subject: [PATCH] bdk: heap: add nodes info --- bdk/mem/heap.c | 4 ++++ bdk/mem/heap.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/bdk/mem/heap.c b/bdk/mem/heap.c index 1042357..267fe9c 100644 --- a/bdk/mem/heap.c +++ b/bdk/mem/heap.c @@ -172,7 +172,10 @@ void heap_monitor(heap_monitor_t *mon, bool print_node_stats) while (true) { if (node->used) + { + mon->nodes_used++; mon->used += node->size + sizeof(hnode_t); + } else mon->total += node->size + sizeof(hnode_t); @@ -188,4 +191,5 @@ void heap_monitor(heap_monitor_t *mon, bool print_node_stats) break; } mon->total += mon->used; + mon->nodes_total = count; } diff --git a/bdk/mem/heap.h b/bdk/mem/heap.h index 63ad1fe..6b0c17a 100644 --- a/bdk/mem/heap.h +++ b/bdk/mem/heap.h @@ -40,6 +40,8 @@ typedef struct { u32 total; u32 used; + u32 nodes_total; + u32 nodes_used; } heap_monitor_t; void heap_init(void *base);