mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
cleaned bench source folder
This commit is contained in:
parent
4b9949de7b
commit
5833c1dec8
@ -12,8 +12,7 @@ bench: bench.cpp
|
||||
|
||||
spdlog-null-async: spdlog-null-async.cpp
|
||||
$(CXX) spdlog-null-async.cpp -o spdlog-null-async $(CXXFLAGS) $(CXX_RELEASE_FLAGS)
|
||||
|
||||
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
//
|
||||
// Copyright(c) 2015 Gabi Melman.
|
||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
//
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
|
||||
#include "spdlog/sinks/simple_file_sink.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
int main(int, char *[])
|
||||
{
|
||||
using namespace std::chrono;
|
||||
using clock = steady_clock;
|
||||
|
||||
int howmany = 1000000;
|
||||
|
||||
auto logger = spdlog::create<spdlog::sinks::simple_file_sink_st>("file_logger", "logs/spdlog-bench.log", false);
|
||||
logger->set_pattern("[%Y-%m-%d %T.%F]: %L %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 = " << std::fixed << deltaf << " seconds" << std::endl;
|
||||
std::cout << "Rate = " << std::fixed << rate << "/sec" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user