aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/counter.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-04-02 11:53:26 +0000
committerDave Barach <openvpp@barachs.net>2019-04-02 21:15:29 +0000
commitfe269f3c6f350444a17e4829311ac64dd0175641 (patch)
treed9b4bd966079209fbd16614b89e794120d95d48d /src/vlib/counter.c
parent096f2f83f62bc7eea269d651172ec27b2ec3522f (diff)
stat-segment: scaling improvement
don't walk the entire list of entries each time a new one is added approximate/indicative numbers recorded on a VM: after: 50000 tunnels in 1.124443 secs, 44466.45 tunnels/sec before: 50000 tunnels in 5.202779 secs, 9610.25 tunnels/sec Change-Id: Ie1155416be76f55f2a0a88360ce53e15aeace785 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vlib/counter.c')
-rw-r--r--src/vlib/counter.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vlib/counter.c b/src/vlib/counter.c
index 5c3350fceec..5b73d5fa21a 100644
--- a/src/vlib/counter.c
+++ b/src/vlib/counter.c
@@ -74,16 +74,16 @@ vlib_clear_combined_counters (vlib_combined_counter_main_t * cm)
}
}
-void *vlib_stats_push_heap (void) __attribute__ ((weak));
+void *vlib_stats_push_heap (void *) __attribute__ ((weak));
void *
-vlib_stats_push_heap (void)
+vlib_stats_push_heap (void *unused)
{
return 0;
};
-void vlib_stats_pop_heap (void *, void *, int) __attribute__ ((weak));
+void vlib_stats_pop_heap (void *, void *, u32, int) __attribute__ ((weak));
void
-vlib_stats_pop_heap (void *notused, void *notused2, int type)
+vlib_stats_pop_heap (void *notused, void *notused2, u32 i, int type)
{
};
@@ -92,13 +92,13 @@ vlib_validate_simple_counter (vlib_simple_counter_main_t * cm, u32 index)
{
vlib_thread_main_t *tm = vlib_get_thread_main ();
int i;
- void *oldheap = vlib_stats_push_heap ();
+ void *oldheap = vlib_stats_push_heap (cm->counters);
vec_validate (cm->counters, tm->n_vlib_mains - 1);
for (i = 0; i < tm->n_vlib_mains; i++)
vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES);
- vlib_stats_pop_heap (cm, oldheap,
+ vlib_stats_pop_heap (cm, oldheap, index,
2 /* STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE */ );
}
@@ -107,13 +107,13 @@ vlib_validate_combined_counter (vlib_combined_counter_main_t * cm, u32 index)
{
vlib_thread_main_t *tm = vlib_get_thread_main ();
int i;
- void *oldheap = vlib_stats_push_heap ();
+ void *oldheap = vlib_stats_push_heap (cm->counters);
vec_validate (cm->counters, tm->n_vlib_mains - 1);
for (i = 0; i < tm->n_vlib_mains; i++)
vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES);
- vlib_stats_pop_heap (cm, oldheap,
+ vlib_stats_pop_heap (cm, oldheap, index,
3 /*STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED */ );
}