diff options
author | Ole Troan <ot@cisco.com> | 2019-09-18 13:13:16 +0200 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-09-30 09:33:03 +0000 |
commit | c90f4363aaf6e3fe5e7fa52272b65aca9c10d501 (patch) | |
tree | b9e19593e2c435a62662f873211482429f9027f2 | |
parent | 2f77ee891911f6013997955e9f77d598aacd49ed (diff) |
stats: fix per_worker vector rate heap
The per_worker counters were outside of the stats heap.
Also fixes the length of the per_vector counter.
A simple vector is two dimensional including a thread dimension.
Fixes: f89a6de8f0
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I370bf9cb033d264f42df2723e01b768dc270792b
(cherry picked from commit a41b0b78a4341478ee6c8701f9ec642b5c2d1cdd)
-rw-r--r-- | src/vpp/stats/stat_segment.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c index 5dcb390e7ae..0eabc032592 100644 --- a/src/vpp/stats/stat_segment.c +++ b/src/vpp/stats/stat_segment.c @@ -553,13 +553,17 @@ do_stat_segment_updates (stat_segment_main_t * sm) */ if (PREDICT_FALSE (num_worker_threads_set == 0)) { + void *oldheap = clib_mem_set_heap (sm->heap); + vlib_stat_segment_lock (); + sm->directory_vector[STAT_COUNTER_NUM_WORKER_THREADS].value = vec_len (vlib_mains) > 1 ? vec_len (vlib_mains) - 1 : 1; stat_validate_counter_vector (&sm->directory_vector - [STAT_COUNTER_VECTOR_RATE_PER_WORKER], - vec_len (vlib_mains)); + [STAT_COUNTER_VECTOR_RATE_PER_WORKER], 0); num_worker_threads_set = 1; + vlib_stat_segment_unlock (); + clib_mem_set_heap (oldheap); } /* @@ -586,7 +590,7 @@ do_stat_segment_updates (stat_segment_main_t * sm) vector_rate += this_vector_rate; /* Set the per-worker rate */ - counters[i - start][0] = this_vector_rate; + counters[0][i - start] = this_vector_rate; } /* And set the system average rate */ |