stats: memory heap counters
- Add counters for the main-heap
- Add additional counters per heap:
STAT_MEM_TOTAL
STAT_MEM_USED,
STAT_MEM_FREE,
STAT_MEM_USED_MMAP,
STAT_MEM_TOTAL_ALLOC,
STAT_MEM_FREE_CHUNKS,
STAT_MEM_RELEASABLE,
The per-heap counters are organised as a two dimensional vector.
total, used and free are directly available via symlinks.
vpp_get_stats ls "^/mem/"
/mem/stat segment
/mem/stat segment/total
/mem/stat segment/used
/mem/stat segment/free
/mem/main heap
/mem/main heap/total
/mem/main heap/used
/mem/main heap/free
vpp_get_stats dump "^/mem/main\ heap$"
[0 @ 0]: 1073741776 packets /mem/main heap
[1 @ 0]: 91586688 packets /mem/main heap
[2 @ 0]: 982155088 packets /mem/main heap
[3 @ 0]: 0 packets /mem/main heap
[4 @ 0]: 1073741776 packets /mem/main heap
[5 @ 0]: 433 packets /mem/main heap
[6 @ 0]: 981708688 packets /mem/main heap
Type: feature
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I36725dde3b4b3befd27a8b4d3ba931f2d3b627cc
diff --git a/src/vlib/stat_weak_inlines.h b/src/vlib/stat_weak_inlines.h
index a1311e8..a68566d 100644
--- a/src/vlib/stat_weak_inlines.h
+++ b/src/vlib/stat_weak_inlines.h
@@ -63,4 +63,10 @@
{
}
+void vlib_stats_register_mem_heap (void *) __attribute__ ((weak));
+void
+vlib_stats_register_mem_heap (void *notused)
+{
+}
+
#endif
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 7c796f5..499a626 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -654,6 +654,7 @@
u32 n_vlib_mains = tm->n_vlib_mains;
u32 worker_thread_index;
clib_mem_heap_t *main_heap = clib_mem_get_per_cpu_heap ();
+ vlib_stats_register_mem_heap (main_heap);
vec_reset_length (vlib_worker_threads);