X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fcounter.h;h=7c9094727e2e2a003b5c458b4c91001654cee7a4;hb=bdfe5955f;hp=3aacc9b375fd5ee90fb0b9f12d3eb8aa58956a76;hpb=58492a83722caf1c49977d73abf931418ce1f8f2;p=vpp.git diff --git a/src/vlib/counter.h b/src/vlib/counter.h index 3aacc9b375f..7c9094727e2 100644 --- a/src/vlib/counter.h +++ b/src/vlib/counter.h @@ -84,6 +84,22 @@ vlib_increment_simple_counter (vlib_simple_counter_main_t * cm, my_counters[index] += increment; } +/** Set a simple counter + @param cm - (vlib_simple_counter_main_t *) simple counter main pointer + @param thread_index - (u32) the current cpu index + @param index - (u32) index of the counter to increment + @param value - (u64) quantitiy to set to the counter +*/ +always_inline void +vlib_set_simple_counter (vlib_simple_counter_main_t * cm, + u32 thread_index, u32 index, u64 value) +{ + counter_t *my_counters; + + my_counters = cm->counters[thread_index]; + my_counters[index] = value; +} + /** 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 @@ -288,6 +304,8 @@ vlib_zero_combined_counter (vlib_combined_counter_main_t * cm, u32 index) void vlib_validate_simple_counter (vlib_simple_counter_main_t * cm, u32 index); +void vlib_free_simple_counter (vlib_simple_counter_main_t * cm); + /** validate a combined counter @param cm - (vlib_combined_counter_main_t *) pointer to the counter collection @@ -296,6 +314,7 @@ void vlib_validate_simple_counter (vlib_simple_counter_main_t * cm, void vlib_validate_combined_counter (vlib_combined_counter_main_t * cm, u32 index); +void vlib_free_combined_counter (vlib_combined_counter_main_t * cm); /** Obtain the number of simple or combined counters allocated. A macro which reduces to to vec_len(cm->maxi), the answer in either @@ -307,11 +326,6 @@ void vlib_validate_combined_counter (vlib_combined_counter_main_t * cm, */ #define vlib_counter_len(cm) vec_len((cm)->maxi) -serialize_function_t serialize_vlib_simple_counter_main, - unserialize_vlib_simple_counter_main; -serialize_function_t serialize_vlib_combined_counter_main, - unserialize_vlib_combined_counter_main; - #endif /* included_vlib_counter_h */ /*