On Thu, Mar 14, 2024 at 8:56 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Thu, Mar 14, 2024 at 7:33 PM Alexei Starovoitov > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > On Tue, Mar 12, 2024 at 3:23 PM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > > > > > > > > static void trigger_base_measure(struct bench_res *res) > > > { > > > - res->hits = atomic_swap(&base_hits.value, 0); > > > + res->hits = sum_counters(base_hits); > > > } > > > > > > static void *trigger_producer(void *input) > > > @@ -42,7 +72,7 @@ static void *trigger_producer(void *input) > > > > > > static void trigger_measure(struct bench_res *res) > > > { > > > - res->hits = atomic_swap(&ctx.skel->bss->hits, 0); > > > + res->hits = sum_counters(ctx.skel->bss->hits); > > > } > > > > It was zeroing counters before. > > Do you need to zero them now? > > > > sum_counters() does zero them out, it does the same atomic_swap(0). I simply missed the swap in there. Could you rename it to sum_and_zero_counters() or something, so it's obvious? A helper that says 'sum_counters' isn't expected to have such side effects.