24 #define foreach_state_string_code \ 25 _(STATE_DONE, "done") \ 26 _(STATE_DISABLED, "disabled") \ 27 _(STATE_TIME_WAIT, "time wait") \ 28 _(STATE_EVENT_WAIT, "event wait") \ 29 _(STATE_ANY_WAIT, "any wait") \ 30 _(STATE_POLLING, "polling") \ 31 _(STATE_INTERRUPT_WAIT, "interrupt wait") \ 32 _(STATE_INTERNAL, "internal") 56 u32 max_threads,
int include_nexts,
int include_stats)
70 u32 threads_to_serialize;
97 for (j = 0; j < threads_to_serialize; j++)
99 stat_vm = stat_vms[j];
121 for (j = 0; j <
vec_len (stat_vms); j++)
123 stat_vm = stat_vms[j];
124 nodes = node_dups[j];
128 for (i = 0; i <
vec_len (nodes); i++)
137 state_code = STATE_INTERNAL;
149 state_code = STATE_DONE;
153 state_code = STATE_TIME_WAIT;
157 state_code = STATE_EVENT_WAIT;
168 state_code = STATE_POLLING;
169 if (n->
state == VLIB_NODE_STATE_DISABLED)
170 state_code = STATE_DISABLED;
171 else if (n->
state == VLIB_NODE_STATE_INTERRUPT)
172 state_code = STATE_INTERRUPT_WAIT;
179 memcpy (namep, n->
name, name_bytes);
235 _vec_len (nodes_by_thread) = 0;
237 for (i = 0; i < nstat_vms; i++)
245 for (j = 0; j < nnodes; j++)
259 for (k = 0; k < nnexts; k++)
286 return nodes_by_thread;
303 u32 max_threads = (
u32) ~ 0;
304 int include_nexts = 0;
305 int include_stats = 0;
309 if (
unformat (input,
"max-threads %d", &max_threads))
328 include_nexts, include_stats);
336 for (i = 0; i <
vec_len (nodes_by_thread); i++)
338 nodes = nodes_by_thread[
i];
342 for (j = 0; j <
vec_len (nodes); j++)
350 (vm,
" clocks %lld calls %lld suspends" 351 " %lld vectors %lld",
367 for (j = 0; j <
vec_len (nodes_by_thread); j++)
369 nodes = nodes_by_thread[j];
371 for (i = 0; i <
vec_len (nodes); i++)
386 .path =
"test node serialize",
387 .short_help =
"test node serialize [max-threads NN] nexts stats",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
sll srl srl sll sra u16x4 i
static u64 unserialize_likely_small_unsigned_integer(serialize_main_t *m)
static vlib_main_t * vlib_get_main(void)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define foreach_state_string_code
u8 * vlib_node_serialize(vlib_node_main_t *nm, u8 *vector, u32 max_threads, int include_nexts, int include_stats)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
vlib_node_stats_t stats_last_clear
static void * serialize_get(serialize_main_t *m, uword n_bytes)
vlib_node_stats_t stats_total
static void serialize_likely_small_unsigned_integer(serialize_main_t *m, u64 x)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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).
void vl_msg_api_barrier_sync(void)
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)
static clib_error_t * test_node_serialize_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
void vl_msg_api_barrier_release(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_node_main_t node_main
vlib_main_t ** vlib_mains
static char * state_strings[]
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
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)
vlib_node_t *** vlib_node_unserialize(u8 *vector)
void * serialize_close_vector(serialize_main_t *m)
#define VLIB_PROCESS_IS_RUNNING