mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 18:41:35 +08:00
Fixed bench
This commit is contained in:
parent
63507e5de6
commit
92d06834cf
@ -31,21 +31,22 @@ static const size_t file_size = 30 * 1024 * 1024;
|
|||||||
static const size_t rotating_files = 5;
|
static const size_t rotating_files = 5;
|
||||||
static const int max_threads = 1000;
|
static const int max_threads = 1000;
|
||||||
|
|
||||||
|
using namespace spdlog::sinks;
|
||||||
void bench_threaded_logging(size_t threads, int iters) {
|
void bench_threaded_logging(size_t threads, int iters) {
|
||||||
spdlog::info("**************************************************************");
|
spdlog::info("**************************************************************");
|
||||||
spdlog::info(
|
spdlog::info(
|
||||||
spdlog::fmt_lib::format(std::locale("en_US.UTF-8"), "Multi threaded: {:L} threads, {:L} messages", threads, iters));
|
spdlog::fmt_lib::format(std::locale("en_US.UTF-8"), "Multi threaded: {:L} threads, {:L} messages", threads, iters));
|
||||||
spdlog::info("**************************************************************");
|
spdlog::info("**************************************************************");
|
||||||
|
|
||||||
auto basic_mt = spdlog::basic_logger_mt("basic_mt", "logs/basic_mt.log", true);
|
auto basic_mt = spdlog::create<basic_file_sink_mt>("basic_mt", "logs/basic_mt.log", true);
|
||||||
bench_mt(iters, std::move(basic_mt), threads);
|
bench_mt(iters, std::move(basic_mt), threads);
|
||||||
|
|
||||||
spdlog::info("");
|
spdlog::info("");
|
||||||
auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt.log", file_size, rotating_files);
|
auto rotating_mt = spdlog::create<rotating_file_sink_mt>("rotating_mt", "logs/rotating_mt.log", file_size, rotating_files);
|
||||||
bench_mt(iters, std::move(rotating_mt), threads);
|
bench_mt(iters, std::move(rotating_mt), threads);
|
||||||
|
|
||||||
spdlog::info("");
|
spdlog::info("");
|
||||||
auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt.log");
|
auto daily_mt = spdlog::create<daily_file_sink_mt>("daily_mt", "logs/daily_mt.log", 0, 1);
|
||||||
bench_mt(iters, std::move(daily_mt), threads);
|
bench_mt(iters, std::move(daily_mt), threads);
|
||||||
|
|
||||||
spdlog::info("");
|
spdlog::info("");
|
||||||
@ -59,15 +60,15 @@ void bench_single_threaded(int iters) {
|
|||||||
spdlog::info(spdlog::fmt_lib::format(std::locale("en_US.UTF-8"), "Single threaded: {} messages", iters));
|
spdlog::info(spdlog::fmt_lib::format(std::locale("en_US.UTF-8"), "Single threaded: {} messages", iters));
|
||||||
spdlog::info("**************************************************************");
|
spdlog::info("**************************************************************");
|
||||||
|
|
||||||
auto basic_st = spdlog::basic_logger_st("basic_st", "logs/basic_st.log", true);
|
auto basic_st = spdlog::create<basic_file_sink_st>("basic_st", "logs/basic_st.log", true);
|
||||||
bench(iters, std::move(basic_st));
|
bench(iters, std::move(basic_st));
|
||||||
|
|
||||||
spdlog::info("");
|
spdlog::info("");
|
||||||
auto rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_st.log", file_size, rotating_files);
|
auto rotating_st = spdlog::create<rotating_file_sink_st>("rotating_st", "logs/rotating_st.log", file_size, rotating_files);
|
||||||
bench(iters, std::move(rotating_st));
|
bench(iters, std::move(rotating_st));
|
||||||
|
|
||||||
spdlog::info("");
|
spdlog::info("");
|
||||||
auto daily_st = spdlog::daily_logger_st("daily_st", "logs/daily_st.log");
|
auto daily_st = spdlog::create<daily_file_sink_st>("daily_st", "logs/daily_st.log", 0, 1);
|
||||||
bench(iters, std::move(daily_st));
|
bench(iters, std::move(daily_st));
|
||||||
|
|
||||||
spdlog::info("");
|
spdlog::info("");
|
||||||
|
Loading…
Reference in New Issue
Block a user