1 /* SPDX-License-Identifier: GPL-2.0 */
9 #include <bpf/libbpf.h>
12 #include <sys/syscall.h>
32 struct cpu_set prod_cpus;
33 struct cpu_set cons_cpus;
53 const struct argp *argp;
54 void (*validate)(void);
56 void *(*producer_thread)(void *ctx);
57 void *(*consumer_thread)(void *ctx);
58 void (*measure)(struct bench_res* res);
59 void (*report_progress)(int iter, struct bench_res* res, long delta_ns);
60 void (*report_final)(struct bench_res res[], int res_cnt);
65 } __attribute__((aligned(128)));
67 extern struct env env;
68 extern const struct bench *bench;
70 void setup_libbpf(void);
71 void hits_drops_report_progress(int iter, struct bench_res *res, long delta_ns);
72 void hits_drops_report_final(struct bench_res res[], int res_cnt);
73 void false_hits_report_progress(int iter, struct bench_res *res, long delta_ns);
74 void false_hits_report_final(struct bench_res res[], int res_cnt);
75 void ops_report_progress(int iter, struct bench_res *res, long delta_ns);
76 void ops_report_final(struct bench_res res[], int res_cnt);
77 void local_storage_report_progress(int iter, struct bench_res *res,
79 void local_storage_report_final(struct bench_res res[], int res_cnt);
80 void grace_period_latency_basic_stats(struct bench_res res[], int res_cnt,
81 struct basic_stats *gp_stat);
82 void grace_period_ticks_basic_stats(struct bench_res res[], int res_cnt,
83 struct basic_stats *gp_stat);
85 static inline void atomic_inc(long *value)
87 (void)__atomic_add_fetch(value, 1, __ATOMIC_RELAXED);
90 static inline void atomic_add(long *value, long n)
92 (void)__atomic_add_fetch(value, n, __ATOMIC_RELAXED);
95 static inline long atomic_swap(long *value, long n)
97 return __atomic_exchange_n(value, n, __ATOMIC_RELAXED);