40 #ifndef included_vlib_counter_h 41 #define included_vlib_counter_h 85 my_minis = cm->
minis[cpu_index];
88 new = old + increment;
93 __sync_fetch_and_add (&cm->
maxi[index],
new);
110 u16 *my_minis, *mini;
125 v += cm->
maxi[index];
244 u32 packet_increment,
u32 byte_increment)
247 u32 old_packets, new_packets;
248 i32 old_bytes, new_bytes;
251 my_minis = cm->
minis[cpu_index];
255 old_bytes = mini->
bytes;
257 new_packets = old_packets + packet_increment;
258 new_bytes = old_bytes + byte_increment;
261 mini->
bytes = new_bytes;
268 __sync_fetch_and_add (&maxi->
packets, new_packets);
269 __sync_fetch_and_add (&maxi->
bytes, new_bytes);
364 #define vlib_counter_len(cm) vec_len((cm)->maxi) static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u32 increment)
Increment a simple counter.
u64 * value_at_last_serialize
Values as of last serialize.
u64 packets
packet counter
sll srl srl sll sra u16x4 i
u64 * maxi
Shared wide counters.
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.
vlib_counter_t * maxi
Shared wide counter pairs.
Combined counter to hold both packets and byte differences.
static void vlib_counter_zero(vlib_counter_t *a)
Clear a combined counter.
u64 * value_at_last_clear
Counter values as of last clear.
#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 u16 counters, and the shared vlib_counter_t...
serialize_function_t unserialize_vlib_simple_counter_main
u16 ** minis
Per-thread u16 non-atomic counters.
static void vlib_get_combined_counter(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 mini co...
u32 last_incremental_serialize_index
Last counter index serialized incrementally.
serialize_function_t serialize_vlib_combined_counter_main
u32 last_incremental_serialize_index
Last counter index serialized incrementally.
vlib_mini_counter_t ** minis
Per-thread u16 non-atomic counter pairs.
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, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
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.
#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.
static u64 vlib_get_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Get the value of a simple counter Scrapes the entire set of mini counters.
vlib_counter_t * value_at_last_clear
Counter values as of last clear.
void vlib_clear_simple_counters(vlib_simple_counter_main_t *cm)
Clear a collection of simple counters.