From 6ff8ff66d1db6d1af48340be6ebf3da1c9316bea Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 17 May 2014 07:53:24 +0800 Subject: [PATCH] one more scope for benchmarks --- tests/bench.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/bench.h b/tests/bench.h index 1feecb0..3f8133b 100644 --- a/tests/bench.h +++ b/tests/bench.h @@ -25,15 +25,18 @@ typedef struct { #define BENCHMARK(name) \ - bench B; B.N = 5000000; B.R = 3; \ - bench_start(&B); \ - for (int _r = 0; _r < B.R ; _r++ ) { \ - for (int _i = 0; _i < B.N ; _i++ ) { + { \ + bench B; B.N = 5000000; B.R = 3; \ + bench_start(&B); \ + for (int _r = 0; _r < B.R ; _r++ ) { \ + for (int _i = 0; _i < B.N ; _i++ ) { #define END_BENCHMARK() \ + } \ } \ - } \ - bench_stop(&B); + bench_stop(&B); \ + } + long unixtime();