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++)
83 state_code = STATE_INTERNAL;
95 state_code = STATE_DONE;
99 state_code = STATE_TIME_WAIT;
103 state_code = STATE_EVENT_WAIT;
114 state_code = STATE_POLLING;
115 if (n->
state == VLIB_NODE_STATE_DISABLED)
116 state_code = STATE_DISABLED;
117 else if (n->
state == VLIB_NODE_STATE_INTERRUPT)
118 state_code = STATE_INTERRUPT_WAIT;
125 memcpy (namep, n->
name, name_bytes);
183 _vec_len (nodes_by_thread) = 0;
185 for (i = 0; i < nstat_vms; i++)
193 for (j = 0; j < nnodes; j++)
208 for (k = 0; k < nnexts; k++)
238 return nodes_by_thread;
255 u32 max_threads = (
u32) ~ 0;
256 int include_nexts = 0;
257 int include_stats = 0;
261 if (
unformat (input,
"max-threads %d", &max_threads))
280 include_nexts, include_stats);
288 for (i = 0; i <
vec_len (nodes_by_thread); i++)
290 nodes = nodes_by_thread[
i];
294 for (j = 0; j <
vec_len (nodes); j++)
302 (vm,
" clocks %lld calls %lld suspends" 303 " %lld vectors %lld",
319 for (j = 0; j <
vec_len (nodes_by_thread); j++)
321 nodes = nodes_by_thread[j];
323 for (i = 0; i <
vec_len (nodes); i++)
338 .path =
"test node serialize",
339 .short_help =
"test node serialize [max-threads NN] nexts stats",
340 .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)
#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,...)