40 #ifndef included_vlib_counter_h 41 #define included_vlib_counter_h 79 u32 thread_index,
u32 index,
u64 increment)
83 my_counters = cm->
counters[thread_index];
84 my_counters[index] += increment;
99 my_counters = cm->
counters[thread_index];
100 my_counters[index] =
value;
126 v += my_counters[index];
149 my_counters[index] = 0;
227 my_counters = cm->
counters[thread_index];
229 my_counters[index].
packets += n_packets;
230 my_counters[index].
bytes += n_bytes;
236 u32 thread_index,
u32 index)
243 cpu_counters = cm->
counters[thread_index];
327 #define vlib_counter_len(cm) vec_len((cm)->maxi) 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
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
char * stat_segment_name
Name in stat segment directory.
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_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 increment)
Increment a simple counter.
static void vlib_counter_zero(vlib_counter_t *a)
Clear a combined counter.
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.
uint64_t counter_t
64bit 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.
void vlib_free_combined_counter(vlib_combined_counter_main_t *cm)
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
static void vlib_prefetch_combined_counter(const vlib_combined_counter_main_t *cm, u32 thread_index, u32 index)
Pre-fetch a per-thread combined counter for the given object index.
static void vlib_set_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 value)
Set a simple counter.
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)
sll srl srl sll sra u16x4 i
u32 last_incremental_serialize_index
Last counter index serialized incrementally.
void vlib_free_simple_counter(vlib_simple_counter_main_t *cm)
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
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
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.
counter_t bytes
byte counter
char * stat_segment_name
Name in stat segment directory.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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