summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-09-30 12:39:55 +0200
committerOle Trøan <otroan@employees.org>2019-10-04 12:01:05 +0000
commitb7c4a5c76f5a823dce29a1f654e0acb3dce8876d (patch)
tree4757b27d85887208e3559714947040559999c992 /src
parent6af2886a08d8de21a2b03fa814e5ee3f4671a83e (diff)
stats: fix per-worker stat vector length
Type: fix Change-Id: I198a2312f5fc6e922c8a6c51ba7248ce6e236f81 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit dba00cad1a2e41b4974911793cc76eab81a6e30e)
Diffstat (limited to 'src')
-rw-r--r--src/vpp/stats/stat_segment.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index 9e27e69a331..78b34ed8265 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -558,13 +558,14 @@ 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);
+ int workers = clib_max (1, vec_len (vlib_mains) - 1);
vlib_stat_segment_lock ();
- sm->directory_vector[STAT_COUNTER_NUM_WORKER_THREADS].value =
- vec_len (vlib_mains) > 1 ? vec_len (vlib_mains) - 1 : 1;
+ sm->directory_vector[STAT_COUNTER_NUM_WORKER_THREADS].value = workers;
stat_validate_counter_vector (&sm->directory_vector
- [STAT_COUNTER_VECTOR_RATE_PER_WORKER], 0);
+ [STAT_COUNTER_VECTOR_RATE_PER_WORKER],
+ workers);
num_worker_threads_set = 1;
vlib_stat_segment_unlock ();
clib_mem_set_heap (oldheap);