mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
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.
This commit is contained in:
parent
102b203349
commit
d8deba8c36
1 changed files with 30 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue