From b17726fe51a1c7c1eccaef2e90cbab7ee022557f Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sun, 26 Mar 2023 18:55:32 +0200 Subject: [benchmarks] DO_NOT_OPTIMIZE macro --- source/kit_test/bench.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/kit_test') diff --git a/source/kit_test/bench.h b/source/kit_test/bench.h index 131d89d..6c701bb 100644 --- a/source/kit_test/bench.h +++ b/source/kit_test/bench.h @@ -73,12 +73,21 @@ void kit_bench_register(char const *name, char const *file, kit_bench_end_fn_(kit_bench_index_); \ } +/* FIXME + */ +#define KIT_DO_NOT_OPTIMIZE(x) \ + do { \ + volatile void *bench_ptr_ = &(x); \ + (void) bench_ptr_; \ + } while (0) + int kit_run_benchmarks(int argc, char **argv); #ifndef KIT_DISABLE_SHORT_NAMES # define BENCHMARK KIT_BENCHMARK # define BENCHMARK_BEGIN KIT_BENCHMARK_BEGIN # define BENCHMARK_END KIT_BENCHMARK_END +# define DO_NOT_OPTIMIZE KIT_DO_NOT_OPTIMIZE # define bench_register kit_bench_register # define run_benchmarks kit_run_benchmarks -- cgit v1.2.3