X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fnode_cli.c;h=77fef775a2fb90c3b31cf5ce4ab725f77454cf7f;hb=2f89f3ae1d0dd11b019d8ba0badf3133a9837dd9;hp=39fca6ea5824240ad6f9f73b9409fcc661b9b830;hpb=156158f06d725d9301940783dff8ccdcc4a01b9b;p=vpp.git diff --git a/src/vlib/node_cli.c b/src/vlib/node_cli.c index 39fca6ea582..77fef775a2f 100644 --- a/src/vlib/node_cli.c +++ b/src/vlib/node_cli.c @@ -210,14 +210,14 @@ show_node_graphviz (vlib_main_t * vm, /* Updating the stats for multithreaded use cases. * We need to dup the nodes to sum the stats from all threads.*/ nodes = vec_dup (nm->nodes); - for (i = 1; i < vec_len (vlib_mains); i++) + for (i = 1; i < vlib_get_n_threads (); i++) { vlib_node_main_t *nm_clone; vlib_main_t *vm_clone; vlib_node_runtime_t *rt; vlib_node_t *n; - vm_clone = vlib_mains[i]; + vm_clone = vlib_get_main_by_index (i); nm_clone = &vm_clone->node_main; for (j = 0; j < vec_len (nm_clone->nodes); j++) @@ -310,7 +310,7 @@ show_node_graphviz (vlib_main_t * vm, /*? * Dump dot files data to draw a graph of all the nodes. * If the argument 'filter' is provided, only the active nodes (since the last - * "clear run" comand) are selected and they are scaled and colored according + * "clear run" command) are selected and they are scaled and colored according * to their utilization. You can choose to filter nodes that are called, * nodes that receive vectors or both (default). * The 'file' option allows to save data in a temp file. @@ -498,7 +498,6 @@ show_node_runtime (vlib_main_t * vm, uword i, j; f64 dt; u64 n_input, n_output, n_drop, n_punt; - u64 n_internal_vectors, n_internal_calls; u64 n_clocks, l, v, c, d; int brief = 1; int summary = 0; @@ -516,9 +515,9 @@ show_node_runtime (vlib_main_t * vm, || unformat (input, "su")) summary = 1; - for (i = 0; i < vec_len (vlib_mains); i++) + for (i = 0; i < vlib_get_n_threads (); i++) { - stat_vm = vlib_mains[i]; + stat_vm = vlib_get_main_by_index (i); if (stat_vm) vec_add1 (stat_vms, stat_vm); } @@ -557,7 +556,6 @@ show_node_runtime (vlib_main_t * vm, vec_sort_with_function (nodes, node_cmp); n_input = n_output = n_drop = n_punt = n_clocks = 0; - n_internal_vectors = n_internal_calls = 0; for (i = 0; i < vec_len (nodes); i++) { n = nodes[i]; @@ -566,7 +564,6 @@ show_node_runtime (vlib_main_t * vm, n_clocks += l; v = n->stats_total.vectors - n->stats_last_clear.vectors; - c = n->stats_total.calls - n->stats_last_clear.calls; switch (n->type) { @@ -577,11 +574,6 @@ show_node_runtime (vlib_main_t * vm, n_output += (n->flags & VLIB_NODE_FLAG_IS_OUTPUT) ? v : 0; n_drop += (n->flags & VLIB_NODE_FLAG_IS_DROP) ? v : 0; n_punt += (n->flags & VLIB_NODE_FLAG_IS_PUNT) ? v : 0; - if (!(n->flags & VLIB_NODE_FLAG_IS_OUTPUT)) - { - n_internal_vectors += v; - n_internal_calls += c; - } if (n->flags & VLIB_NODE_FLAG_IS_HANDOFF) n_input += v; break; @@ -592,7 +584,7 @@ show_node_runtime (vlib_main_t * vm, } } - if (vec_len (vlib_mains) > 1) + if (vlib_get_n_threads () > 1) { vlib_worker_thread_t *w = vlib_worker_threads + j; if (j > 0) @@ -665,9 +657,9 @@ clear_node_runtime (vlib_main_t * vm, vlib_main_t **stat_vms = 0, *stat_vm; vlib_node_runtime_t *r; - for (i = 0; i < vec_len (vlib_mains); i++) + for (i = 0; i < vlib_get_n_threads (); i++) { - stat_vm = vlib_mains[i]; + stat_vm = vlib_get_main_by_index (i); if (stat_vm) vec_add1 (stat_vms, stat_vm); } @@ -848,10 +840,10 @@ show_node (vlib_main_t * vm, unformat_input_t * input, 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++) + for (i = 0; i < vlib_get_n_threads (); i++) { - n = vlib_get_node (vlib_mains[i], node_index); - vlib_node_sync_stats (vlib_mains[i], n); + n = vlib_get_node (vlib_get_main_by_index (i), node_index); + vlib_node_sync_stats (vlib_get_main_by_index (i), n); cl = n->stats_total.clocks - n->stats_last_clear.clocks; ca = n->stats_total.calls - n->stats_last_clear.calls;