|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
40 #include <sys/types.h>
89 .path =
"show vlib graph",
90 .short_help =
"Show packet processing node graph",
102 u8 *chroot_filename = 0;
107 u8 filter = 0, calls_filter = 0, vectors_filter = 0, both = 0;
115 if (
unformat (line_input,
"filter"))
117 else if (
unformat (line_input,
"calls") && filter)
119 else if (
unformat (line_input,
"vectors") && filter)
124 fd = open ((
char *) chroot_filename,
125 O_CREAT | O_TRUNC | O_WRONLY, 0664);
135 both = filter & (!(calls_filter ^ vectors_filter));
137 #define format__(vm__, fd__, ...) \
140 vlib_cli_output((vm__), ## __VA_ARGS__); \
144 fdformat((fd__), ## __VA_ARGS__); \
155 " rankdir=\"LR\"\n nodesep=2\n subgraph cluster_legend {\n "
156 " label=\"Legend\"\n style=\"solid\"\n labelloc = b\n "
157 " subgraph cluster_colors {\n label=\"Packets/Call\"\n "
158 " style=\"solid\"\n labelloc = b\n");
160 " 0 [label=\"No packet\", fixedsize=true shape=circle "
161 "width=2 fontsize=17]\n"
162 " 1 [label=\"1-32\", fillcolor=1 style=filled "
163 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
165 " 2 [label=\"33-64\", fillcolor=2 style=filled "
166 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
168 " 3 [label=\"65-96\", fillcolor=3 style=filled "
169 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
171 " 4 [label=\"97-128\", fillcolor=4 style=filled "
172 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
174 " 5 [label=\"129-160\", fillcolor=5 style=filled "
175 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
177 " 6 [label=\"161-192\", fillcolor=6 style=filled "
178 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
180 " 7 [label=\"193-224\", fillcolor=7 style=filled "
181 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
183 " 8 [label=\"224+\", fillcolor=8 style=filled "
184 "colorscheme=ylorrd8 fixedsize=true shape=circle width=2 "
187 " 0 -> 1 -> 2 -> 3 -> 4 [style=\"invis\",weight =100]\n "
188 " 5 -> 6 -> 7 -> 8 [style=\"invis\",weight =100]\n }\n "
189 " subgraph cluster_size {\n label=\"Cycles/Packet\"\n "
190 " style=\"solid\"\n labelloc = b\n");
193 " a[label=\"0\",fixedsize=true shape=circle width=1] \n"
194 " b[label=\"10\",fixedsize=true shape=circle width=2 "
196 " c[label=\"100\",fixedsize=true shape=circle width=3 "
198 " d[label=\"1000\",fixedsize=true shape=circle width=4 "
200 " a -> b -> c -> d [style=\"invis\",weight =100]\n }\n }\n");
203 for (j = 0; j <
vec_len (
nm->nodes); j++)
225 n = nm_clone->
nodes[j];
242 if ((both &&
c > 0 && p > 0) || (calls_filter &&
c > 0) ||
243 (vectors_filter && p > 0))
250 f64 size_ratio = (1 + log10 (x + 1));
251 format__ (
vm, fd,
" width=%.2f fontsize=%.2f fixedsize=true",
252 size_ratio, 11 + 3 * size_ratio);
256 u64 color = ((p - 1) / (32 *
c)) + 1;
260 " fillcolor=%u style=filled colorscheme=ylorrd8",
275 for (j = 0; j <
vec_len (nodes[
i]->next_nodes); j++)
283 nodes[nodes[
i]->next_nodes[j]]->
name);
295 const char *soft = filter ?
"dot" :
"fdp";
297 vm,
"vlib graph dumped into `%s'. Run eg. `%s -Tsvg -O %s'.",
298 chroot_filename, soft, chroot_filename);
328 .path =
"show vlib graphviz",
329 .short_help =
"Dump packet processing node graph as a graphviz dotfile",
360 state =
"event wait";
372 if (n->
state == VLIB_NODE_STATE_DISABLED)
374 else if (n->
state == VLIB_NODE_STATE_INTERRUPT)
375 state =
"interrupt wait";
386 int max = va_arg (*va,
int);
400 "%=30s%=17s%=16s%=16s%=16s%=16s",
401 "Name",
"Max Node Clocks",
"Vectors at Max",
402 "Max Clocks",
"Avg Clocks",
"Avg Vectors/Call");
405 "%=30s%=12s%=16s%=16s%=16s%=16s%=16s",
406 "Name",
"State",
"Calls",
"Vectors",
"Suspends",
407 "Clocks",
"Vectors/Call");
434 v = (double) p / (
double)
c;
445 misc_info =
format (misc_info,
"events pending, ");
450 s =
format (s,
"%-30v%=17.2e%=16d%=16.2e%=16.2e%=16.2e",
451 ns, maxc, maxn, maxcn, x, v);
453 s =
format (s,
"%-30v%=12U%16Ld%16Ld%16Ld%16.2e%16.2f", ns,
484 f64 *internal_node_vector_rates = 0;
500 u64 n_input, n_output, n_drop, n_punt;
501 u64 n_internal_vectors, n_internal_calls;
502 u64 n_clocks, l, v,
c, d;
532 for (j = 0; j <
vec_len (stat_vms); j++)
534 stat_vm = stat_vms[j];
535 nm = &stat_vm->node_main;
546 vec_add1 (internal_node_vector_rates,
552 for (j = 0; j <
vec_len (stat_vms); j++)
554 stat_vm = stat_vms[j];
555 nodes = node_dups[j];
559 n_input = n_output = n_drop = n_punt = n_clocks = 0;
560 n_internal_vectors = n_internal_calls = 0;
582 n_internal_vectors += v;
583 n_internal_calls +=
c;
608 dt = time_now -
nm->time_last_runtime_stats_clear;
611 "Time %.1f, %f sec internal node vector rate %.2f loops/sec %.2f\n"
612 " vector rates in %.4e, out %.4e, drop %.4e, punt %.4e",
615 internal_node_vector_rates[j],
616 stat_vm->loops_per_second,
618 (
f64) n_output / dt, (
f64) n_drop / dt, (
f64) n_punt / dt);
632 if (
c || d || !brief)
635 stat_vm, nodes[
i], max);
643 vec_free (internal_node_vector_rates);
651 .path =
"show runtime",
652 .short_help =
"Show packet processing runtime",
677 for (j = 0; j <
vec_len (stat_vms); j++)
679 stat_vm = stat_vms[j];
680 nm = &stat_vm->node_main;
704 .path =
"clear runtime",
705 .short_help =
"Clear packet processing runtime statistics",
721 u8 valid_node_name = 0;
731 else if (
unformat (line_input,
"verbose"))
736 else if (!valid_node_name)
761 type_str =
"internal";
767 type_str =
"pre-input";
770 type_str =
"process";
773 type_str =
"unknown";
792 s =
format (s,
"\n %-15s %=8s %6s %s",
"Name",
"Priority",
793 "Active",
"Description");
796 fnr = fnr->next_registration;
800 s =
format (s,
"\n default only");
813 s =
format (s,
"\n %10s %10s %=30s %8s",
814 "next-index",
"node-index",
"Node",
"Vectors");
821 s =
format (s,
"\n none");
834 s =
format (s,
"%-35v", s2);
840 s =
format (s,
"\n none");
849 s =
format (s,
"\n%8s %=12s %=12s %=12s %=12s %=12s\n",
"Thread",
"Calls",
850 "Clocks",
"Vectors",
"Max Clock",
"Max Vectors");
860 s =
format (s,
"%=8u %=12lu %=12lu %=12lu %=12u %=12u\n",
i, ca, cl, v,
875 .short_help =
"show node [index] <node-name | node-index>",
927 .path =
"set node function",
928 .short_help =
"set node function <node-name> <variant-name>",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
format_function_t format_vlib_node_graph
void vlib_node_sync_stats(vlib_main_t *vm, vlib_node_t *n)
void vlib_node_cli_reference(void)
struct _vlib_node_fn_registration vlib_node_fn_registration_t
static vlib_cli_command_t show_node_runtime_command
(constructor) VLIB_CLI_COMMAND (show_node_runtime_command)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
uword * non_empty_event_type_bitmap
static clib_error_t * show_node_graph(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * show_node_runtime(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
@ VLIB_NODE_TYPE_PRE_INPUT
#define VLIB_INVALID_NODE_INDEX
static clib_error_t * set_node_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int vlib_node_set_march_variant(vlib_main_t *vm, u32 node_index, clib_march_variant_type_t march_variant)
@ VLIB_NODE_TYPE_INTERNAL
static vlib_cli_command_t clear_node_runtime_command
(constructor) VLIB_CLI_COMMAND (clear_node_runtime_command)
#define clib_error_return(e, args...)
void vlib_node_runtime_sync_stats_node(vlib_node_t *n, vlib_node_runtime_t *r, uword n_calls, uword n_vectors, uword n_clocks)
vlib_node_main_t node_main
vlib_node_fn_registration_t * node_fn_registrations
#define VLIB_NODE_FLAG_IS_HANDOFF
static clib_error_t * show_node(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vl_api_dhcp_client_state_t state
f64 vlib_get_stat_segment_update_rate(void)
#define format__(vm__, fd__,...)
vnet_hw_if_output_node_runtime_t * r
#define clib_bitmap_alloc(v, n_bits)
Allocate a bitmap with the supplied number of bits.
vlib_worker_thread_t * vlib_worker_threads
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
static vlib_cli_command_t set_node_fn_command
(constructor) VLIB_CLI_COMMAND (set_node_fn_command)
static int node_cmp(void *a1, void *a2)
static clib_error_t * show_node_graphviz(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_elt(v, i)
Get vector value at index i.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_dup(V)
Return copy of vector (no header, no alignment)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define vlib_worker_thread_barrier_sync(X)
unformat_function_t unformat_vlib_node
static uword * clib_bitmap_set_region(uword *bitmap, uword i, uword value, uword n_bits)
static vlib_process_t * vlib_get_process_from_node(vlib_main_t *vm, vlib_node_t *node)
#define clib_bitmap_free(v)
Free a bitmap.
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
static vlib_cli_command_t show_node_graph_command
(constructor) VLIB_CLI_COMMAND (show_node_graph_command)
#define VLIB_CLI_COMMAND(x,...)
#define VLIB_NODE_FLAG_IS_DROP
#define VLIB_NODE_FLAG_IS_PUNT
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static u8 * format_vlib_node_state(u8 *s, va_list *va)
static vlib_cli_command_t show_node_graphviz_command
(constructor) VLIB_CLI_COMMAND (show_node_graphviz_command)
#define vec_free(V)
Free vector's memory (no header).
description fragment has unexpected format
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
vlib_node_function_t * function
vlib_node_stats_t stats_total
static u8 * format_vlib_node_stats(u8 *s, va_list *va)
static vlib_main_t * vlib_get_main_by_index(u32 thread_index)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static f64 vlib_internal_node_vector_rate(vlib_main_t *vm)
vlib_node_stats_t stats_last_clear
static u32 vlib_get_n_threads()
u64 * n_vectors_by_next_node
vnet_interface_output_runtime_t * rt
vlib_node_fn_variant_t * variants
static f64 vlib_time_now(vlib_main_t *vm)
#define VLIB_PROCESS_IS_RUNNING
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
static clib_error_t * clear_node_runtime(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_cli_command_t show_node_command
(constructor) VLIB_CLI_COMMAND (show_node_command)
#define VLIB_NODE_FLAG_IS_OUTPUT
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
unformat_function_t unformat_vlib_node_variant