49 return vec_cmp (n1[0]->name, n2[0]->name);
74 for (i = 0; i <
vec_len (nodes); i++)
85 .path =
"show vlib graph",
86 .short_help =
"Show packet processing node graph",
96 int max = va_arg (*va,
int);
111 "%=30s%=17s%=16s%=16s%=16s%=16s",
112 "Name",
"Max Node Clocks",
"Vectors at Max",
113 "Max Clocks",
"Avg Clocks",
"Avg Vectors/Call");
116 "%=30s%=12s%=16s%=16s%=16s%=16s%=16s",
117 "Name",
"State",
"Calls",
"Vectors",
"Suspends",
118 "Clocks",
"Vectors/Call");
144 v = (double) p / (
double)
c;
156 misc_info =
format (misc_info,
"events pending, ");
171 state =
"event wait";
183 if (n->
state == VLIB_NODE_STATE_DISABLED)
185 else if (n->
state == VLIB_NODE_STATE_INTERRUPT)
186 state =
"interrupt wait";
192 s =
format (s,
"%-30v%=17.2e%=16d%=16.2e%=16.2e%=16.2e",
193 ns, maxc, maxn, maxcn, x, v);
195 s =
format (s,
"%-30v%=12s%16Ld%16Ld%16Ld%16.2e%16.2f", ns, state,
219 f64 *vectors_per_main_loop = 0;
220 f64 *last_vector_length_per_node = 0;
236 u64 n_input, n_output, n_drop, n_punt;
237 u64 n_internal_vectors, n_internal_calls;
238 u64 n_clocks, l, v,
c, d;
269 for (j = 0; j <
vec_len (stat_vms); j++)
271 stat_vm = stat_vms[j];
272 nm = &stat_vm->node_main;
285 vec_add1 (last_vector_length_per_node,
291 for (j = 0; j <
vec_len (stat_vms); j++)
293 stat_vm = stat_vms[j];
294 nodes = node_dups[j];
298 n_input = n_output = n_drop = n_punt = n_clocks = 0;
299 n_internal_vectors = n_internal_calls = 0;
300 for (i = 0; i <
vec_len (nodes); i++)
321 n_internal_vectors += v;
322 n_internal_calls +=
c;
350 "Time %.1f, average vectors/node %.2f, last %d main loops %.2f per node %.2f" 351 "\n vector rates in %.4e, out %.4e, drop %.4e, punt %.4e",
353 (n_internal_calls > 0
354 ? (
f64) n_internal_vectors / (
f64) n_internal_calls
357 vectors_per_main_loop[j],
358 last_vector_length_per_node[j],
360 (
f64) n_output / dt, (
f64) n_drop / dt, (
f64) n_punt / dt);
363 for (i = 0; i <
vec_len (nodes); i++)
371 if (c || d || !brief)
382 vec_free (last_vector_length_per_node);
390 .path =
"show runtime",
391 .short_help =
"Show packet processing runtime",
421 for (j = 0; j <
vec_len (stat_vms); j++)
423 stat_vm = stat_vms[j];
424 nm = &stat_vm->node_main;
448 .path =
"clear runtime",
449 .short_help =
"Clear packet processing runtime statistics",
static f64 vlib_last_vectors_per_main_loop_as_f64(vlib_main_t *vm)
sll srl srl sll sra u16x4 i
static f64 vlib_time_now(vlib_main_t *vm)
static int node_cmp(void *a1, void *a2)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vlib_worker_thread_t * vlib_worker_threads
static f64 vlib_last_vector_length_per_node(vlib_main_t *vm)
vlib_node_stats_t stats_last_clear
static clib_error_t * show_node_runtime(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_NODE_FLAG_IS_DROP
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
#define VLIB_LOG2_MAIN_LOOPS_PER_STATS_UPDATE
static u8 * format_vlib_node_stats(u8 *s, va_list *va)
vlib_main_t ** vlib_mains
vlib_node_stats_t stats_total
#define VLIB_NODE_FLAG_IS_HANDOFF
f64 time_last_runtime_stats_clear
#define vec_dup(V)
Return copy of vector (no header, no alignment)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define vec_free(V)
Free vector's memory (no header).
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
void vlib_worker_thread_barrier_sync(vlib_main_t *vm)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
#define VLIB_NODE_FLAG_IS_PUNT
static clib_error_t * clear_node_runtime(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_node_cli_reference(void)
vhost_vring_state_t state
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
#define VLIB_NODE_FLAG_IS_OUTPUT
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_node_main_t node_main
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static clib_error_t * show_node_graph(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
unformat_function_t unformat_vlib_node
void vlib_node_sync_stats(vlib_main_t *vm, vlib_node_t *n)
static vlib_process_t * vlib_get_process_from_node(vlib_main_t *vm, vlib_node_t *node)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
format_function_t format_vlib_node_graph
#define VLIB_PROCESS_IS_RUNNING
uword * non_empty_event_type_bitmap