aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/cli.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-16 21:15:44 +0200
committerDamjan Marion <damarion@cisco.com>2020-09-16 21:19:51 +0200
commit57d1ec00a953620ff59242db07c369843bb16820 (patch)
tree7badde39e261f24c7a69221a87843a9acf030413 /src/vlib/cli.c
parent33ce5e568f8b4fb1254bf5ee32865e9443c0185a (diff)
vppinfra: introduce clib_mem_main
To hold more data later... Type: improvement Change-Id: I4006d22dcacd788988c4907f2c263fd4e4a9d398 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/cli.c')
-rw-r--r--src/vlib/cli.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index 2697c0ae083..2bdc98c71ca 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -739,6 +739,7 @@ static clib_error_t *
show_memory_usage (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
+ clib_mem_main_t *mm = &clib_mem_main;
int verbose __attribute__ ((unused)) = 0;
int api_segment = 0, stats_segment = 0, main_heap = 0, numa_heaps = 0;
clib_error_t *error;
@@ -826,7 +827,7 @@ show_memory_usage (vlib_main_t * vm,
({
struct dlmallinfo mi;
void *mspace;
- mspace = clib_per_cpu_mheaps[index];
+ mspace = mm->per_cpu_mheaps[index];
mi = mspace_mallinfo (mspace);
vlib_cli_output (vm, "%sThread %d %s\n", index ? "\n":"", index,
@@ -835,7 +836,7 @@ show_memory_usage (vlib_main_t * vm,
pointer_to_uword (mspace_least_addr(mspace)),
mi.arena);
vlib_cli_output (vm, " %U\n", format_mheap,
- clib_per_cpu_mheaps[index],
+ mm->per_cpu_mheaps[index],
verbose);
index++;
}));
@@ -849,17 +850,17 @@ show_memory_usage (vlib_main_t * vm,
struct dlmallinfo mi;
void *mspace;
- for (i = 0; i < ARRAY_LEN (clib_per_numa_mheaps); i++)
+ for (i = 0; i < ARRAY_LEN (mm->per_numa_mheaps); i++)
{
- if (clib_per_numa_mheaps[i] == 0)
+ if (mm->per_numa_mheaps[i] == 0)
continue;
- if (clib_per_numa_mheaps[i] == clib_per_cpu_mheaps[i])
+ if (mm->per_numa_mheaps[i] == mm->per_cpu_mheaps[i])
{
vlib_cli_output (vm, "Numa %d uses the main heap...", i);
continue;
}
was_enabled = clib_mem_trace_enable_disable (0);
- mspace = clib_per_numa_mheaps[i];
+ mspace = mm->per_numa_mheaps[i];
mi = mspace_mallinfo (mspace);
vlib_cli_output (vm, "Numa %d:", i);
@@ -867,7 +868,7 @@ show_memory_usage (vlib_main_t * vm,
pointer_to_uword (mspace_least_addr (mspace)),
mi.arena);
vlib_cli_output (vm, " %U\n", format_mheap,
- clib_per_numa_mheaps[index], verbose);
+ mm->per_numa_mheaps[index], verbose);
}
}
}
@@ -921,6 +922,7 @@ enable_disable_memory_trace (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
+ clib_mem_main_t *mm = &clib_mem_main;
unformat_input_t _line_input, *line_input = &_line_input;
int enable = 1;
int api_segment = 0;
@@ -1003,15 +1005,15 @@ enable_disable_memory_trace (vlib_main_t * vm,
if (numa_id != ~0)
{
- if (numa_id >= ARRAY_LEN (clib_per_numa_mheaps))
+ if (numa_id >= ARRAY_LEN (mm->per_numa_mheaps))
return clib_error_return (0, "Numa %d out of range", numa_id);
- if (clib_per_numa_mheaps[numa_id] == 0)
+ if (mm->per_numa_mheaps[numa_id] == 0)
return clib_error_return (0, "Numa %d heap not active", numa_id);
- if (clib_per_numa_mheaps[numa_id] == clib_mem_get_heap ())
+ if (mm->per_numa_mheaps[numa_id] == clib_mem_get_heap ())
return clib_error_return (0, "Numa %d uses the main heap...",
numa_id);
- current_traced_heap = clib_per_numa_mheaps[numa_id];
+ current_traced_heap = mm->per_numa_mheaps[numa_id];
oldheap = clib_mem_set_heap (current_traced_heap);
clib_mem_trace (1);
clib_mem_set_heap (oldheap);