21 #define foreach_state_string_code \ 22 _(STATE_DONE, "done") \ 23 _(STATE_DISABLED, "disabled") \ 24 _(STATE_TIME_WAIT, "time wait") \ 25 _(STATE_EVENT_WAIT, "event wait") \ 26 _(STATE_ANY_WAIT, "any wait") \ 27 _(STATE_POLLING, "polling") \ 28 _(STATE_INTERRUPT_WAIT, "interrupt wait") \ 29 _(STATE_INTERNAL, "internal") 52 int include_nexts,
int include_stats)
66 for (j = 0; j <
vec_len (node_dups); j++)
72 for (i = 0; i <
vec_len (nodes); i++)
81 state_code = STATE_INTERNAL;
93 state_code = STATE_DONE;
97 state_code = STATE_TIME_WAIT;
101 state_code = STATE_EVENT_WAIT;
112 state_code = STATE_POLLING;
113 if (n->
state == VLIB_NODE_STATE_DISABLED)
114 state_code = STATE_DISABLED;
115 else if (n->
state == VLIB_NODE_STATE_INTERRUPT)
116 state_code = STATE_INTERRUPT_WAIT;
123 memcpy (namep, n->
name, name_bytes);
179 _vec_len (nodes_by_thread) = 0;
181 for (i = 0; i < nstat_vms; i++)
189 for (j = 0; j < nnodes; j++)
204 for (k = 0; k < nnexts; k++)
231 return nodes_by_thread;
248 u32 max_threads = (
u32) ~ 0;
249 int include_nexts = 0;
250 int include_stats = 0;
254 if (
unformat (input,
"max-threads %d", &max_threads))
273 include_nexts, include_stats);
281 for (i = 0; i <
vec_len (nodes_by_thread); i++)
283 nodes = nodes_by_thread[
i];
287 for (j = 0; j <
vec_len (nodes); j++)
295 (vm,
" clocks %lld calls %lld suspends" 296 " %lld vectors %lld",
312 for (j = 0; j <
vec_len (nodes_by_thread); j++)
314 nodes = nodes_by_thread[j];
316 for (i = 0; i <
vec_len (nodes); i++)
331 .path =
"test node serialize",
332 .short_help =
"test node serialize [max-threads NN] nexts stats",
333 .function = test_node_serialize_command_fn,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static u64 unserialize_likely_small_unsigned_integer(serialize_main_t *m)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define foreach_state_string_code
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u8 * vlib_node_serialize(vlib_main_t *vm, vlib_node_t ***node_dups, u8 *vector, int include_nexts, int include_stats)
vlib_node_stats_t stats_last_clear
static void * serialize_get(serialize_main_t *m, uword n_bytes)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
#define VLIB_PROCESS_IS_RUNNING
vlib_node_stats_t stats_total
static void serialize_likely_small_unsigned_integer(serialize_main_t *m, u64 x)
void unserialize_cstring(serialize_main_t *m, char **s)
void serialize_open_vector(serialize_main_t *m, u8 *vector)
#define vec_free(V)
Free vector's memory (no header).
static void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
static void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_node_main_t node_main
static char * state_strings[]
static vlib_process_t * vlib_get_process_from_node(vlib_main_t *vm, vlib_node_t *node)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
vlib_node_t *** vlib_node_unserialize(u8 *vector)
void * serialize_close_vector(serialize_main_t *m)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)