diff options
author | Matus Fabian <matfabia@cisco.com> | 2018-12-17 05:29:28 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-12-18 07:45:33 +0000 |
commit | b0055c81570624534d279b6dfbc5fe351fd5d5f3 (patch) | |
tree | 909543a29b8bd5b8a7ca43394b7e4161783d1f34 /src | |
parent | bef3619d259b43f4bf4bfd43db1338ddb10a8c39 (diff) |
STATS: add vlib_set_simple_counter (VPP-1484)
Change-Id: Iacaa75c7e1c974642c1dc1e0c3cf5c36c78450d7
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vlib/counter.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vlib/counter.h b/src/vlib/counter.h index 3aacc9b375f..092bd00c879 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 |