summaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/init.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-04-15 15:27:24 +0200
committerFlorin Coras <florin.coras@gmail.com>2022-04-15 17:53:11 +0000
commit4b922ff051f1e0adb27c9b4cd13c10069a657a98 (patch)
tree25a0ea663ac7ab123a3170c2370947ea506251dd /src/vlib/stats/init.c
parent8cb5d36c7e7492d3cc314e6b78dea571bbcc4889 (diff)
stats: store heap in the directory_entry vector
Type: improvement Change-Id: I878803d14d1070ef5a00ed9d3f72022906d55191 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/stats/init.c')
-rw-r--r--src/vlib/stats/init.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/vlib/stats/init.c b/src/vlib/stats/init.c
index 2a7b6f53c53..16a47c2f78d 100644
--- a/src/vlib/stats/init.c
+++ b/src/vlib/stats/init.c
@@ -45,7 +45,6 @@ vlib_stats_init (vlib_main_t *vm)
vlib_stats_shared_header_t *shared_header;
vlib_stats_collector_reg_t reg = {};
- void *oldheap;
uword memory_size, sys_page_sz;
int mfd;
char *mem_name = "stat segment";
@@ -94,16 +93,14 @@ vlib_stats_init (vlib_main_t *vm)
sm->n_locks = 0;
clib_spinlock_init (sm->stat_segment_lockp);
- oldheap = clib_mem_set_heap (sm->heap);
-
/* Set up the name to counter-vector hash table */
- sm->directory_vector = 0;
+ sm->directory_vector =
+ vec_new_heap (typeof (sm->directory_vector[0]), STAT_COUNTERS, heap);
sm->dir_vector_first_free_elt = CLIB_U32_MAX;
shared_header->epoch = 1;
/* Scalar stats and node counters */
- vec_validate (sm->directory_vector, STAT_COUNTERS - 1);
#define _(E, t, n, p) \
strcpy (sm->directory_vector[STAT_COUNTER_##E].name, p "/" #n); \
sm->directory_vector[STAT_COUNTER_##E].type = STAT_DIR_TYPE_##t;
@@ -112,8 +109,6 @@ vlib_stats_init (vlib_main_t *vm)
/* Save the vector in the shared segment, for clients */
shared_header->directory_vector = sm->directory_vector;
- clib_mem_set_heap (oldheap);
-
vlib_stats_register_mem_heap (heap);
reg.collect_fn = vector_rate_collector_fn;