aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/node_cli.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-03-12 23:26:11 +0000
committerDave Barach <openvpp@barachs.net>2020-03-13 13:56:40 +0000
commit178ecc0a9a6a4bb8b121d81b25159c67b0fb7061 (patch)
treef917ee1408df7af37215ea19e923f21384df314d /src/vlib/node_cli.c
parent2b2a40cf3fe88dd25a9d3511bfa1628d9ad025a6 (diff)
vlib: add verbose sh node option
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I915dace4afe07ac3281f248ef7468fa5247c9668
Diffstat (limited to 'src/vlib/node_cli.c')
-rw-r--r--src/vlib/node_cli.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/vlib/node_cli.c b/src/vlib/node_cli.c
index 1ba0575f182..0738bc959ce 100644
--- a/src/vlib/node_cli.c
+++ b/src/vlib/node_cli.c
@@ -550,9 +550,10 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
vlib_node_main_t *nm = &vm->node_main;
vlib_node_t *n;
u8 *s = 0, *s2 = 0;
- u32 i, node_index = ~0;
+ u32 i, node_index = ~0, verbose = 0;
char *type_str;
u8 valid_node_name = 0;
+ u64 cl, ca, v;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -561,6 +562,8 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
{
if (unformat (line_input, "index %u", &node_index))
;
+ else if (unformat (line_input, "verbose"))
+ verbose = 1;
else
if (unformat (line_input, "%U", unformat_vlib_node, vm, &node_index))
valid_node_name = 1;
@@ -642,7 +645,7 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
s = format (s, "\n %10s %10s %=30s %8s",
"next-index", "node-index", "Node", "Vectors");
- s = format (s, "\n %=10u %=10u %-30v %=8llu", i, n->next_nodes[i],
+ s = format (s, "\n %=10u %=10u %=30v %=8llu", i, n->next_nodes[i],
pn->name, vec_elt (n->n_vectors_by_next_node, i));
}
@@ -669,10 +672,32 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
s = format (s, "\n none");
vlib_cli_output (vm, "\n known previous nodes:%v\n", s);
vec_reset_length (s);
+ vec_free (s2);
}
+ if (!verbose)
+ goto done;
+
+ s = format (s, "\n%8s %=12s %=12s %=12s %=12s %=12s\n", "Thread", "Calls",
+ "Clocks", "Vectors", "Max Clock", "Max Vectors");
+ for (i = 0; i < vec_len (vlib_mains); i++)
+ {
+ n = vlib_get_node (vlib_mains[i], node_index);
+ vlib_node_sync_stats (vlib_mains[i], n);
+
+ cl = n->stats_total.clocks - n->stats_last_clear.clocks;
+ ca = n->stats_total.calls - n->stats_last_clear.calls;
+ v = n->stats_total.vectors - n->stats_last_clear.vectors;
+
+ s = format (s, "%=8u %=12lu %=12lu %=12lu %=12u %=12u\n", i, ca, cl, v,
+ n->stats_total.max_clock, n->stats_total.max_clock_n);
+ }
+
+ vlib_cli_output (vm, "%v", s);
+
+done:
+
vec_free (s);
- vec_free (s2);
return 0;
}