40 shared_header = ssvmp->
sh;
52 char *stat_segment_name;
58 shared_header = ssvmp->
sh;
75 name_copy = (
u8 *) hp->
key;
81 name_copy =
format (0,
"%s%c", stat_segment_name, 0);
112 shared_header = ssvmp->
sh;
120 name_copy = (
u8 *) hp->
key;
129 ep->
value = (
void *) index;
150 u8 *error_vector_name;
156 shared_header = ssvmp->
sh;
160 error_vector_name =
format (0,
"/err/%d/counter_vector%c", thread_index, 0);
166 name_copy = (
u8 *) hp->
key;
175 ep->
value = counter_vector;
204 if (memory_size == 0)
209 ssvmp->
my_pid = getpid ();
217 shared_header = ssvmp->
sh;
240 name =
format (0,
"/sys/vector_rate%c", 0);
247 name =
format (0,
"/sys/input_rate%c", 0);
254 name =
format (0,
"/sys/last_update%c", 0);
261 name =
format (0,
"/sys/last_stats_clear%c", 0);
289 return strcmp ((
char *) n1->
name, (
char *) n2->
name);
300 format_string =
"%-10s %20llx";
305 type_name =
"ScalarPtr";
309 type_name =
"VectorPtr";
313 type_name =
"CMainPtr";
317 type_name =
"SerNodesPtr";
321 type_name =
"ErrIndex";
322 format_string =
"%-10s %20lld";
326 type_name =
"illegal!";
330 return format (s, format_string, type_name, ep->
value);
358 vec_add2 (show_data, this, 1);
360 this->name = (u8 *) (p->key);
361 this->dir_entry = (stat_segment_directory_entry_t *)(p->value[0]);
371 for (i = 0; i <
vec_len (show_data); i++)
383 shared_header = ssvmp->
sh;
386 shared_header->
heap, 0 );
395 .path =
"show statistics segment",
396 .short_help =
"show statistics segment [verbose]",
417 shared_header = ssvmp->
sh;
437 name_copy = (
u8 *) hp->
key;
450 name_copy =
format (0,
"%s%c",
"serialized_nodes", 0);
480 u64 input_packets, last_input_packets;
497 vector_rate /= (
f64) (i - start);
527 else if (
unformat (input,
"serialize-nodes on"))
529 else if (
unformat (input,
"serialize-nodes off"))
static clib_error_t * statseg_config(vlib_main_t *vm, unformat_input_t *input)
#define STAT_SEGMENT_OPAQUE_DIR
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
void vlib_stats_pop_heap(void *cm_arg, void *oldheap)
static void update_serialized_nodes(stats_main_t *sm)
static u64 vnet_get_aggregate_rx_packets(void)
static f64 vlib_time_now(vlib_main_t *vm)
#define hash_set_mem(h, key, value)
ssvm_shared_header_t * sh
u8 * vlib_node_serialize(vlib_main_t *vm, vlib_node_t ***node_dups, u8 *vector, int include_nexts, int include_stats)
vlib_main_t ** vlib_mains
u8 * format_mheap(u8 *s, va_list *va)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static f64 vlib_last_vector_length_per_node(vlib_main_t *vm)
f64 * last_runtime_stats_clear_ptr
void vlib_stats_register_error_index(u8 *name, u64 index)
stat_segment_directory_entry_t * dir_entry
void vlib_node_get_nodes(vlib_main_t *vm, u32 max_threads, int include_stats, int barrier_sync, vlib_node_t ****node_dupsp, vlib_main_t ***stat_vmsp)
Get list of nodes.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void * ssvm_push_heap(ssvm_shared_header_t *sh)
#define clib_error_return(e, args...)
#define hash_get_pair(h, key)
A collection of simple counters.
int ssvm_master_init(ssvm_private_t *ssvm, ssvm_segment_type_t type)
static void ssvm_pop_heap(void *oldheap)
void * vlib_stats_push_heap(void)
#define hash_create_string(elts, value_bytes)
static void clib_spinlock_init(clib_spinlock_t *p)
char * name
The counter collection's name.
#define hash_unset_mem(h, key)
uword * counter_vector_by_name
f64 time_last_runtime_stats_clear
static u8 * format_stat_dir_entry(u8 *s, va_list *args)
void vlib_stat_segment_unlock(void)
vlib_node_t *** node_dups
#define STAT_SEGMENT_OPAQUE_LOCK
#define STAT_SEGMENT_OPAQUE_EPOCH
void do_stat_segment_updates(stats_main_t *sm)
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
#define vec_free(V)
Free vector's memory (no header).
void vlib_stat_segment_lock(void)
clib_spinlock_t * stat_segment_lockp
#define VLIB_CLI_COMMAND(x,...)
static void clib_mem_free(void *p)
u64 counter_t
64bit counters
static void * clib_mem_alloc(uword size)
#define STAT_SEGMENT_DEFAULT_SIZE
char * stat_segment_name
Name in stat segment directory.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
vlib_node_main_t node_main
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static int name_sort_cmp(void *a1, void *a2)
void vlib_stats_pop_heap2(u64 *counter_vector, u32 thread_index, void *oldheap)
static clib_error_t * show_stat_segment_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void * clib_mem_alloc_aligned(uword size, uword align)
counter_t ** counters
Per-thread u64 non-atomic counters.
ssvm_private_t stat_segment
#define CLIB_CACHE_LINE_BYTES
clib_error_t * vlib_map_stat_segment_init(void)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
stat_directory_type_t type