mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
clang-format
This commit is contained in:
parent
d99179f822
commit
d54e302a28
@ -12,8 +12,6 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
#include "spdlog/details/pattern_formatter.h"
|
#include "spdlog/details/pattern_formatter.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void bench_scoped_pad(benchmark::State &state, size_t wrapped_size, spdlog::details::padding_info padinfo)
|
void bench_scoped_pad(benchmark::State &state, size_t wrapped_size, spdlog::details::padding_info padinfo)
|
||||||
{
|
{
|
||||||
fmt::memory_buffer dest;
|
fmt::memory_buffer dest;
|
||||||
@ -28,16 +26,15 @@ void bench_scoped_pad(benchmark::State &state, size_t wrapped_size, spdlog::deta
|
|||||||
// printf("NOT GOOD wrapped_size=%zu\t padinfo.width= %zu\tdest = %zu\n", wrapped_size, padinfo.width_, dest.size());
|
// printf("NOT GOOD wrapped_size=%zu\t padinfo.width= %zu\tdest = %zu\n", wrapped_size, padinfo.width_, dest.size());
|
||||||
// }
|
// }
|
||||||
dest.clear();
|
dest.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
using spdlog::details::padding_info;
|
using spdlog::details::padding_info;
|
||||||
spdlog::set_pattern("[tid %t] %v");
|
spdlog::set_pattern("[tid %t] %v");
|
||||||
|
|
||||||
|
|
||||||
std::vector<size_t> sizes = {0, 2, 4, 8, 16, 32, 64, 128};
|
std::vector<size_t> sizes = {0, 2, 4, 8, 16, 32, 64, 128};
|
||||||
|
|
||||||
for (auto size : sizes)
|
for (auto size : sizes)
|
||||||
@ -47,26 +44,15 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
std::string title = "scoped_pad::left::" + std::to_string(size);
|
std::string title = "scoped_pad::left::" + std::to_string(size);
|
||||||
|
|
||||||
benchmark::RegisterBenchmark(title.c_str(),
|
benchmark::RegisterBenchmark(title.c_str(), bench_scoped_pad, wrapped_size, padding_info(padding_size, padding_info::left));
|
||||||
bench_scoped_pad,
|
|
||||||
wrapped_size,
|
|
||||||
padding_info(padding_size, padding_info::left));
|
|
||||||
|
|
||||||
title = "scoped_pad::right::" + std::to_string(size);
|
title = "scoped_pad::right::" + std::to_string(size);
|
||||||
benchmark::RegisterBenchmark(title.c_str(),
|
benchmark::RegisterBenchmark(title.c_str(), bench_scoped_pad, wrapped_size, padding_info(padding_size, padding_info::right));
|
||||||
bench_scoped_pad,
|
|
||||||
wrapped_size,
|
|
||||||
padding_info(padding_size, padding_info::right));
|
|
||||||
|
|
||||||
title = "scoped_pad::center::" + std::to_string(size);
|
title = "scoped_pad::center::" + std::to_string(size);
|
||||||
benchmark::RegisterBenchmark(title.c_str(),
|
benchmark::RegisterBenchmark(title.c_str(), bench_scoped_pad, wrapped_size, padding_info(padding_size, padding_info::center));
|
||||||
bench_scoped_pad,
|
|
||||||
wrapped_size,
|
|
||||||
padding_info(padding_size, padding_info::center));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
benchmark::Initialize(&argc, argv);
|
benchmark::Initialize(&argc, argv);
|
||||||
benchmark::RunSpecifiedBenchmarks();
|
benchmark::RunSpecifiedBenchmarks();
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,8 @@ struct padding_info
|
|||||||
class scoped_pad
|
class scoped_pad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
scoped_pad(size_t wrapped_size, padding_info &padinfo, fmt::memory_buffer &dest):
|
scoped_pad(size_t wrapped_size, padding_info &padinfo, fmt::memory_buffer &dest)
|
||||||
padinfo_(padinfo)
|
: padinfo_(padinfo)
|
||||||
, dest_(dest)
|
, dest_(dest)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -95,7 +95,6 @@ private:
|
|||||||
fmt_helper::append_string_view(string_view_t(spaces_.data(), count), dest_);
|
fmt_helper::append_string_view(string_view_t(spaces_.data(), count), dest_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const padding_info &padinfo_;
|
const padding_info &padinfo_;
|
||||||
fmt::memory_buffer &dest_;
|
fmt::memory_buffer &dest_;
|
||||||
size_t total_pad_;
|
size_t total_pad_;
|
||||||
@ -870,8 +869,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use by default full formatter for if pattern is not given
|
// use by default full formatter for if pattern is not given
|
||||||
explicit pattern_formatter(
|
explicit pattern_formatter(pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol)
|
||||||
pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol)
|
|
||||||
: pattern_()
|
: pattern_()
|
||||||
, eol_(std::move(eol))
|
, eol_(std::move(eol))
|
||||||
, pattern_time_type_(time_type)
|
, pattern_time_type_(time_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user