Skip to content

Commit fadbcd5

Browse files
author
MarcoFalke
committed
bench: Remove redundant logging benchmarks
LogPrint*ThreadNames is redundant with LogWith(out)ThreadNames, because they all measure toggling the thread names (and check that it has no effect on performance). This also allows to remove unused and deprecated macros.
1 parent fa8dd95 commit fadbcd5

File tree

4 files changed

+0
-34
lines changed

4 files changed

+0
-34
lines changed

src/bench/logging.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ static void Logging(benchmark::Bench& bench, const std::vector<const char*>& ext
2828
bench.run([&] { log(); });
2929
}
3030

31-
static void LogPrintLevelWithThreadNames(benchmark::Bench& bench)
32-
{
33-
Logging(bench, {"-logthreadnames=1", "-debug=net"}, [] {
34-
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", "test"); });
35-
}
36-
37-
static void LogPrintLevelWithoutThreadNames(benchmark::Bench& bench)
38-
{
39-
Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] {
40-
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", "test"); });
41-
}
42-
4331
static void LogWithDebug(benchmark::Bench& bench)
4432
{
4533
Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] { LogDebug(BCLog::NET, "%s\n", "test"); });
@@ -50,20 +38,6 @@ static void LogWithoutDebug(benchmark::Bench& bench)
5038
Logging(bench, {"-logthreadnames=0", "-debug=0"}, [] { LogDebug(BCLog::NET, "%s\n", "test"); });
5139
}
5240

53-
static void LogPrintfCategoryWithThreadNames(benchmark::Bench& bench)
54-
{
55-
Logging(bench, {"-logthreadnames=1", "-debug=net"}, [] {
56-
LogPrintfCategory(BCLog::NET, "%s\n", "test");
57-
});
58-
}
59-
60-
static void LogPrintfCategoryWithoutThreadNames(benchmark::Bench& bench)
61-
{
62-
Logging(bench, {"-logthreadnames=0", "-debug=net"}, [] {
63-
LogPrintfCategory(BCLog::NET, "%s\n", "test");
64-
});
65-
}
66-
6741
static void LogWithThreadNames(benchmark::Bench& bench)
6842
{
6943
Logging(bench, {"-logthreadnames=1"}, [] { LogInfo("%s\n", "test"); });
@@ -83,12 +57,8 @@ static void LogWithoutWriteToFile(benchmark::Bench& bench)
8357
});
8458
}
8559

86-
BENCHMARK(LogPrintLevelWithThreadNames, benchmark::PriorityLevel::HIGH);
87-
BENCHMARK(LogPrintLevelWithoutThreadNames, benchmark::PriorityLevel::HIGH);
8860
BENCHMARK(LogWithDebug, benchmark::PriorityLevel::HIGH);
8961
BENCHMARK(LogWithoutDebug, benchmark::PriorityLevel::HIGH);
90-
BENCHMARK(LogPrintfCategoryWithThreadNames, benchmark::PriorityLevel::HIGH);
91-
BENCHMARK(LogPrintfCategoryWithoutThreadNames, benchmark::PriorityLevel::HIGH);
9262
BENCHMARK(LogWithThreadNames, benchmark::PriorityLevel::HIGH);
9363
BENCHMARK(LogWithoutThreadNames, benchmark::PriorityLevel::HIGH);
9464
BENCHMARK(LogWithoutWriteToFile, benchmark::PriorityLevel::HIGH);

src/logging.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ static inline void LogPrintf_(std::string_view logging_function, std::string_vie
273273

274274
// Deprecated unconditional logging.
275275
#define LogPrintf(...) LogInfo(__VA_ARGS__)
276-
#define LogPrintfCategory(category, ...) LogPrintLevel_(category, BCLog::Level::Info, __VA_ARGS__)
277276

278277
// Use a macro instead of a function for conditional logging to prevent
279278
// evaluating arguments when logging for the category is not enabled.

src/test/logging_tests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
116116
LogPrintLevel(BCLog::NET, BCLog::Level::Info, "foo8: %s\n", "bar8");
117117
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "foo9: %s\n", "bar9");
118118
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "foo10: %s\n", "bar10");
119-
LogPrintfCategory(BCLog::VALIDATION, "foo11: %s\n", "bar11");
120119
std::ifstream file{tmp_log_path};
121120
std::vector<std::string> log_lines;
122121
for (std::string log; std::getline(file, log);) {
@@ -128,7 +127,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
128127
"[net:info] foo8: bar8",
129128
"[net:warning] foo9: bar9",
130129
"[net:error] foo10: bar10",
131-
"[validation:info] foo11: bar11",
132130
};
133131
BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
134132
}

test/lint/lint-format-strings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
'LogDebug,1',
2727
'LogTrace,1',
2828
'LogPrintf,0',
29-
'LogPrintfCategory,1',
3029
'LogPrintLevel,2',
3130
'printf,0',
3231
'snprintf,2',

0 commit comments

Comments
 (0)