diff options
Diffstat (limited to 'src/vlib/counter.c')
-rw-r--r-- | src/vlib/counter.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/vlib/counter.c b/src/vlib/counter.c index 186b48d869e..ceaf0132e64 100644 --- a/src/vlib/counter.c +++ b/src/vlib/counter.c @@ -38,7 +38,7 @@ */ #include <vlib/vlib.h> -#include <vlib/stat_weak_inlines.h> +#include <vlib/stats/stats.h> void vlib_clear_simple_counters (vlib_simple_counter_main_t * cm) @@ -80,7 +80,7 @@ vlib_validate_simple_counter (vlib_simple_counter_main_t * cm, u32 index) { vlib_thread_main_t *tm = vlib_get_thread_main (); int i, resized = 0; - void *oldheap = vlib_stats_push_heap (cm->counters); + void *oldheap = vlib_stats_set_heap (); vec_validate (cm->counters, tm->n_vlib_mains - 1); for (i = 0; i < tm->n_vlib_mains; i++) @@ -93,12 +93,10 @@ vlib_validate_simple_counter (vlib_simple_counter_main_t * cm, u32 index) vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES); } + clib_mem_set_heap (oldheap); /* Avoid the epoch increase when there was no counter vector resize. */ if (resized) - vlib_stats_pop_heap (cm, oldheap, index, - 2 /* STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE */); - else - clib_mem_set_heap (oldheap); + vlib_stats_update_counter (cm, index, STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE); } void @@ -108,7 +106,7 @@ vlib_free_simple_counter (vlib_simple_counter_main_t * cm) vlib_stats_delete_cm (cm); - void *oldheap = vlib_stats_push_heap (cm->counters); + void *oldheap = vlib_stats_set_heap (); for (i = 0; i < vec_len (cm->counters); i++) vec_free (cm->counters[i]); vec_free (cm->counters); @@ -120,7 +118,7 @@ vlib_validate_combined_counter (vlib_combined_counter_main_t * cm, u32 index) { vlib_thread_main_t *tm = vlib_get_thread_main (); int i, resized = 0; - void *oldheap = vlib_stats_push_heap (cm->counters); + void *oldheap = vlib_stats_set_heap (); vec_validate (cm->counters, tm->n_vlib_mains - 1); for (i = 0; i < tm->n_vlib_mains; i++) @@ -133,12 +131,11 @@ vlib_validate_combined_counter (vlib_combined_counter_main_t * cm, u32 index) vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES); } + clib_mem_set_heap (oldheap); /* Avoid the epoch increase when there was no counter vector resize. */ if (resized) - vlib_stats_pop_heap (cm, oldheap, index, - 3 /*STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED */); - else - clib_mem_set_heap (oldheap); + vlib_stats_update_counter (cm, index, + STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED); } int @@ -147,7 +144,7 @@ int { vlib_thread_main_t *tm = vlib_get_thread_main (); int i; - void *oldheap = vlib_stats_push_heap (cm->counters); + void *oldheap = vlib_stats_set_heap (); /* Possibly once in recorded history */ if (PREDICT_FALSE (vec_len (cm->counters) == 0)) @@ -180,7 +177,7 @@ vlib_free_combined_counter (vlib_combined_counter_main_t * cm) vlib_stats_delete_cm (cm); - void *oldheap = vlib_stats_push_heap (cm->counters); + void *oldheap = vlib_stats_set_heap (); for (i = 0; i < vec_len (cm->counters); i++) vec_free (cm->counters[i]); vec_free (cm->counters); |