aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-06-20 17:50:39 +0200
committerJon Atack <jon@atack.com>2021-06-24 11:13:10 +0200
commit10f4ce20783cbbcb0c0997c605452d9e60827e6d (patch)
tree304a140f3101b8ddcd1a40b038895a969112d9cb /src/bench
parent965e93743454112c0c3c66bf24852f63ee07b862 (diff)
downloadbitcoin-10f4ce20783cbbcb0c0997c605452d9e60827e6d.tar.xz
bench: bench.h fixes and improvements
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/bench.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/bench/bench.h b/src/bench/bench.h
index 22f06d8cb8..c4fcd80e33 100644
--- a/src/bench/bench.h
+++ b/src/bench/bench.h
@@ -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);