bench: bench.h fixes and improvements

pull/826/head
Jon Atack 3 years ago
parent 965e937434
commit 10f4ce2078
No known key found for this signature in database
GPG Key ID: 4F5721B3D0E3921D

@ -18,16 +18,19 @@
/*
* Usage:
static void CODE_TO_TIME(benchmark::Bench& bench)
static void NameOfYourBenchmarkFunction(benchmark::Bench& bench)
{
... do any setup needed...
nanobench::Config().run([&] {
... do stuff you want to time...
...do any setup needed...
bench.run([&] {
...do stuff you want to time; refer to src/bench/nanobench.h
for more information and the options that can be passed here...
});
... do any cleanup needed...
...do any cleanup needed...
}
BENCHMARK(CODE_TO_TIME);
BENCHMARK(NameOfYourBenchmarkFunction);
*/
@ -55,7 +58,8 @@ public:
static void RunAll(const Args& args);
};
}
} // namespace benchmark
// BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo);
#define BENCHMARK(n) \
benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n);

Loading…
Cancel
Save