- u32 threads_to_serialize;
-
- vec_reset_length (node_dups);
-
- if (vec_len (stat_vms) == 0)
- {
- for (i = 0; i < vec_len (vlib_mains); i++)
- {
- stat_vm = vlib_mains[i];
- if (stat_vm)
- vec_add1 (stat_vms, stat_vm);
- }
- }
-
- threads_to_serialize = clib_min (max_threads, vec_len (stat_vms));
-
- /*
- * Barrier sync across stats scraping.
- * Otherwise, the counts will be grossly inaccurate.
- */
- vl_msg_api_barrier_sync ();
-
- for (j = 0; j < threads_to_serialize; j++)
- {
- stat_vm = stat_vms[j];
- nm = &stat_vm->node_main;
-
- if (include_stats)
- {
- for (i = 0; i < vec_len (nm->nodes); i++)
- {
- n = nm->nodes[i];
- vlib_node_sync_stats (stat_vm, n);
- }
- }
-
- nodes = vec_dup (nm->nodes);
-
- vec_add1 (node_dups, nodes);
- }
- vl_msg_api_barrier_release ();