From bfa75d6b922ee15d2f0d00999fd36b03a85eda8c Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Tue, 6 Oct 2020 17:46:06 +0200 Subject: vppinfra: add heap header in front of dlmalloc space This patch adds smal header in front of dlmalloc space, and it stores some additional information about the heap. Immediate benefit of this patch is that we know the underlying page size si we can display heap page statistics / real memory usage. Type: improvement Change-Id: Ibd6989cc2f2f64630ab08734c9552e15029c5f3f Signed-off-by: Damjan Marion --- src/vlib/cli.c | 11 ----------- src/vlib/threads.c | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) (limited to 'src/vlib') diff --git a/src/vlib/cli.c b/src/vlib/cli.c index c485f967bcd..a88bd3a62f6 100644 --- a/src/vlib/cli.c +++ b/src/vlib/cli.c @@ -827,13 +827,8 @@ show_memory_usage (vlib_main_t * vm, /* *INDENT-OFF* */ foreach_vlib_main ( ({ - void *heap = mm->per_cpu_mheaps[index]; - vlib_cli_output (vm, "%sThread %d %s\n", index ? "\n":"", index, vlib_worker_threads[index].name); - vlib_cli_output (vm, " %U\n", format_page_map, - pointer_to_uword (clib_mem_get_heap_base(heap)), - clib_mem_get_heap_size (heap)); vlib_cli_output (vm, " %U\n", format_clib_mem_heap, mm->per_cpu_mheaps[index], verbose); @@ -846,8 +841,6 @@ show_memory_usage (vlib_main_t * vm, } if (numa_heaps) { - void *heap; - for (i = 0; i < ARRAY_LEN (mm->per_numa_mheaps); i++) { if (mm->per_numa_mheaps[i] == 0) @@ -858,12 +851,8 @@ show_memory_usage (vlib_main_t * vm, continue; } was_enabled = clib_mem_trace_enable_disable (0); - heap = mm->per_numa_mheaps[i]; vlib_cli_output (vm, "Numa %d:", i); - vlib_cli_output (vm, " %U\n", format_page_map, - pointer_to_uword (clib_mem_get_heap_base (heap)), - clib_mem_get_heap_size (heap)); vlib_cli_output (vm, " %U\n", format_clib_mem_heap, mm->per_numa_mheaps[index], verbose); } diff --git a/src/vlib/threads.c b/src/vlib/threads.c index 64af8a0d617..749770f9597 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -685,7 +685,7 @@ start_workers (vlib_main_t * vm) vlib_node_runtime_t *rt; u32 n_vlib_mains = tm->n_vlib_mains; u32 worker_thread_index; - u8 *main_heap = clib_mem_get_per_cpu_heap (); + clib_mem_heap_t *main_heap = clib_mem_get_per_cpu_heap (); vec_reset_length (vlib_worker_threads); -- cgit 1.2.3-korg