return n;
}
+uword
+os_get_ncpus (void)
+{
+ u32 len;
+
+ len = vec_len (vlib_thread_stacks);
+ if (len == 0)
+ return 1;
+ else
+ return len;
+}
+
void
vlib_set_thread_name (char *name)
{
int pthread_setname_np (pthread_t __target_thread, const char *__name);
+ int rv;
pthread_t thread = pthread_self ();
if (thread)
- pthread_setname_np (thread, name);
+ {
+ rv = pthread_setname_np (thread, name);
+ if (rv)
+ clib_warning ("pthread_setname_np returned %d", rv);
+ }
}
static int
unformat_input_t in;
unformat_init_string (&in, (char *) buffer,
strlen ((char *) buffer));
- unformat (&in, "%U", unformat_bitmap_list, &r);
+ if (unformat (&in, "%U", unformat_bitmap_list, &r) != 1)
+ clib_warning ("unformat_bitmap_list failed");
unformat_free (&in);
}
vec_free (buffer);
vlib_node_main_t *nm = &vm->node_main;
u64 cpu_time_now = clib_cpu_time_now ();
+ vec_alloc (nm->pending_interrupt_node_runtime_indices, 32);
+
while (1)
{
vlib_worker_thread_barrier_check ();
cpu_time_now);
}
+ /* Next handle interrupts. */
+ {
+ uword l = _vec_len (nm->pending_interrupt_node_runtime_indices);
+ uword i;
+ if (l > 0)
+ {
+ _vec_len (nm->pending_interrupt_node_runtime_indices) = 0;
+ for (i = 0; i < l; i++)
+ {
+ n = vec_elt_at_index (nm->nodes_by_type[VLIB_NODE_TYPE_INPUT],
+ nm->
+ pending_interrupt_node_runtime_indices
+ [i]);
+ cpu_time_now =
+ dispatch_node (vm, n, VLIB_NODE_TYPE_INPUT,
+ VLIB_NODE_STATE_INTERRUPT,
+ /* frame */ 0,
+ cpu_time_now);
+ }
+ }
+ }
+
if (_vec_len (nm->pending_frames))
{
int i;