s = format (s, "flags: %U\n", format_vnet_buffer_flags, b);
s = format (s, "current_data: %d, current_length: %d\n",
(i32) (b->current_data), (i32) (b->current_length));
- s = format (s, "current_config_index: %d, flow_id: %x, next_buffer: %x\n",
- b->current_config_index, b->flow_id, b->next_buffer);
- s = format (s, "error: %d, ref_count: %d, buffer_pool_index: %d\n",
- (u32) (b->error), (u32) (b->ref_count),
- (u32) (b->buffer_pool_index));
- s = format (s,
- "trace_handle: 0x%x, len_not_first_buf: %d\n",
- b->trace_handle, b->total_length_not_including_first_buffer);
+ s = format
+ (s,
+ "current_config_index/punt_reason: %d, flow_id: %x, next_buffer: %x\n",
+ b->current_config_index, b->flow_id, b->next_buffer);
+ s =
+ format (s, "error: %d, ref_count: %d, buffer_pool_index: %d\n",
+ (u32) (b->error), (u32) (b->ref_count),
+ (u32) (b->buffer_pool_index));
+ s =
+ format (s, "trace_handle: 0x%x, len_not_first_buf: %d\n", b->trace_handle,
+ b->total_length_not_including_first_buffer);
return s;
}
vlib_thread_main_t *tm = vlib_get_thread_main ();
uword i;
u64 cpu_time_now;
+ f64 now;
vlib_frame_queue_main_t *fqm;
u32 *last_node_runtime_indices = 0;
u32 frame_queue_check_counter = 0;
vm->cpu_id = clib_get_current_cpu_id ();
vm->numa_node = clib_get_current_numa_node ();
+ os_set_numa_index (vm->numa_node);
/* Start all processes. */
if (is_main)
/* Record time stamp in case there are no enabled nodes and above
calls do not update time stamp. */
cpu_time_now = clib_cpu_time_now ();
+ vm->loops_this_reporting_interval++;
+ now = clib_time_now_internal (&vm->clib_time, cpu_time_now);
+ /* Time to update loops_per_second? */
+ if (PREDICT_FALSE (now >= vm->loop_interval_end))
+ {
+ /* Next sample ends in 20ms */
+ if (vm->loop_interval_start)
+ {
+ f64 this_loops_per_second;
+
+ this_loops_per_second =
+ ((f64) vm->loops_this_reporting_interval) / (now -
+ vm->loop_interval_start);
+
+ vm->loops_per_second =
+ vm->loops_per_second * vm->damping_constant +
+ (1.0 - vm->damping_constant) * this_loops_per_second;
+ if (vm->loops_per_second != 0.0)
+ vm->seconds_per_loop = 1.0 / vm->loops_per_second;
+ else
+ vm->seconds_per_loop = 0.0;
+ }
+ /* New interval starts now, and ends in 20ms */
+ vm->loop_interval_start = now;
+ vm->loop_interval_end = now + 2e-4;
+ vm->loops_this_reporting_interval = 0;
+ }
}
}
vm->queue_signal_callback = dummy_queue_signal_callback;
- clib_time_init (&vm->clib_time);
-
/* Turn on event log. */
if (!vm->elog_main.event_ring_size)
vm->elog_main.event_ring_size = 128 << 10;
if ((error = vlib_call_all_config_functions (vm, input, 0 /* is_early */ )))
goto done;
+ /*
+ * Use exponential smoothing, with a half-life of 1 second
+ * reported_rate(t) = reported_rate(t-1) * K + rate(t)*(1-K)
+ *
+ * Sample every 20ms, aka 50 samples per second
+ * K = exp (-1.0/20.0);
+ * K = 0.95
+ */
+ vm->damping_constant = exp (-1.0 / 20.0);
+
/* Sort per-thread init functions before we start threads */
vlib_sort_init_exit_functions (&vm->worker_init_function_registrations);