![]() |
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the source code of this file.
Data Structures | |
struct | vlib_simple_counter_main_t |
A collection of simple counters. More... | |
struct | vlib_combined_counter_main_t |
A collection of combined counters. More... | |
Macros | |
#define | vlib_counter_len(cm) vec_len((cm)->maxi) |
Obtain the number of simple or combined counters allocated. More... | |
Optimized thread-safe counters.
Each vlib_[simple|combined]_counter_main_t consists of a per-thread vector of per-object counters.
The idea is to drastically eliminate atomic operations.
Definition in file counter.h.
Obtain the number of simple or combined counters allocated.
A macro which reduces to to vec_len(cm->maxi), the answer in either case.
cm | - (vlib_simple_counter_main_t) or (vlib_combined_counter_main_t) the counter collection to interrogate |
void vlib_clear_combined_counters | ( | vlib_combined_counter_main_t * | cm | ) |
Clear a collection of combined counters.
cm | - (vlib_combined_counter_main_t *) collection to clear |
Definition at line 61 of file counter.c.
void vlib_clear_simple_counters | ( | vlib_simple_counter_main_t * | cm | ) |
Clear a collection of simple counters.
cm | - (vlib_simple_counter_main_t *) collection to clear |
Definition at line 44 of file counter.c.
u32 vlib_combined_counter_n_counters | ( | const vlib_combined_counter_main_t * | cm | ) |
|
inlinestatic |
Add two combined counters, results in the first counter.
[in,out] | a | - (vlib_counter_t *) dst counter |
b | - (vlib_counter_t *) src counter |
|
inlinestatic |
Subtract combined counters, results in the first counter.
[in,out] | a | - (vlib_counter_t *) dst counter |
b | - (vlib_counter_t *) src counter |
|
inlinestatic |
Clear a combined counter.
a | - (vlib_counter_t *) counter to clear |
|
inlinestatic |
Decrement a simple counter.
cm | - (vlib_simple_counter_main_t *) simple counter main pointer |
thread_index | - (u32) the current cpu index |
index | - (u32) index of the counter to increment |
increment | - (u64) quantitiy remove from the counter value |
void vlib_free_combined_counter | ( | vlib_combined_counter_main_t * | cm | ) |
void vlib_free_simple_counter | ( | vlib_simple_counter_main_t * | cm | ) |
|
inlinestatic |
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thread counters.
Innacurate unless worker threads which might increment the counter are barrier-synchronized
cm | - (vlib_combined_counter_main_t *) combined counter main pointer |
index | - (u32) index of the combined counter to fetch |
result | [out] - (vlib_counter_t *) result stored here |
Definition at line 272 of file counter.h.
|
inlinestatic |
Get the value of a simple counter Scrapes the entire set of per-thread counters.
Innacurate unless worker threads which might increment the counter are barrier-synchronized
cm | - (vlib_simple_counter_main_t *) simple counter main pointer |
index | - (u32) index of the counter to fetch |
Definition at line 128 of file counter.h.
|
inlinestatic |
Increment a combined counter.
cm | - (vlib_combined_counter_main_t *) comined counter main pointer |
thread_index | - (u32) the current cpu index |
index | - (u32) index of the counter to increment |
packet_increment | - (u64) number of packets to add to the counter |
byte_increment | - (u64) number of bytes to add to the counter |
|
inlinestatic |
Increment a simple counter.
cm | - (vlib_simple_counter_main_t *) simple counter main pointer |
thread_index | - (u32) the current cpu index |
index | - (u32) index of the counter to increment |
increment | - (u64) quantitiy to add to the counter |
Definition at line 74 of file counter.h.
|
inlinestatic |
|
inlinestatic |
Set a simple counter.
cm | - (vlib_simple_counter_main_t *) simple counter main pointer |
thread_index | - (u32) the current cpu index |
index | - (u32) index of the counter to increment |
value | - (u64) quantitiy to set to the counter |
Definition at line 109 of file counter.h.
u32 vlib_simple_counter_n_counters | ( | const vlib_simple_counter_main_t * | cm | ) |
void vlib_validate_combined_counter | ( | vlib_combined_counter_main_t * | cm, |
u32 | index | ||
) |
validate a combined counter
cm | - (vlib_combined_counter_main_t *) pointer to the counter collection |
index | - (u32) index of the counter to validate |
Definition at line 119 of file counter.c.
int vlib_validate_combined_counter_will_expand | ( | vlib_combined_counter_main_t * | cm, |
u32 | index | ||
) |
void vlib_validate_simple_counter | ( | vlib_simple_counter_main_t * | cm, |
u32 | index | ||
) |
validate a simple counter
cm | - (vlib_simple_counter_main_t *) pointer to the counter collection |
index | - (u32) index of the counter to validate |
Definition at line 79 of file counter.c.
|
inlinestatic |
Clear a combined counter Clears the set of per-thread counters.
cm | - (vlib_combined_counter_main_t *) combined counter main pointer |
index | - (u32) index of the counter to clear |
Definition at line 298 of file counter.h.
|
inlinestatic |
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
cm | - (vlib_simple_counter_main_t *) simple counter main pointer |
index | - (u32) index of the counter to clear |
Definition at line 154 of file counter.h.