aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/svm/fifo_segment.c40
-rw-r--r--src/svm/ssvm.c1
-rw-r--r--src/vnet/session/segment_manager.c23
3 files changed, 39 insertions, 25 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 04b3f5aadbe..6d62d37933b 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -824,21 +824,45 @@ format_fifo_segment_type (u8 * s, va_list * args)
u8 *
format_fifo_segment (u8 * s, va_list * args)
{
- fifo_segment_t *sp = va_arg (*args, fifo_segment_t *);
+ fifo_segment_t *fs = va_arg (*args, fifo_segment_t *);
int verbose __attribute__ ((unused)) = va_arg (*args, int);
- fifo_segment_header_t *fsh = sp->h;
- u32 count, indent;
+ fifo_segment_header_t *fsh;
svm_fifo_chunk_t *c;
+ u32 count, indent;
+ u32 active_fifos;
+ u32 free_fifos;
+ char *address;
+ size_t size;
int i;
indent = format_get_indent (s) + 2;
#if USE_DLMALLOC == 0
s = format (s, "%U segment heap: %U\n", format_white_space, indent,
- format_mheap, svm_fifo_segment_heap (sp), verbose);
+ format_mheap, svm_fifo_segment_heap (fs), verbose);
s = format (s, "%U segment has %u active fifos\n",
- format_white_space, indent, fifo_segment_num_fifos (sp));
+ format_white_space, indent, fifo_segment_num_fifos (fs));
#endif
+ if (fs == 0)
+ {
+ s = format (s, "%-15s%15s%15s%15s%15s%15s", "Name", "Type",
+ "HeapSize (M)", "ActiveFifos", "FreeFifos", "Address");
+ return s;
+ }
+
+ fsh = fs->h;
+ fifo_segment_info (fs, &address, &size);
+ active_fifos = fifo_segment_num_fifos (fs);
+ free_fifos = fifo_segment_num_free_fifos (fs);
+
+ s = format (s, "%-15v%15U%15llu%15u%15u%15llx", ssvm_name (&fs->ssvm),
+ format_fifo_segment_type, fs, size >> 20ULL, active_fifos,
+ free_fifos, address);
+
+ if (!verbose)
+ return s;
+
+ s = format (s, "\n");
for (i = 0; i < vec_len (fsh->free_chunks); i++)
{
c = fsh->free_chunks[i];
@@ -851,11 +875,13 @@ format_fifo_segment (u8 * s, va_list * args)
count++;
}
- s = format (s, "%U%-5u Kb: %u free",
- format_white_space, indent + 2,
+ s = format (s, "%U%-5u Kb: %u free", format_white_space, indent + 2,
1 << (i + max_log2 (FIFO_SEGMENT_MIN_FIFO_SIZE) - 10),
count);
}
+ s = format (s, "%Ufree bytes %U", format_white_space, indent + 2,
+ format_memory_size, fsh->n_free_bytes);
+
return s;
}
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c
index 2a6e6bf78da..7901db26b4b 100644
--- a/src/svm/ssvm.c
+++ b/src/svm/ssvm.c
@@ -385,6 +385,7 @@ ssvm_master_init_private (ssvm_private_t * ssvm)
sh->heap = heap;
sh->ssvm_va = pointer_to_uword (heap);
sh->type = SSVM_SEGMENT_PRIVATE;
+ sh->name = ssvm->name;
return 0;
}
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index f53026c8778..c0785695d4f 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -131,7 +131,7 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size)
}
}
else
- seg_name = format (0, "%s%c", "process-private-segment", 0);
+ seg_name = format (0, "%s%c", "process-private", 0);
fs->ssvm.ssvm_size = segment_size;
fs->ssvm.name = seg_name;
@@ -827,13 +827,9 @@ segment_manager_show_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
segment_manager_main_t *smm = &sm_main;
- fifo_segment_t *seg;
- segment_manager_t *sm;
u8 show_segments = 0, verbose = 0;
- char *address;
- size_t size;
- u32 active_fifos;
- u32 free_fifos;
+ segment_manager_t *sm;
+ fifo_segment_t *seg;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -862,21 +858,12 @@ segment_manager_show_fn (vlib_main_t * vm, unformat_input_t * input,
}
if (show_segments)
{
- vlib_cli_output (vm, "%-15s%15s%15s%15s%15s%15s", "Name", "Type",
- "HeapSize (M)", "ActiveFifos", "FreeFifos", "Address");
+ vlib_cli_output (vm, "%U", format_fifo_segment, 0, verbose);
/* *INDENT-OFF* */
pool_foreach (sm, smm->segment_managers, ({
segment_manager_foreach_segment_w_lock (seg, sm, ({
- fifo_segment_info (seg, &address, &size);
- active_fifos = fifo_segment_num_fifos (seg);
- free_fifos = fifo_segment_num_free_fifos (seg);
- vlib_cli_output (vm, "%-15v%15U%15llu%15u%15u%15llx",
- ssvm_name (&seg->ssvm), format_fifo_segment_type,
- seg, size >> 20ULL, active_fifos, free_fifos,
- address);
- if (verbose)
- vlib_cli_output (vm, "%U", format_fifo_segment, seg, verbose);
+ vlib_cli_output (vm, "%U", format_fifo_segment, seg, verbose);
}));
}));
/* *INDENT-ON* */