aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/tracedump
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-26 13:06:13 +0100
committerDamjan Marion <damarion@cisco.com>2021-03-26 16:33:21 +0100
commit6ffb7c61899eb782416cbd2f117042a583f189f7 (patch)
treef6bd132d53b0aded6b235d13200dba2864afc7d8 /src/plugins/tracedump
parent83f13e45bcd4b1018aa29bb6f32324c32f3a11a8 (diff)
vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()
Type: improvement Change-Id: If3da7d4338470912f37ff1794620418d928fb77f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/tracedump')
-rw-r--r--src/plugins/tracedump/tracedump.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/tracedump/tracedump.c b/src/plugins/tracedump/tracedump.c
index ab86ef987e2..7c83ba25dc9 100644
--- a/src/plugins/tracedump/tracedump.c
+++ b/src/plugins/tracedump/tracedump.c
@@ -224,10 +224,10 @@ vl_api_trace_dump_t_handler (vl_api_trace_dump_t * mp)
if (vec_len (client_trace_cache) == 0
&& (iterator_thread_id != ~0 || iterator_position != ~0))
{
- vlib_worker_thread_barrier_sync (&vlib_global_main);
+ vlib_worker_thread_barrier_sync (vlib_get_first_main ());
/* Make a slot for each worker thread */
- vec_validate (client_trace_cache, vec_len (vlib_mains) - 1);
+ vec_validate (client_trace_cache, vlib_get_n_threads () - 1);
i = 0;
/* *INDENT-OFF* */
@@ -250,7 +250,7 @@ vl_api_trace_dump_t_handler (vl_api_trace_dump_t * mp)
i++;
}));
/* *INDENT-ON* */
- vlib_worker_thread_barrier_release (&vlib_global_main);
+ vlib_worker_thread_barrier_release (vlib_get_first_main ());
}
/* Save the cache, one way or the other */
@@ -268,7 +268,8 @@ vl_api_trace_dump_t_handler (vl_api_trace_dump_t * mp)
vec_reset_length (s);
- s = format (s, "%U", format_vlib_trace, &vlib_global_main, th[0]);
+ s =
+ format (s, "%U", format_vlib_trace, vlib_get_first_main (), th[0]);
dmp = vl_msg_api_alloc (sizeof (*dmp) + vec_len (s));
dmp->_vl_msg_id =