aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonatack <jon@atack.com>2023-01-23 07:49:46 -0800
committerJon Atack <jon@atack.com>2023-03-07 09:32:55 -0800
commit20d89d6802b67e2b8c864bedf23673d008e3faab (patch)
treefe993c25fa8ee3be429cea4c54b67f0887e9029a
parentd8deba8c36a42481b1c1e73009d7c9cc2cb25f70 (diff)
bench: document expected results in logging benchmarks
and clarify the intention behind the -nodebuglogfile bench. Co-authored-by: "kouloumos <kouloumosa@gmail.com>" Co-authored-by: "Larry Ruane <larryruane@gmail.com>"
-rw-r--r--src/bench/logging.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bench/logging.cpp b/src/bench/logging.cpp
index f6e5bc54e8..9aedb26236 100644
--- a/src/bench/logging.cpp
+++ b/src/bench/logging.cpp
@@ -6,6 +6,11 @@
#include <logging.h>
#include <test/util/setup_common.h>
+// All but 2 of the benchmarks should have roughly similar performance:
+//
+// LogPrintWithoutCategory should be ~3 orders of magnitude faster, as nothing is logged.
+//
+// LogWithoutWriteToFile should be ~2 orders of magnitude faster, as it avoids disk writes.
static void Logging(benchmark::Bench& bench, const std::vector<const char*>& extra_args, const std::function<void()>& log)
{
@@ -68,6 +73,7 @@ static void LogPrintfWithoutThreadNames(benchmark::Bench& bench)
static void LogWithoutWriteToFile(benchmark::Bench& bench)
{
+ // Disable writing the log to a file, as used for unit tests and fuzzing in `MakeNoLogFileContext`.
Logging(bench, {"-nodebuglogfile", "-debug=1"}, [] {
LogPrintf("%s\n", "test");
LogPrint(BCLog::NET, "%s\n", "test");