diff options
author | Jon Atack <jon@atack.com> | 2022-07-11 10:58:29 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2023-03-07 08:47:40 -0800 |
commit | d8deba8c36a42481b1c1e73009d7c9cc2cb25f70 (patch) | |
tree | 93217bfaaba5d30c09b4ccb8a147cae884e945ba /src/bench | |
parent | 102b2033493f0d61e9763d094cb8a0017f7e3a10 (diff) |
bench: add LogPrintfCategory and LogPrintLevel benchmarks
for these new macros that our logging is planned to migrate to. At some
point it may be feasible to drop some of the previous logging benchmarks.
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/logging.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bench/logging.cpp b/src/bench/logging.cpp index a7162d09ac..f6e5bc54e8 100644 --- a/src/bench/logging.cpp +++ b/src/bench/logging.cpp @@ -20,6 +20,18 @@ static void Logging(benchmark::Bench& bench, const std::vector<const char*>& ext bench.run([&] { log(); }); } +static void LogPrintLevelWithThreadNames(benchmark::Bench& bench) +{ + Logging(bench, {"-logthreadnames=1", "-debug=net"}, [] { + LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", "test"); }); +} + +static void LogPrintLevelWithoutThreadNames(benchmark::Bench& bench) +{ + Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] { + LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", "test"); }); +} + static void LogPrintWithCategory(benchmark::Bench& bench) { Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] { LogPrint(BCLog::NET, "%s\n", "test"); }); @@ -30,6 +42,20 @@ static void LogPrintWithoutCategory(benchmark::Bench& bench) Logging(bench, {"-logthreadnames=0", "-debug=0"}, [] { LogPrint(BCLog::NET, "%s\n", "test"); }); } +static void LogPrintfCategoryWithThreadNames(benchmark::Bench& bench) +{ + Logging(bench, {"-logthreadnames=1", "-debug=net"}, [] { + LogPrintfCategory(BCLog::NET, "%s\n", "test"); + }); +} + +static void LogPrintfCategoryWithoutThreadNames(benchmark::Bench& bench) +{ + Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] { + LogPrintfCategory(BCLog::NET, "%s\n", "test"); + }); +} + static void LogPrintfWithThreadNames(benchmark::Bench& bench) { Logging(bench, {"-logthreadnames=1"}, [] { LogPrintf("%s\n", "test"); }); @@ -48,8 +74,12 @@ static void LogWithoutWriteToFile(benchmark::Bench& bench) }); } +BENCHMARK(LogPrintLevelWithThreadNames, benchmark::PriorityLevel::HIGH); +BENCHMARK(LogPrintLevelWithoutThreadNames, benchmark::PriorityLevel::HIGH); BENCHMARK(LogPrintWithCategory, benchmark::PriorityLevel::HIGH); BENCHMARK(LogPrintWithoutCategory, benchmark::PriorityLevel::HIGH); +BENCHMARK(LogPrintfCategoryWithThreadNames, benchmark::PriorityLevel::HIGH); +BENCHMARK(LogPrintfCategoryWithoutThreadNames, benchmark::PriorityLevel::HIGH); BENCHMARK(LogPrintfWithThreadNames, benchmark::PriorityLevel::HIGH); BENCHMARK(LogPrintfWithoutThreadNames, benchmark::PriorityLevel::HIGH); BENCHMARK(LogWithoutWriteToFile, benchmark::PriorityLevel::HIGH); |