18 #include <sys/types.h> 21 #include <netinet/in.h> 78 u64 significant_errors = 0;
82 for (vm_index = 0; vm_index < vec_len (gm->my_vlib_mains); vm_index++)
84 this_vlib_main = gm->my_vlib_mains[vm_index];
85 em = &this_vlib_main->error_main;
86 significant_errors += em->counters[code] -
87 ((vec_len(em->counters_last_clear) > code) ?
88 em->counters_last_clear[code] : 0);
92 return (significant_errors);
113 u64 input_packets, last_input_packets, new_sig_errors;
114 f64 last_runtime, dt, now;
119 last_input_packets = 0;
122 last_input_packets = 0;
140 dt = now - last_runtime;
144 last_input_packets = input_packets;
158 .name =
"gmon-process",
183 (
char *)v, sizeof (*v));
188 (
char *)v, sizeof (*v));
192 "vpp_sig_error_rate",
193 (
char *)v, sizeof (*v));
199 (
char *)swp, sizeof (*swp));
214 "vpp_sig_error_rate");
242 u32 index,
int enable)
248 return VNET_API_ERROR_NO_SUCH_ENTRY;
267 else if (
unformat (input,
"disable"))
283 (0,
"significant_error_enable_disable returned %d", rv);
290 .path =
"set significant error",
291 .short_help =
"set significant error <counter-index-nnn>",
sll srl srl sll sra u16x4 i
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t namespace, char *var)
static uword gmon_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
always_inline uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
vlib_main_t ** my_vlib_mains
vlib_node_registration_t gmon_process_node
(constructor) VLIB_REGISTER_NODE (gmon_process_node)
#define VLIB_INIT_FUNCTION(x)
#define vlib_call_init_function(vm, x)
#define clib_bitmap_foreach(i, ai, body)
static clib_error_t * gmon_exit(vlib_main_t *vm)
vlib_error_main_t error_main
always_inline f64 vlib_last_vector_length_per_node(vlib_main_t *vm)
always_inline uword * clib_bitmap_set(uword *ai, uword i, uword value)
static clib_error_t * set_significant_error_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_MAIN_LOOP_EXIT_FUNCTION(x)
vlib_main_t vlib_global_main
void svm_region_init_chroot_uid_gid(char *root_path, int uid, int gid)
#define VLIB_CLI_COMMAND(x,...)
void svmdb_local_set_vec_variable(svmdb_client_t *client, char *var, void *val_arg, u32 elsize)
static u64 get_significant_errors(gmon_main_t *gm)
svmdb_client_t * svmdb_map_chroot(char *root_path)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void svm_region_unmap(void *rp_arg)
static u64 vnet_get_aggregate_rx_packets(void)
svmdb_client_t * svmdb_client
#define VLIB_REGISTER_NODE(x,...)
always_inline f64 vlib_time_now(vlib_main_t *vm)
#define clib_error_return(e, args...)
static clib_error_t * vpe_api_init(vlib_main_t *vm)
static int significant_error_enable_disable(gmon_main_t *gm, u32 index, int enable)
VLIB_API_INIT_FUNCTION(publish_pid)
static clib_error_t * gmon_init(vlib_main_t *vm)
static clib_error_t * publish_pid(vlib_main_t *vm)
vlib_main_t ** vlib_mains
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".