summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-31 17:56:58 +0200
committerDamjan Marion <damarion@cisco.com>2022-03-31 18:32:33 +0200
commitb3a5b39efb48a67fa93d4329282345c0fc8a1f29 (patch)
treebb83f09c5efc697920d924eaaa127bb0bb76889b /src
parent66c858385f3dc1c36682771424a8a9e5a6cd8355 (diff)
stats: use vlib_stats_validate in collector
Type: refactor Change-Id: Ib2bf9f11209eb310b289b3202b2beeccc3637df0 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/stats/collector.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/vlib/stats/collector.c b/src/vlib/stats/collector.c
index cc348bbf3ad..9c982a9a14e 100644
--- a/src/vlib/stats/collector.c
+++ b/src/vlib/stats/collector.c
@@ -6,26 +6,6 @@
#include <vlib/unix/unix.h>
#include <vlib/stats/stats.h>
-static void
-stat_validate_counter_vector2 (vlib_stats_entry_t *ep, u32 max1, u32 max2)
-{
- counter_t **counters = ep->data;
- int i;
- vec_validate_aligned (counters, max1, CLIB_CACHE_LINE_BYTES);
- for (i = 0; i <= max1; i++)
- vec_validate_aligned (counters[i], max2, CLIB_CACHE_LINE_BYTES);
-
- ep->data = counters;
-}
-
-static void
-stat_validate_counter_vector (vlib_stats_entry_t *ep, u32 max)
-{
- vlib_thread_main_t *tm = vlib_get_thread_main ();
- ASSERT (tm->n_vlib_mains > 0);
- stat_validate_counter_vector2 (ep, tm->n_vlib_mains, max);
-}
-
static inline void
update_node_counters (vlib_stats_segment_t *sm)
{
@@ -46,17 +26,14 @@ update_node_counters (vlib_stats_segment_t *sm)
*/
if (l > no_max_nodes)
{
+ u32 last_thread = vlib_get_n_threads ();
void *oldheap = clib_mem_set_heap (sm->heap);
vlib_stats_segment_lock ();
- stat_validate_counter_vector (
- &sm->directory_vector[STAT_COUNTER_NODE_CLOCKS], l - 1);
- stat_validate_counter_vector (
- &sm->directory_vector[STAT_COUNTER_NODE_VECTORS], l - 1);
- stat_validate_counter_vector (
- &sm->directory_vector[STAT_COUNTER_NODE_CALLS], l - 1);
- stat_validate_counter_vector (
- &sm->directory_vector[STAT_COUNTER_NODE_SUSPENDS], l - 1);
+ vlib_stats_validate (STAT_COUNTER_NODE_CLOCKS, last_thread, l - 1);
+ vlib_stats_validate (STAT_COUNTER_NODE_VECTORS, last_thread, l - 1);
+ vlib_stats_validate (STAT_COUNTER_NODE_CALLS, last_thread, l - 1);
+ vlib_stats_validate (STAT_COUNTER_NODE_SUSPENDS, last_thread, l - 1);
vec_validate (sm->nodes, l - 1);
vlib_stats_entry_t *ep;