Skip to content

Commit 4684aa8

Browse files
LarryRuanejonatack
authored andcommitted
bench: allow logging benchmarks to be order-independent
The global logging object instance is not re-created for each run, so when multiple logging benchmarks are run, each one after the first one still has the logging categories enabled from the previous ones. This commit disables all categories at the start of each benchmark.
1 parent a62231b commit 4684aa8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/bench/logging.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
static void Logging(benchmark::Bench& bench, const std::vector<const char*>& extra_args, const std::function<void()>& log)
1111
{
12+
// Reset any enabled logging categories from a previous benchmark run.
13+
LogInstance().DisableCategory(BCLog::LogFlags::ALL);
14+
1215
TestingSetup test_setup{
1316
CBaseChainParams::REGTEST,
1417
extra_args,

0 commit comments

Comments
 (0)