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;
92 for (j = 0; j < threads_to_serialize; j++)
94 stat_vm = stat_vms[j];
116 for (j = 0; j <
vec_len (stat_vms); j++)
118 stat_vm = stat_vms[j];
119 nodes = node_dups[j];
123 for (i = 0; i <
vec_len (nodes); i++)
132 state_code = STATE_INTERNAL;
144 state_code = STATE_DONE;
148 state_code = STATE_TIME_WAIT;
152 state_code = STATE_EVENT_WAIT;
163 state_code = STATE_POLLING;
164 if (n->
state == VLIB_NODE_STATE_DISABLED)
165 state_code = STATE_DISABLED;
166 else if (n->
state == VLIB_NODE_STATE_INTERRUPT)
167 state_code = STATE_INTERRUPT_WAIT;
174 memcpy (namep, n->
name, name_bytes);
230 _vec_len (nodes_by_thread) = 0;
232 for (i = 0; i < nstat_vms; i++)
240 for (j = 0; j < nnodes; j++)
254 for (k = 0; k < nnexts; k++)
281 return nodes_by_thread;
298 u32 max_threads = (
u32) ~ 0;
299 int include_nexts = 0;
300 int include_stats = 0;
304 if (
unformat (input,
"max-threads %d", &max_threads))
323 include_nexts, include_stats);
331 for (i = 0; i <
vec_len (nodes_by_thread); i++)
333 nodes = nodes_by_thread[
i];
337 for (j = 0; j <
vec_len (nodes); j++)
345 (vm,
" clocks %lld calls %lld suspends" 346 " %lld vectors %lld",
362 for (j = 0; j <
vec_len (nodes_by_thread); j++)
364 nodes = nodes_by_thread[j];
366 for (i = 0; i <
vec_len (nodes); i++)
381 .path =
"test node serialize",
382 .short_help =
"test node serialize [max-threads NN] nexts stats",
383 .function = test_node_serialize_command_fn,
#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)
#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)
vlib_main_t ** vlib_mains
#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
void vlib_node_sync_stats(vlib_main_t *vm, vlib_node_t *n)
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 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)
#define VLIB_CLI_COMMAND(x,...)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
static vlib_main_t * vlib_get_main(void)
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
static char * state_strings[]
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define VLIB_PROCESS_IS_RUNNING