update and change how we build with spdlog
This commit is contained in:
20
third_party/spdlog/bench/formatter-bench.cpp
vendored
20
third_party/spdlog/bench/formatter-bench.cpp
vendored
@ -8,27 +8,15 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "spdlog/details/pattern_formatter.h"
|
||||
|
||||
void bench_scoped_pad(benchmark::State &state, size_t wrapped_size, spdlog::details::padding_info padinfo)
|
||||
{
|
||||
fmt::memory_buffer dest;
|
||||
for (auto _ : state)
|
||||
{
|
||||
{
|
||||
spdlog::details::scoped_pad p(wrapped_size, padinfo, dest);
|
||||
benchmark::DoNotOptimize(p);
|
||||
dest.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bench_formatter(benchmark::State &state, std::string pattern)
|
||||
{
|
||||
auto formatter = spdlog::details::make_unique<spdlog::pattern_formatter>(pattern);
|
||||
fmt::memory_buffer dest;
|
||||
spdlog::memory_buf_t dest;
|
||||
std::string logger_name = "logger-name";
|
||||
const char *text = "Hello. This is some message with length of 80 ";
|
||||
|
||||
spdlog::details::log_msg msg(&logger_name, spdlog::level::info, text);
|
||||
spdlog::source_loc source_loc{"a/b/c/d/myfile.cpp", 123, "some_func()"};
|
||||
spdlog::details::log_msg msg(source_loc, logger_name, spdlog::level::info, text);
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
@ -41,7 +29,7 @@ void bench_formatter(benchmark::State &state, std::string pattern)
|
||||
void bench_formatters()
|
||||
{
|
||||
// basic patterns(single flag)
|
||||
std::string all_flags = "+vtPnlLaAbBcCYDmdHIMSefFprRTXzEi%";
|
||||
std::string all_flags = "+vtPnlLaAbBcCYDmdHIMSefFprRTXzEisg@luioO%";
|
||||
std::vector<std::string> basic_patterns;
|
||||
for (auto &flag : all_flags)
|
||||
{
|
||||
|
Reference in New Issue
Block a user