Skip to content

Commit 10f4ce2

Browse files
committed
bench: bench.h fixes and improvements
1 parent 965e937 commit 10f4ce2

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/bench/bench.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@
1818
/*
1919
* Usage:
2020
21-
static void CODE_TO_TIME(benchmark::Bench& bench)
21+
static void NameOfYourBenchmarkFunction(benchmark::Bench& bench)
2222
{
23-
... do any setup needed...
24-
nanobench::Config().run([&] {
25-
... do stuff you want to time...
23+
...do any setup needed...
24+
25+
bench.run([&] {
26+
...do stuff you want to time; refer to src/bench/nanobench.h
27+
for more information and the options that can be passed here...
2628
});
27-
... do any cleanup needed...
29+
30+
...do any cleanup needed...
2831
}
2932
30-
BENCHMARK(CODE_TO_TIME);
33+
BENCHMARK(NameOfYourBenchmarkFunction);
3134
3235
*/
3336

@@ -55,7 +58,8 @@ class BenchRunner
5558

5659
static void RunAll(const Args& args);
5760
};
58-
}
61+
} // namespace benchmark
62+
5963
// BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo);
6064
#define BENCHMARK(n) \
6165
benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n);

0 commit comments

Comments
 (0)