From 4684aa8733e831d7858d43bec4271d5d026ba183 Mon Sep 17 00:00:00 2001 From: Larry Ruane Date: Mon, 30 Jan 2023 07:21:36 -0800 Subject: [PATCH] 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. --- src/bench/logging.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bench/logging.cpp b/src/bench/logging.cpp index c38552f0b8..edb81ed20b 100644 --- a/src/bench/logging.cpp +++ b/src/bench/logging.cpp @@ -9,6 +9,9 @@ static void Logging(benchmark::Bench& bench, const std::vector& extra_args, const std::function& log) { + // Reset any enabled logging categories from a previous benchmark run. + LogInstance().DisableCategory(BCLog::LogFlags::ALL); + TestingSetup test_setup{ CBaseChainParams::REGTEST, extra_args,