|
|
@ -52,7 +52,7 @@ int main(int argc, char* argv[])
|
|
|
|
|
|
|
|
|
|
|
|
int howmany = 1000000;
|
|
|
|
int howmany = 1000000;
|
|
|
|
int threads = 10;
|
|
|
|
int threads = 10;
|
|
|
|
int flush_interval = 0;
|
|
|
|
bool auto_flush = true;
|
|
|
|
int file_size = 30 * 1024 * 1024;
|
|
|
|
int file_size = 30 * 1024 * 1024;
|
|
|
|
int rotating_files = 5;
|
|
|
|
int rotating_files = 5;
|
|
|
|
|
|
|
|
|
|
|
@ -63,39 +63,38 @@ int main(int argc, char* argv[])
|
|
|
|
howmany = atoi(argv[1]);
|
|
|
|
howmany = atoi(argv[1]);
|
|
|
|
if (argc > 2)
|
|
|
|
if (argc > 2)
|
|
|
|
threads = atoi(argv[2]);
|
|
|
|
threads = atoi(argv[2]);
|
|
|
|
/*
|
|
|
|
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
cout << "Single thread, " << format(howmany) << " iterations, flush every " << flush_interval << " lines"<< endl;
|
|
|
|
cout << "Single thread, " << format(howmany) << " iterations, auto flush=" << auto_flush << endl;
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
|
|
|
|
|
|
|
|
auto rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_st", file_size, rotating_files, flush_interval);
|
|
|
|
auto rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_st", file_size, rotating_files, auto_flush);
|
|
|
|
bench(howmany, rotating_st);
|
|
|
|
bench(howmany, rotating_st);
|
|
|
|
auto daily_st = spdlog::daily_logger_st("daily_st", "logs/daily_st", flush_interval);
|
|
|
|
auto daily_st = spdlog::daily_logger_st("daily_st", "logs/daily_st", auto_flush);
|
|
|
|
bench(howmany, daily_st);
|
|
|
|
bench(howmany, daily_st);
|
|
|
|
bench(howmany, spdlog::create<null_sink_st>("null_st"));
|
|
|
|
bench(howmany, spdlog::create<null_sink_st>("null_st"));
|
|
|
|
|
|
|
|
|
|
|
|
cout << "\n*******************************************************************************\n";
|
|
|
|
cout << "\n*******************************************************************************\n";
|
|
|
|
cout << threads << " threads sharing same logger, " << format(howmany) << " iterations, flush every " << flush_interval << " lines" << endl;
|
|
|
|
cout << threads << " threads sharing same logger, " << format(howmany) << " iterations, auto_flush=" << auto_flush << endl;
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
|
|
|
|
|
|
|
|
auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt", file_size, rotating_files, flush_interval);
|
|
|
|
auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt", file_size, rotating_files, auto_flush);
|
|
|
|
bench_mt(howmany, rotating_mt, threads);
|
|
|
|
bench_mt(howmany, rotating_mt, threads);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt", flush_interval);
|
|
|
|
auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt", auto_flush);
|
|
|
|
bench_mt(howmany, daily_mt, threads);
|
|
|
|
bench_mt(howmany, daily_mt, threads);
|
|
|
|
bench(howmany, spdlog::create<null_sink_st>("null_mt"));
|
|
|
|
bench(howmany, spdlog::create<null_sink_st>("null_mt"));
|
|
|
|
|
|
|
|
|
|
|
|
cout << "\n*******************************************************************************\n";
|
|
|
|
cout << "\n*******************************************************************************\n";
|
|
|
|
cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, flush every " << flush_interval << " lines" << endl;
|
|
|
|
cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, auto_flush=" << auto_flush << endl;
|
|
|
|
e cout << "*******************************************************************************\n";
|
|
|
|
cout << "*******************************************************************************\n";
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spdlog::set_async_mode(2500);
|
|
|
|
spdlog::set_async_mode(2500);
|
|
|
|
auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", flush_interval);
|
|
|
|
auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", auto_flush);
|
|
|
|
bench_mt(howmany, daily_st_async, threads);
|
|
|
|
bench_mt(howmany, daily_st_async, threads);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spdlog::stop();
|
|
|
|
spdlog::stop();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|