Commit c56fae39 authored by gabime's avatar gabime

bench small change

parent 7f043452
...@@ -12,6 +12,5 @@ int main(int, char* []) ...@@ -12,6 +12,5 @@ int main(int, char* [])
logger->set_pattern("[%Y-%b-%d %T.%e]: %v"); logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
for(int i = 0 ; i < howmany; ++i) for(int i = 0 ; i < howmany; ++i)
logger->info() << "spdlog message #" << i << ": This is some text for your pleasure"; logger->info() << "spdlog message #" << i << ": This is some text for your pleasure";
return 0; return 0;
} }
...@@ -63,7 +63,7 @@ int main(int argc, char* argv[]) ...@@ -63,7 +63,7 @@ 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, flush every " << flush_interval << " lines"<< endl;
cout << "*******************************************************************************\n"; cout << "*******************************************************************************\n";
...@@ -85,23 +85,19 @@ int main(int argc, char* argv[]) ...@@ -85,23 +85,19 @@ int main(int argc, char* argv[])
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", flush_interval);
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, flush every " << flush_interval << " lines" << endl;
cout << "*******************************************************************************\n"; cout << "*******************************************************************************\n";
spdlog::set_async_mode(howmany); spdlog::set_async_mode(howmany);
auto rotating_st_async = spdlog::rotating_logger_st("rotating_st_Async", "logs/rotating_st_async", file_size, rotating_files, flush_interval); auto rotating_st_async = spdlog::rotating_logger_st("rotating_async", "logs/rotating_async", file_size, rotating_files, flush_interval);
bench(howmany, rotating_st_async); bench(howmany, rotating_st_async);
auto daily_st_async = spdlog::daily_logger_st("daily_st_async", "logs/daily_st_async", flush_interval); auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", flush_interval);
bench(howmany, daily_st_async); bench(howmany, daily_st_async);
bench(howmany, spdlog::create<null_sink_st>("null_st_async")); bench(howmany, spdlog::create<null_sink_st>("null_async"));
spdlog::stop(); spdlog::stop();
cin.ignore();
} }
catch (std::exception &ex) catch (std::exception &ex)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment