mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
cache sprintf of time in default formatter
This commit is contained in:
@@ -48,20 +48,26 @@ void testlog(int threads)
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if(argc || argv){};
|
||||
using namespace std::chrono;
|
||||
using namespace c11log;
|
||||
using namespace utils;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
//auto fsink2 = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, seconds(1));
|
||||
auto fsink = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, seconds(1));
|
||||
auto &my_logger = get_logger("example");
|
||||
auto null_sink = std::make_shared<sinks::null_sink>();
|
||||
//auto async = std::make_shared<sinks::async_sink>(1000);
|
||||
//async->add_sink(fsink);
|
||||
my_logger.add_sink(null_sink);
|
||||
auto start = system_clock::now();
|
||||
|
||||
const unsigned int howmany = 10000000;
|
||||
for(unsigned int i = 0; i < howmany ; i++)
|
||||
my_logger.info() << "Hello logger " << i;
|
||||
|
||||
|
||||
//async->shutdown(seconds(3));
|
||||
auto delta = system_clock::now() - start;
|
||||
auto delta_d = duration_cast<duration<double>> (delta);
|
||||
cout << "Total " << format(howmany) << endl;
|
||||
@@ -71,7 +77,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
/*
|
||||
if(argc !=3) {
|
||||
std::cerr << "Usage: " << argv[0] << " qsize, threads" << std::endl;
|
||||
return 0;
|
||||
@@ -93,5 +99,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
testlog(threads);
|
||||
*/
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user