summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/mem_dlmalloc.c15
-rw-r--r--src/vppinfra/mheap.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c
index 99f1c04f3eb..7a53a8bb43b 100644
--- a/src/vppinfra/mem_dlmalloc.c
+++ b/src/vppinfra/mem_dlmalloc.c
@@ -383,6 +383,21 @@ clib_mem_usage (clib_mem_usage_t * u)
clib_warning ("unimp");
}
+void
+mheap_usage (void *heap, clib_mem_usage_t * usage)
+{
+ struct dlmallinfo mi = mspace_mallinfo (heap);
+
+ /* TODO: Fill in some more values */
+ usage->object_count = 0;
+ usage->bytes_total = mi.arena;
+ usage->bytes_overhead = 0;
+ usage->bytes_max = 0;
+ usage->bytes_used = mi.uordblks;
+ usage->bytes_free = mi.fordblks;
+ usage->bytes_free_reclaimed = 0;
+}
+
/* Call serial number for debugger breakpoints. */
uword clib_mem_validate_serial = 0;
diff --git a/src/vppinfra/mheap.h b/src/vppinfra/mheap.h
index afc2bf485b5..61d262c5f33 100644
--- a/src/vppinfra/mheap.h
+++ b/src/vppinfra/mheap.h
@@ -90,6 +90,7 @@ int test_mheap_main (unformat_input_t * input);
/* Format mheap data structures as string. */
u8 *format_mheap (u8 * s, va_list * va);
void *mheap_alloc_with_lock (void *memory, uword size, int locked);
+void mheap_usage (void *v, clib_mem_usage_t * usage);
#endif /* USE_DLMALLOC */