Changes: boost, easylogging, g2log, glog, spdlog.

This commit is contained in:
Alexander Kiselev
2018-03-19 19:22:02 +03:00
parent c83dd5d60e
commit 70ad1aa409
15 changed files with 212 additions and 46 deletions

View File

@@ -3,17 +3,32 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#include <chrono>
#include <iostream>
#include "spdlog/spdlog.h"
int main(int, char *[])
{
int howmany = 1000000;
namespace spd = spdlog;
/// Create a file rotating logger with 5mb size max and 3 rotated files
auto logger = spdlog::create<spd::sinks::simple_file_sink_st>("file_logger", "logs/spd-bench-st.txt", false);
using namespace std::chrono;
using clock = steady_clock;
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
int howmany = 1000000;
auto logger = spdlog::create<spdlog::sinks::simple_file_sink_st>("file_logger", "logs/spdlog-bench.log", false);
logger->set_pattern("[%Y-%b-%d %T.%f]: %v");
auto start = clock::now();
for (int i = 0; i < howmany; ++i)
logger->info("spdlog message #{} : This is some text for your pleasure", i);
duration<float> delta = clock::now() - start;
float deltaf = delta.count();
auto rate = howmany / deltaf;
std::cout << "Total: " << howmany << std::endl;
std::cout << "Delta = " << deltaf << " seconds" << std::endl;
std::cout << "Rate = " << rate << "/sec" << std::endl;
return 0;
}