aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
ModeNameSize
-rw-r--r--CMakeLists.txt3509logstatsplain
-rw-r--r--FEATURE_trace.yaml502logstatsplain
-rw-r--r--buffer.c26302logstatsplain
-rw-r--r--buffer.h15696logstatsplain
-rw-r--r--buffer_funcs.c11622logstatsplain
-rw-r--r--buffer_funcs.h47326logstatsplain
-rw-r--r--buffer_node.h16235logstatsplain
-rw-r--r--cli.c46707logstatsplain
-rw-r--r--cli.h7279logstatsplain
-rw-r--r--config.h.in865logstatsplain
-rw-r--r--counter.c5765logstatsplain
-rw-r--r--counter.h11325logstatsplain
-rw-r--r--counter_types.h964logstatsplain
-rw-r--r--defs.h2655logstatsplain
-rw-r--r--dir.dox832logstatsplain
-rw-r--r--drop.c6884logstatsplain
-rw-r--r--error.c10422logstatsplain
-rw-r--r--error.h2772logstatsplain
-rw-r--r--error_funcs.h3016logstatsplain
-rw-r--r--format.c5869logstatsplain
-rw-r--r--format_funcs.h3281logstatsplain
-rw-r--r--global_funcs.h1711logstatsplain
-rw-r--r--handoff_trace.c3374logstatsplain
-rw-r--r--init.c18527logstatsplain
-rw-r--r--init.h19551logstatsplain
-rw-r--r--lex.c6421logstatsplain
-rw-r--r--lex.h3616logstatsplain
d---------linux136logstatsplain
-rw-r--r--log.c22441logstatsplain
-rw-r--r--log.h4151logstatsplain
-rw-r--r--main.c57632logstatsplain
-rw-r--r--main.h13953logstatsplain
-rw-r--r--node.c24213logstatsplain
-rw-r--r--node.h23515logstatsplain
-rw-r--r--node_cli.c26072logstatsplain
-rw-r--r--node_format.c5506logstatsplain
-rw-r--r--node_funcs.h40861logstatsplain
-rw-r--r--node_init.c4051logstatsplain
-rw-r--r--parse.h4793logstatsplain
d---------pci233logstatsplain
-rw-r--r--physmem.c5293logstatsplain
-rw-r--r--physmem.h2470logstatsplain
-rw-r--r--physmem_funcs.h4196logstatsplain
-rw-r--r--punt.c15025logstatsplain
-rw-r--r--punt.h3387logstatsplain
-rw-r--r--punt_node.c7543logstatsplain
d---------stats290logstatsplain
-rw-r--r--threads.c46079logstatsplain
-rw-r--r--threads.h13021logstatsplain
-rw-r--r--threads_cli.c14093logstatsplain
-rw-r--r--time.c3143logstatsplain
-rw-r--r--time.h588logstatsplain
-rw-r--r--trace.c16502logstatsplain
-rw-r--r--trace.h4115logstatsplain
-rw-r--r--trace_funcs.h8038logstatsplain
d---------unix395logstatsplain
-rw-r--r--vlib.h2953logstatsplain
-rw-r--r--vlib_process_doc.h5325logstatsplain
d---------vmbus70logstatsplain
pan class="p">); namep = serialize_get (sm, name_bytes); memcpy (namep, n->name, name_bytes); serialize_likely_small_unsigned_integer (sm, (u64) state_code); serialize_likely_small_unsigned_integer (sm, n->type); serialize_likely_small_unsigned_integer (sm, n->flags); if (include_nexts) { serialize_likely_small_unsigned_integer (sm, vec_len (n->next_nodes)); for (k = 0; k < vec_len (n->next_nodes); k++) serialize_likely_small_unsigned_integer (sm, n->next_nodes[k]); } else serialize_likely_small_unsigned_integer (sm, 0); if (include_stats) { /* stats present */ serialize_likely_small_unsigned_integer (sm, 1); /* total clocks */ serialize_integer (sm, l, 8); /* Total calls */ serialize_integer (sm, c, 8); /* Total vectors */ serialize_integer (sm, v, 8); /* Total suspends */ serialize_integer (sm, d, 8); } else /* no stats */ serialize_likely_small_unsigned_integer (sm, 0); } } return (serialize_close_vector (sm)); } vlib_node_t *** vlib_node_unserialize (u8 * vector) { serialize_main_t _sm, *sm = &_sm; u32 nnodes, nnexts; u32 nstat_vms; vlib_node_t *node; vlib_node_t **nodes; vlib_node_t ***nodes_by_thread = 0; int i, j, k; u64 l, v, c, d; state_string_enum_t state_code; int stats_present; serialize_open_vector (sm, vector); nstat_vms = unserialize_likely_small_unsigned_integer (sm); vec_validate (nodes_by_thread, nstat_vms - 1); _vec_len (nodes_by_thread) = 0; for (i = 0; i < nstat_vms; i++) { nnodes = unserialize_likely_small_unsigned_integer (sm); nodes = 0; vec_validate (nodes, nnodes - 1); vec_add1 (nodes_by_thread, nodes); for (j = 0; j < nnodes; j++) { node = 0; vec_validate (node, 0); nodes[j] = node; unserialize_cstring (sm, (char **) &(node->name)); state_code = unserialize_likely_small_unsigned_integer (sm); node->state_string = (u8 *) state_strings[state_code]; node->type = unserialize_likely_small_unsigned_integer (sm); node->flags = unserialize_likely_small_unsigned_integer (sm); nnexts = unserialize_likely_small_unsigned_integer (sm); if (nnexts > 0) vec_validate (node->next_nodes, nnexts - 1); for (k = 0; k < nnexts; k++) node->next_nodes[k] = unserialize_likely_small_unsigned_integer (sm); stats_present = unserialize_likely_small_unsigned_integer (sm); if (stats_present) { /* total clocks */ unserialize_integer (sm, &l, 8); node->stats_total.clocks = l; node->stats_last_clear.clocks = 0; /* Total calls */ unserialize_integer (sm, &c, 8); node->stats_total.calls = c; /* Total vectors */ unserialize_integer (sm, &v, 8); node->stats_total.vectors = v; /* Total suspends */ unserialize_integer (sm, &d, 8); node->stats_total.suspends = d; } } } return nodes_by_thread; } #if TEST_CODE static clib_error_t * test_node_serialize_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vlib_node_main_t *nm = &vm->node_main; u8 *vector = 0; vlib_node_t ***nodes_by_thread; vlib_node_t **nodes; vlib_node_t *node; vlib_node_t *next_node; int i, j, k; u32 max_threads = (u32) ~ 0; int include_nexts = 0; int include_stats = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "max-threads %d", &max_threads)) ; else if (unformat (input, "stats")) include_stats = 1; else if (unformat (input, "nexts")) include_nexts = 1; else break; } /* * Keep the number of memcpy ops to a minimum (e.g. 1). * The current size of the serialized vector is * slightly under 4K. */ vec_validate (vector, 16383); vec_reset_length (vector); vector = vlib_node_serialize (nm, vector, max_threads, include_nexts, include_stats); vlib_cli_output (vm, "result vector %d bytes", vec_len (vector)); nodes_by_thread = vlib_node_unserialize (vector); vec_free (vector); for (i = 0; i < vec_len (nodes_by_thread); i++) { nodes = nodes_by_thread[i]; vlib_cli_output (vm, "thread %d", i); for (j = 0; j < vec_len (nodes); j++) { node = nodes[j]; vlib_cli_output (vm, "[%d] %s state %s", j, node->name, node->state_string); vlib_cli_output (vm, " clocks %lld calls %lld suspends" " %lld vectors %lld", node->stats_total.clocks, node->stats_total.calls, node->stats_total.suspends, node->stats_total.vectors); for (k = 0; k < vec_len (node->next_nodes); k++) { if (node->next_nodes[k] != ~0) { next_node = nodes[node->next_nodes[k]]; vlib_cli_output (vm, " [%d] %s", k, next_node->name); } } } } for (j = 0; j < vec_len (nodes_by_thread); j++) { nodes = nodes_by_thread[j]; for (i = 0; i < vec_len (nodes); i++) { vec_free (nodes[i]->name); vec_free (nodes[i]->next_nodes); vec_free (nodes[i]); } vec_free (nodes); } vec_free (nodes_by_thread); return 0; } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (test_node_serialize_node, static) = { .path = "test node serialize", .short_help = "test node serialize [max-threads NN] nexts stats", .function = test_node_serialize_command_fn, }; /* *INDENT-ON* */ #endif /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */