diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vpp/stats/stat_segment.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c index 11e72b2d87c..b978d37a091 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); |