mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 22:42:04 +01:00
bench: bench.h fixes and improvements
This commit is contained in:
parent
965e937434
commit
10f4ce2078
1 changed files with 11 additions and 7 deletions
|
@ -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…
Add table
Reference in a new issue