On Thu, Sep 12, 2024 at 2:34 PM Mattias Rönnblom <mattias.ronnb...@ericsson.com> wrote: > > Add basic micro benchmark for lcore variables, in an attempt to assure > that the overhead isn't significantly greater than alternative > approaches, in scenarios where the benefits aren't expected to show up > (i.e., when plenty of cache is available compared to the working set > size of the per-lcore data). > > Signed-off-by: Mattias Rönnblom <mattias.ronnb...@ericsson.com> > --- > app/test/meson.build | 1 + > app/test/test_lcore_var_perf.c | 160 +++++++++++++++++++++++++++++++++ > 2 files changed, 161 insertions(+) > create mode 100644 app/test/test_lcore_var_perf.c
> +static double > +benchmark_access_method(void (*init_fun)(void), void (*update_fun)(void)) > +{ > + uint64_t i; > + uint64_t start; > + uint64_t end; > + double latency; > + > + init_fun(); > + > + start = rte_get_timer_cycles(); > + > + for (i = 0; i < ITERATIONS; i++) > + update_fun(); > + > + end = rte_get_timer_cycles(); Use precise variant. rte_rdtsc_precise() or so to be accurate