40 #ifndef included_vlib_counter_h 41 #define included_vlib_counter_h 83 my_counters = cm->
counters[cpu_index];
84 my_counters[index] += increment;
110 v += my_counters[index];
133 my_counters[index] = 0;
218 my_counters = cm->
counters[cpu_index];
220 my_counters[index].
packets += n_packets;
221 my_counters[index].
bytes += n_bytes;
234 cpu_counters = cm->
counters[cpu_index];
315 #define vlib_counter_len(cm) vec_len((cm)->maxi) sll srl srl sll sra u16x4 i
void vlib_clear_combined_counters(vlib_combined_counter_main_t *cm)
Clear a collection of combined counters.
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
vlib_counter_t * value_at_last_serialize
Counter values as of last serialize.
Combined counter to hold both packets and byte differences.
static void vlib_counter_zero(vlib_counter_t *a)
Clear a combined counter.
static void vlib_prefetch_combined_counter(const vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index)
Pre-fetch a per-thread combined counter for the given object index.
vlib_counter_t ** counters
Per-thread u64 non-atomic counter pairs.
static counter_t vlib_get_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Get the value of a simple counter Scrapes the entire set of per-thread counters.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void vlib_counter_sub(vlib_counter_t *a, vlib_counter_t *b)
Subtract combined counters, results in the first counter.
A collection of simple counters.
static void vlib_counter_add(vlib_counter_t *a, vlib_counter_t *b)
Add two combined counters, results in the first counter.
char * name
The counter collection's name.
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
counter_t packets
packet counter
serialize_function_t unserialize_vlib_simple_counter_main
u32 last_incremental_serialize_index
Last counter index serialized incrementally.
counter_t * value_at_last_serialize
Values as of last serialize.
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
#define CLIB_PREFETCH(addr, size, type)
serialize_function_t serialize_vlib_combined_counter_main
u32 last_incremental_serialize_index
Last counter index serialized incrementally.
u32 vlib_simple_counter_n_counters(const vlib_simple_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
serialize_function_t serialize_vlib_simple_counter_main
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
serialize_function_t unserialize_vlib_combined_counter_main
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
u64 counter_t
64bit counters
counter_t bytes
byte counter
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void( serialize_function_t)(serialize_main_t *m, va_list *va)
char * name
The counter collection's name.
A collection of combined counters.
counter_t ** counters
Per-thread u64 non-atomic counters.
void vlib_clear_simple_counters(vlib_simple_counter_main_t *cm)
Clear a collection of simple counters.
#define CLIB_CACHE_LINE_BYTES
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u64 increment)
Increment a simple counter.