mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 09:59:33 +08:00
Update easyloggingpp, Add plog
This commit is contained in:
34
bench/plog-bench.cpp
Normal file
34
bench/plog-bench.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright(c) 2015 Gabi Melman.
|
||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
//
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include "plog/Log.h"
|
||||
|
||||
int main(int, char *[])
|
||||
{
|
||||
using namespace std::chrono;
|
||||
using clock = steady_clock;
|
||||
|
||||
int howmany = 1000000;
|
||||
|
||||
plog::init(plog::debug, "logs/plog-bench.log");
|
||||
|
||||
auto start = clock::now();
|
||||
for (int i = 0; i < howmany; ++i)
|
||||
LOG_INFO << "plog message #" << i << ": This is some text for your pleasure";
|
||||
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user