/* 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++)
/*?
* 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.
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;
|| 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);
}
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];
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)
{
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;
}
}
- if (vec_len (vlib_mains) > 1)
+ if (vlib_get_n_threads () > 1)
{
vlib_worker_thread_t *w = vlib_worker_threads + j;
if (j > 0)
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);
}
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;