From c83dd5d60ef28fba30ca5abd9ae217a65b8d2300 Mon Sep 17 00:00:00 2001 From: Alexander Kiselev Date: Mon, 19 Mar 2018 19:17:26 +0300 Subject: [PATCH 1/3] Added: g3log, log4cplus, log4cpp, p7. Changes: boost, easylogging, g2log, glog, spdlog. --- bench/easyl-mt.conf | 10 ++++ bench/g3log-async.cpp | 62 +++++++++++++++++++++++ bench/log4cplus-bench-mt.cpp | 80 +++++++++++++++++++++++++++++ bench/log4cplus-bench.cpp | 54 ++++++++++++++++++++ bench/log4cpp-bench-mt.cpp | 74 +++++++++++++++++++++++++++ bench/log4cpp-bench.cpp | 48 ++++++++++++++++++ bench/p7-bench-mt.cpp | 97 ++++++++++++++++++++++++++++++++++++ bench/p7-bench.cpp | 70 ++++++++++++++++++++++++++ 8 files changed, 495 insertions(+) create mode 100644 bench/easyl-mt.conf create mode 100644 bench/g3log-async.cpp create mode 100644 bench/log4cplus-bench-mt.cpp create mode 100644 bench/log4cplus-bench.cpp create mode 100644 bench/log4cpp-bench-mt.cpp create mode 100644 bench/log4cpp-bench.cpp create mode 100644 bench/p7-bench-mt.cpp create mode 100644 bench/p7-bench.cpp diff --git a/bench/easyl-mt.conf b/bench/easyl-mt.conf new file mode 100644 index 00000000..8895b281 --- /dev/null +++ b/bench/easyl-mt.conf @@ -0,0 +1,10 @@ +* GLOBAL: + FORMAT = "[%datetime]: %msg" + FILENAME = ./logs/easylogging-mt.log + ENABLED = true + TO_FILE = true + TO_STANDARD_OUTPUT = false + MILLISECONDS_WIDTH = 3 + PERFORMANCE_TRACKING = false + MAX_LOG_FILE_SIZE = 10485760 + Log_Flush_Threshold = 10485760 diff --git a/bench/g3log-async.cpp b/bench/g3log-async.cpp new file mode 100644 index 00000000..b5e15a2b --- /dev/null +++ b/bench/g3log-async.cpp @@ -0,0 +1,62 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include +#include +#include + +#include "g3log/g3log.hpp" +#include "g3log/logworker.hpp" + +using namespace std; +template std::string format(const T &value); + +int main(int argc, char *argv[]) +{ + using namespace std::chrono; + using clock = steady_clock; + int thread_count = 10; + + if (argc > 1) + thread_count = atoi(argv[1]); + + int howmany = 1000000; + + auto worker = g3::LogWorker::createLogWorker(); + auto handle= worker->addDefaultLogger(argv[0], "logs"); + g3::initializeLogging(worker.get()); + + std::atomic msg_counter{0}; + vector threads; + auto start = clock::now(); + for (int t = 0; t < thread_count; ++t) + { + threads.push_back(std::thread([&]() { + while (true) + { + int counter = ++msg_counter; + if (counter > howmany) + break; + LOG(INFO) << "g3log message #" << counter << ": This is some text for your pleasure"; + } + })); + } + + for (auto &t : threads) + { + t.join(); + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + cout << "Total: " << howmany << std::endl; + cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; +} diff --git a/bench/log4cplus-bench-mt.cpp b/bench/log4cplus-bench-mt.cpp new file mode 100644 index 00000000..6acbf3fa --- /dev/null +++ b/bench/log4cplus-bench-mt.cpp @@ -0,0 +1,80 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include +#include +#include +#include + +#include "log4cplus/logger.h" +#include "log4cplus/fileappender.h" +#include "log4cplus/layout.h" +#include "log4cplus/ndc.h" +#include "log4cplus/helpers/loglog.h" +#include "log4cplus/helpers/property.h" +#include "log4cplus/loggingmacros.h" + +using namespace log4cplus; + +int main(int argc, char * argv[]) +{ + using namespace std::chrono; + using clock = steady_clock; + + int thread_count = 10; + if (argc > 1) + thread_count = std::atoi(argv[1]); + + int howmany = 1000000; + + log4cplus::initialize(); + SharedFileAppenderPtr append( + new FileAppender(LOG4CPLUS_TEXT("logs/log4cplus-bench-mt.log"), std::ios_base::trunc, + true, true)); + append->setName(LOG4CPLUS_TEXT("File")); + + log4cplus::tstring pattern = LOG4CPLUS_TEXT("%d{%Y-%m-%d %H:%M:%S.%Q}: %p - %m %n"); + append->setLayout( std::auto_ptr(new PatternLayout(pattern)) ); + append->getloc(); + Logger::getRoot().addAppender(SharedAppenderPtr(append.get())); + + Logger root = Logger::getRoot(); + + std::atomic msg_counter{0}; + std::vector threads; + + auto start = clock::now(); + for (int t = 0; t < thread_count; ++t) + { + threads.push_back(std::thread([&]() { + while (true) + { + int counter = ++msg_counter; + if (counter > howmany) + break; + LOG4CPLUS_INFO(root, "log4cplus message #" << counter << ": This is some text for your pleasure"); + } + })); + } + + for (auto &t : threads) + { + t.join(); + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; + + log4cplus::Logger::shutdown(); + return 0; +} diff --git a/bench/log4cplus-bench.cpp b/bench/log4cplus-bench.cpp new file mode 100644 index 00000000..e522e85a --- /dev/null +++ b/bench/log4cplus-bench.cpp @@ -0,0 +1,54 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include + +#include "log4cplus/logger.h" +#include "log4cplus/fileappender.h" +#include "log4cplus/layout.h" +#include "log4cplus/ndc.h" +#include "log4cplus/helpers/loglog.h" +#include "log4cplus/helpers/property.h" +#include "log4cplus/loggingmacros.h" + +using namespace log4cplus; + +int main(int, char *[]) +{ + using namespace std::chrono; + using clock = steady_clock; + + int howmany = 1000000; + + log4cplus::initialize(); + SharedFileAppenderPtr append( + new FileAppender(LOG4CPLUS_TEXT("logs/log4cplus-bench.log"), std::ios_base::trunc, + true, true)); + append->setName(LOG4CPLUS_TEXT("File")); + + log4cplus::tstring pattern = LOG4CPLUS_TEXT("%d{%Y-%m-%d %H:%M:%S.%Q}: %p - %m %n"); + append->setLayout( std::auto_ptr(new PatternLayout(pattern)) ); + append->getloc(); + Logger::getRoot().addAppender(SharedAppenderPtr(append.get())); + + Logger root = Logger::getRoot(); + + auto start = clock::now(); + for (int i = 0; i < howmany; ++i) + LOG4CPLUS_INFO(root, "log4cplus message #" << i << ": This is some text for your pleasure"); + + duration 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; + + log4cplus::Logger::shutdown(); + return 0; +} diff --git a/bench/log4cpp-bench-mt.cpp b/bench/log4cpp-bench-mt.cpp new file mode 100644 index 00000000..82f3a40f --- /dev/null +++ b/bench/log4cpp-bench-mt.cpp @@ -0,0 +1,74 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include +#include +#include +#include + +#include "log4cpp/Category.hh" +#include "log4cpp/Appender.hh" +#include "log4cpp/FileAppender.hh" +#include "log4cpp/Layout.hh" +#include "log4cpp/BasicLayout.hh" +#include "log4cpp/Priority.hh" +#include "log4cpp/PatternLayout.hh" + +int main(int argc, char * argv[]) +{ + using namespace std::chrono; + using clock = steady_clock; + + int thread_count = 10; + if (argc > 1) + thread_count = std::atoi(argv[1]); + + int howmany = 1000000; + + log4cpp::Appender *appender = new log4cpp::FileAppender("default", "logs/log4cpp-bench-mt.log"); + log4cpp::PatternLayout *layout = new log4cpp::PatternLayout(); + layout->setConversionPattern("{%Y-%m-%d %H:%M:%S.%l}: %p - %m %n"); + appender->setLayout(layout); + + log4cpp::Category& root = log4cpp::Category::getRoot(); + root.addAppender(appender); + root.setPriority(log4cpp::Priority::INFO); + + std::atomic msg_counter{0}; + std::vector threads; + + auto start = clock::now(); + for (int t = 0; t < thread_count; ++t) + { + threads.push_back(std::thread([&]() { + while (true) + { + int counter = ++msg_counter; + if (counter > howmany) + break; + root << log4cpp::Priority::INFO << "log4cpp message #" << counter << ": This is some text for your pleasure"; + } + })); + } + + for (auto &t : threads) + { + t.join(); + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; + + root.shutdown(); + return 0; +} diff --git a/bench/log4cpp-bench.cpp b/bench/log4cpp-bench.cpp new file mode 100644 index 00000000..a21526c8 --- /dev/null +++ b/bench/log4cpp-bench.cpp @@ -0,0 +1,48 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include + +#include "log4cpp/Category.hh" +#include "log4cpp/Appender.hh" +#include "log4cpp/FileAppender.hh" +#include "log4cpp/Layout.hh" +#include "log4cpp/BasicLayout.hh" +#include "log4cpp/Priority.hh" +#include "log4cpp/PatternLayout.hh" + +int main(int, char *[]) +{ + using namespace std::chrono; + using clock = steady_clock; + + int howmany = 1000000; + + log4cpp::Appender *appender = new log4cpp::FileAppender("default", "logs/log4cpp-bench.log"); + log4cpp::PatternLayout *layout = new log4cpp::PatternLayout(); + layout->setConversionPattern("%d{%Y-%m-%d %H:%M:%S.%l}: %p - %m %n"); + appender->setLayout(layout); + + log4cpp::Category& root = log4cpp::Category::getRoot(); + root.addAppender(appender); + root.setPriority(log4cpp::Priority::INFO); + + auto start = clock::now(); + for (int i = 0; i < howmany; ++i) + root << log4cpp::Priority::INFO << "log4cpp message #" << i << ": This is some text for your pleasure"; + + duration 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; + + root.shutdown(); + return 0; +} diff --git a/bench/p7-bench-mt.cpp b/bench/p7-bench-mt.cpp new file mode 100644 index 00000000..a3195208 --- /dev/null +++ b/bench/p7-bench-mt.cpp @@ -0,0 +1,97 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include +#include +#include +#include +#include + +#include "P7_Trace.h" + + +int main(int argc, char *argv[]) +{ + using namespace std::chrono; + using clock = steady_clock; + + int thread_count = 10; + if (argc > 1) + thread_count = std::atoi(argv[1]); + + int howmany = 1000000; + + IP7_Trace::hModule module = NULL; + + //create P7 client object + std::unique_ptr> client( + P7_Create_Client(TM("/P7.Pool=1024 /P7.Sink=FileTxt /P7.Dir=logs/p7-bench-mt")), + [&](IP7_Client *ptr){ + if (ptr) + ptr->Release(); + }); + + if (!client) + { + std::cout << "Can't create IP7_Client" << std::endl; + return 1; + } + + //create P7 trace object 1 + std::unique_ptr> trace( + P7_Create_Trace(client.get(), TM("Trace channel 1")), + [&](IP7_Trace *ptr){ + if (ptr) + ptr->Release(); + }); + + if (!trace) + { + std::cout << "Can't create IP7_Trace" << std::endl; + return 1; + } + + trace->Register_Thread(TM("Application"), 0); + trace->Register_Module(TM("Main"), &module); + + std::atomic msg_counter{0}; + std::vector threads; + + auto start = clock::now(); + for (int t = 0; t < thread_count; ++t) + { + threads.push_back(std::thread([&]() { + trace->Register_Thread(TM("Application"), t+1); + while (true) + { + int counter = ++msg_counter; + if (counter > howmany) + break; + trace->P7_INFO(module, TM("p7 message #%d: This is some text for your pleasure"), counter); + } + trace->Register_Thread(TM("Application"), t+1); + })); + } + + for (auto &t : threads) + { + t.join(); + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; + + trace->Unregister_Thread(0); + + return 0; +} diff --git a/bench/p7-bench.cpp b/bench/p7-bench.cpp new file mode 100644 index 00000000..15513ca5 --- /dev/null +++ b/bench/p7-bench.cpp @@ -0,0 +1,70 @@ +// +// Copyright(c) 2015 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include +#include +#include +#include + +#include "P7_Trace.h" + + +int main(int, char *[]) +{ + using namespace std::chrono; + using clock = steady_clock; + + int howmany = 1000000; + + IP7_Trace::hModule module = NULL; + + //create P7 client object + std::unique_ptr> client( + P7_Create_Client(TM("/P7.Pool=1024 /P7.Sink=FileTxt /P7.Dir=logs/p7-bench")), + [&](IP7_Client *ptr){ + if (ptr) + ptr->Release(); + }); + + if (!client) + { + std::cout << "Can't create IP7_Client" << std::endl; + return 1; + } + + //create P7 trace object 1 + std::unique_ptr> trace( + P7_Create_Trace(client.get(), TM("Trace channel 1")), + [&](IP7_Trace *ptr){ + if (ptr) + ptr->Release(); + }); + + if (!trace) + { + std::cout << "Can't create IP7_Trace" << std::endl; + return 1; + } + + trace->Register_Thread(TM("Application"), 0); + trace->Register_Module(TM("Main"), &module); + + auto start = clock::now(); + for (int i = 0; i < howmany; ++i) + trace->P7_INFO(module, TM("p7 message #%d: This is some text for your pleasure"), i); + + + duration 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; + + trace->Unregister_Thread(0); + + return 0; +} From 70ad1aa40942f5fe6cfb8a49643dba13528ab2b9 Mon Sep 17 00:00:00 2001 From: Alexander Kiselev Date: Mon, 19 Mar 2018 19:22:02 +0300 Subject: [PATCH 2/3] Changes: boost, easylogging, g2log, glog, spdlog. --- .gitignore | 1 + bench/Makefile | 51 ++++++++++++++++++++++++--------- bench/boost-bench-mt.cpp | 20 +++++++++++-- bench/boost-bench.cpp | 21 ++++++++++++-- bench/easylogging-bench-mt.cpp | 23 ++++++++++++--- bench/easylogging-bench.cpp | 22 ++++++++++++-- bench/g2log-async.cpp | 2 +- bench/glog-bench-mt.cpp | 16 ++++++++++- bench/glog-bench.cpp | 18 +++++++++++- bench/mem | 19 ++++++++++++ bench/p7-bench | Bin 0 -> 14704 bytes bench/spdlog-async.cpp | 12 ++++---- bench/spdlog-bench-mt.cpp | 26 ++++++++++++----- bench/spdlog-bench.cpp | 25 ++++++++++++---- bench/spdlog-null-async.cpp | 2 +- 15 files changed, 212 insertions(+), 46 deletions(-) create mode 100755 bench/mem create mode 100755 bench/p7-bench diff --git a/.gitignore b/.gitignore index 2f3cb33d..b1a41919 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Auto generated files +build/* *.slo *.lo *.o diff --git a/bench/Makefile b/bench/Makefile index 418a5285..c619a5ae 100644 --- a/bench/Makefile +++ b/bench/Makefile @@ -3,7 +3,15 @@ CXXFLAGS = -march=native -Wall -Wextra -pedantic -std=c++11 -pthread -I../includ CXX_RELEASE_FLAGS = -O3 -flto -DNDEBUG -binaries=spdlog-bench spdlog-bench-mt spdlog-async spdlog-null-async boost-bench boost-bench-mt glog-bench glog-bench-mt g2log-async easylogging-bench easylogging-bench-mt +# g2log-async +binaries=spdlog-bench spdlog-bench-mt spdlog-async spdlog-null-async \ + boost-bench boost-bench-mt \ + glog-bench glog-bench-mt \ + g3log-async \ + p7-bench p7-bench-mt \ + log4cpp-bench log4cpp-bench-mt \ + log4cplus-bench log4cplus-bench-mt \ + easylogging-bench easylogging-bench-mt all: $(binaries) @@ -16,13 +24,10 @@ spdlog-bench-mt: spdlog-bench-mt.cpp spdlog-async: spdlog-async.cpp $(CXX) spdlog-async.cpp -o spdlog-async $(CXXFLAGS) $(CXX_RELEASE_FLAGS) - spdlog-null-async: spdlog-null-async.cpp $(CXX) spdlog-null-async.cpp -o spdlog-null-async $(CXXFLAGS) $(CXX_RELEASE_FLAGS) - - -BOOST_FLAGS = -DBOOST_LOG_DYN_LINK -I/usr/include -lboost_log -lboost_log_setup -lboost_filesystem -lboost_system -lboost_thread -lboost_regex -lboost_date_time -lboost_chrono +BOOST_FLAGS = -DBOOST_LOG_DYN_LINK -I$(HOME)/include -I/usr/include -L$(HOME)/lib -lboost_log_setup -lboost_log -lboost_filesystem -lboost_system -lboost_thread -lboost_regex -lboost_date_time -lboost_chrono boost-bench: boost-bench.cpp $(CXX) boost-bench.cpp -o boost-bench $(CXXFLAGS) $(BOOST_FLAGS) $(CXX_RELEASE_FLAGS) @@ -30,21 +35,43 @@ boost-bench: boost-bench.cpp boost-bench-mt: boost-bench-mt.cpp $(CXX) boost-bench-mt.cpp -o boost-bench-mt $(CXXFLAGS) $(BOOST_FLAGS) $(CXX_RELEASE_FLAGS) - -GLOG_FLAGS = -lglog +GLOG_FLAGS = -I$(HOME)/include -L$(HOME)/lib -lglog glog-bench: glog-bench.cpp $(CXX) glog-bench.cpp -o glog-bench $(CXXFLAGS) $(GLOG_FLAGS) $(CXX_RELEASE_FLAGS) glog-bench-mt: glog-bench-mt.cpp $(CXX) glog-bench-mt.cpp -o glog-bench-mt $(CXXFLAGS) $(GLOG_FLAGS) $(CXX_RELEASE_FLAGS) - -G2LOG_FLAGS = -I/home/gabi/devel/g2log/g2log/src -L/home/gabi/devel/g2log/g2log -llib_g2logger +G2LOG_FLAGS = -I$(HOME)/include -L$(HOME)/lib -llib_g2logger g2log-async: g2log-async.cpp $(CXX) g2log-async.cpp -o g2log-async $(CXXFLAGS) $(G2LOG_FLAGS) $(CXX_RELEASE_FLAGS) +G3LOG_FLAGS = -I$(HOME)/include -L$(HOME)/lib -lg3logger +g3log-async: g3log-async.cpp + $(CXX) g3log-async.cpp -o g3log-async $(CXXFLAGS) $(G3LOG_FLAGS) $(CXX_RELEASE_FLAGS) -EASYL_FLAGS = -I../../easylogging/src/ +P7_FLAGS = -I$(HOME)/P7/Headers -I$(HOME)/include -L$(HOME)/lib -lP7 +p7-bench: p7-bench.cpp + $(CXX) p7-bench.cpp -o p7-bench $(CXXFLAGS) $(P7_FLAGS) $(CXX_RELEASE_FLAGS) + +p7-bench-mt: p7-bench-mt.cpp + $(CXX) p7-bench-mt.cpp -o p7-bench-mt $(CXXFLAGS) $(P7_FLAGS) $(CXX_RELEASE_FLAGS) + +LOG4CPP_FLAGS = -I$(HOME)/include -L$(HOME)/lib -llog4cpp +log4cpp-bench: log4cpp-bench.cpp + $(CXX) log4cpp-bench.cpp -o log4cpp-bench $(CXXFLAGS) $(LOG4CPP_FLAGS) $(CXX_RELEASE_FLAGS) + +log4cpp-bench-mt: log4cpp-bench-mt.cpp + $(CXX) log4cpp-bench-mt.cpp -o log4cpp-bench-mt $(CXXFLAGS) $(LOG4CPP_FLAGS) $(CXX_RELEASE_FLAGS) + +LOG4CPLUS_FLAGS = -I$(HOME)/include -L$(HOME)/lib -llog4cplus +log4cplus-bench: log4cplus-bench.cpp + $(CXX) log4cplus-bench.cpp -o log4cplus-bench $(CXXFLAGS) $(LOG4CPLUS_FLAGS) $(CXX_RELEASE_FLAGS) + +log4cplus-bench-mt: log4cplus-bench-mt.cpp + $(CXX) log4cplus-bench-mt.cpp -o log4cplus-bench-mt $(CXXFLAGS) $(LOG4CPLUS_FLAGS) $(CXX_RELEASE_FLAGS) + +EASYL_FLAGS = -I$(HOME)/easyloggingpp/src easylogging-bench: easylogging-bench.cpp $(CXX) easylogging-bench.cpp -o easylogging-bench $(CXXFLAGS) $(EASYL_FLAGS) $(CXX_RELEASE_FLAGS) easylogging-bench-mt: easylogging-bench-mt.cpp @@ -55,8 +82,4 @@ easylogging-bench-mt: easylogging-bench-mt.cpp clean: rm -f *.o logs/* $(binaries) - rebuild: clean all - - - diff --git a/bench/boost-bench-mt.cpp b/bench/boost-bench-mt.cpp index 73219b91..3a6eeea8 100644 --- a/bench/boost-bench-mt.cpp +++ b/bench/boost-bench-mt.cpp @@ -4,6 +4,8 @@ // #include +#include +#include #include #include @@ -23,7 +25,7 @@ namespace keywords = boost::log::keywords; void init() { - logging::add_file_log(keywords::file_name = "logs/boost-sample_%N.log", /*< file name pattern >*/ + logging::add_file_log(keywords::file_name = "logs/boost-bench-mt_%N.log", /*< file name pattern >*/ keywords::auto_flush = false, keywords::format = "[%TimeStamp%]: %Message%"); logging::core::get()->set_filter(logging::trivial::severity >= logging::trivial::info); @@ -33,6 +35,9 @@ using namespace std; int main(int argc, char *argv[]) { + using namespace std::chrono; + using clock = steady_clock; + int thread_count = 10; if (argc > 1) thread_count = atoi(argv[1]); @@ -49,6 +54,7 @@ int main(int argc, char *argv[]) std::atomic msg_counter{0}; vector threads; + auto start = clock::now(); for (int t = 0; t < thread_count; ++t) { threads.push_back(std::thread([&]() { @@ -65,7 +71,17 @@ int main(int argc, char *argv[]) for (auto &t : threads) { t.join(); - }; + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; + return 0; } diff --git a/bench/boost-bench.cpp b/bench/boost-bench.cpp index cb432578..334fcb93 100644 --- a/bench/boost-bench.cpp +++ b/bench/boost-bench.cpp @@ -2,6 +2,10 @@ // Copyright(c) 2015 Gabi Melman. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // + +#include +#include + #include #include #include @@ -18,22 +22,35 @@ namespace keywords = boost::log::keywords; void init() { - logging::add_file_log(keywords::file_name = "logs/boost-sample_%N.log", /*< file name pattern >*/ + logging::add_file_log(keywords::file_name = "logs/boost-bench_%N.log", /*< file name pattern >*/ keywords::auto_flush = false, keywords::format = "[%TimeStamp%]: %Message%"); logging::core::get()->set_filter(logging::trivial::severity >= logging::trivial::info); } -int main(int argc, char *[]) +int main(int, char *[]) { + using namespace std::chrono; + using clock = steady_clock; + int howmany = 1000000; init(); logging::add_common_attributes(); using namespace logging::trivial; src::severity_logger_mt lg; + + auto start = clock::now(); for (int i = 0; i < howmany; ++i) BOOST_LOG_SEV(lg, info) << "boost message #" << i << ": This is some text for your pleasure"; + duration 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; } diff --git a/bench/easylogging-bench-mt.cpp b/bench/easylogging-bench-mt.cpp index 00f507c6..cfcf3348 100644 --- a/bench/easylogging-bench-mt.cpp +++ b/bench/easylogging-bench-mt.cpp @@ -4,17 +4,22 @@ // #include +#include +#include #include #include -#define _ELPP_THREAD_SAFE +#define ELPP_THREAD_SAFE #include "easylogging++.h" -_INITIALIZE_EASYLOGGINGPP +#include "easylogging++.cc" +INITIALIZE_EASYLOGGINGPP using namespace std; int main(int argc, char *argv[]) { + using namespace std::chrono; + using clock = steady_clock; int thread_count = 10; if (argc > 1) @@ -23,12 +28,13 @@ int main(int argc, char *argv[]) int howmany = 1000000; // Load configuration from file - el::Configurations conf("easyl.conf"); + el::Configurations conf("easyl-mt.conf"); el::Loggers::reconfigureLogger("default", conf); std::atomic msg_counter{0}; vector threads; + auto start = clock::now(); for (int t = 0; t < thread_count; ++t) { threads.push_back(std::thread([&]() { @@ -45,7 +51,16 @@ int main(int argc, char *argv[]) for (auto &t : threads) { t.join(); - }; + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; return 0; } diff --git a/bench/easylogging-bench.cpp b/bench/easylogging-bench.cpp index 5306435f..06b66134 100644 --- a/bench/easylogging-bench.cpp +++ b/bench/easylogging-bench.cpp @@ -3,19 +3,37 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) // -#include "easylogging++.h" +#include +#include -_INITIALIZE_EASYLOGGINGPP +#include "easylogging++.h" +#include "easylogging++.cc" +INITIALIZE_EASYLOGGINGPP int main(int, char *[]) { + using namespace std::chrono; + using clock = steady_clock; + int howmany = 1000000; // Load configuration from file el::Configurations conf("easyl.conf"); el::Loggers::reconfigureLogger("default", conf); + el::Logger* defaultLogger = el::Loggers::getLogger("default"); + + auto start = clock::now(); for (int i = 0; i < howmany; ++i) LOG(INFO) << "easylog message #" << i << ": This is some text for your pleasure"; + + duration 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; } diff --git a/bench/g2log-async.cpp b/bench/g2log-async.cpp index 97cac5dc..ad21a0e5 100644 --- a/bench/g2log-async.cpp +++ b/bench/g2log-async.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) for (auto &t : threads) { t.join(); - }; + } duration delta = clock::now() - start; float deltaf = delta.count(); diff --git a/bench/glog-bench-mt.cpp b/bench/glog-bench-mt.cpp index 5e43de78..2f0aef19 100644 --- a/bench/glog-bench-mt.cpp +++ b/bench/glog-bench-mt.cpp @@ -4,6 +4,8 @@ // #include +#include +#include #include #include @@ -13,6 +15,8 @@ using namespace std; int main(int argc, char *argv[]) { + using namespace std::chrono; + using clock = steady_clock; int thread_count = 10; if (argc > 1) @@ -27,6 +31,7 @@ int main(int argc, char *argv[]) std::atomic msg_counter{0}; vector threads; + auto start = clock::now(); for (int t = 0; t < thread_count; ++t) { threads.push_back(std::thread([&]() { @@ -43,7 +48,16 @@ int main(int argc, char *argv[]) for (auto &t : threads) { t.join(); - }; + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; return 0; } diff --git a/bench/glog-bench.cpp b/bench/glog-bench.cpp index 2a8db891..6b4445a9 100644 --- a/bench/glog-bench.cpp +++ b/bench/glog-bench.cpp @@ -3,17 +3,33 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) // +#include +#include + #include "glog/logging.h" + int main(int, char *argv[]) { + using namespace std::chrono; + using clock = steady_clock; + int howmany = 1000000; FLAGS_logtostderr = 0; FLAGS_log_dir = "logs"; google::InitGoogleLogging(argv[0]); + auto start = clock::now(); for (int i = 0; i < howmany; ++i) - LOG(INFO) << "glog message # " << i << ": This is some text for your pleasure"; + LOG(INFO) << "glog message #" << i << ": This is some text for your pleasure"; + + duration 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; } diff --git a/bench/mem b/bench/mem new file mode 100755 index 00000000..c49744e7 --- /dev/null +++ b/bench/mem @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then + echo "usage: $0 " +fi + +PROG=$1 + +if [ ! -x "$PROG" ]; then + echo $PROG not found or not executable. + exit 1 +fi + +$* & +PID=$! + +while `kill -0 $PID 2>/dev/null`; do + ps -eo size,pid,user,pcpu,command --sort -size | awk '{ line=1 ; hr=$1/1024 ; printf("%13.2f Mb ",hr); } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep -v grep | grep -v $0 | grep $PROG +done diff --git a/bench/p7-bench b/bench/p7-bench new file mode 100755 index 0000000000000000000000000000000000000000..566ec56b04ab3c6f4147b140ac46c0785d7607de GIT binary patch literal 14704 zcmeHOdvIG-dOwol*m=oz9^g&r=4O{i0uy05PU66%NVer%1t%Ckf(azoiloFMvZR%+ z5<62$z)3b*W7eh1lI?6~J)JGf>>q8q(=q|JiKz*u)5jPXwzO<_Q+A;;PcxLP6Bg9p zckVgz)wNWZ9om1IlU#l0`_q!q%919Tpq2Dd_?J1xt6$qh+3dMuMf2nw+H!1Wcg`T8}D8Hn#eq@H8PLbYe z_kbhbLxeT+-&rcNZF^G>QT*gGL*V2x506M1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0jAwu<+V)7hrv2c>UMG6XP=??ZXa3>xbn-t`JU;h1&wZ1ZcNq+$y^52&F@?5W1 z{C$;_Bij@tFX`LBs7z8{o|7d$N1tp__yCVtzh9gm_6z-PE;aij^OeYN5s~jEVe&jt z{(YDt8deTNsW02544Iqrm*dG)APNpfZ0+ms#}XzI{aK zm&#w7{R;HSmTZ4{elRNZYmjaZ0?tEU75UfZ5hEh?MK|PAr8zT|V>d5^$e3bqlcJ(u u1-liGthb#1=>3*uH#Cgjk#z=rN_Lz`l=({8YD9|Zw}=YeU{SEJ?7sm8AXkI{ literal 0 HcmV?d00001 diff --git a/bench/spdlog-async.cpp b/bench/spdlog-async.cpp index 0db4f6c6..1c0ce41d 100644 --- a/bench/spdlog-async.cpp +++ b/bench/spdlog-async.cpp @@ -15,22 +15,22 @@ using namespace std; int main(int argc, char *argv[]) { - using namespace std::chrono; using clock = steady_clock; - namespace spd = spdlog; int thread_count = 10; if (argc > 1) thread_count = ::atoi(argv[1]); + int howmany = 1000000; - spd::set_async_mode(1048576); - auto logger = spdlog::create("file_logger", "logs/spd-bench-async.txt", false); - logger->set_pattern("[%Y-%b-%d %T.%e]: %v"); + spdlog::set_async_mode(1048576); + auto logger = spdlog::create("file_logger", "logs/spdlog-bench-async.log", false); + logger->set_pattern("[%Y-%b-%d %T.%e]: %f"); std::atomic msg_counter{0}; vector threads; + auto start = clock::now(); for (int t = 0; t < thread_count; ++t) { @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) for (auto &t : threads) { t.join(); - }; + } duration delta = clock::now() - start; float deltaf = delta.count(); diff --git a/bench/spdlog-bench-mt.cpp b/bench/spdlog-bench-mt.cpp index 5feb7044..d6dfeb51 100644 --- a/bench/spdlog-bench-mt.cpp +++ b/bench/spdlog-bench-mt.cpp @@ -3,16 +3,21 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) // -#include "spdlog/spdlog.h" #include +#include +#include #include #include #include +#include "spdlog/spdlog.h" + using namespace std; int main(int argc, char *argv[]) { + using namespace std::chrono; + using clock = steady_clock; int thread_count = 10; if (argc > 1) @@ -20,15 +25,13 @@ int main(int argc, char *argv[]) int howmany = 1000000; - namespace spd = spdlog; - - auto logger = spdlog::create("file_logger", "logs/spd-bench-mt.txt", false); - - logger->set_pattern("[%Y-%b-%d %T.%e]: %v"); + auto logger = spdlog::create("file_logger", "logs/spdlog-bench-mt.log", false); + logger->set_pattern("[%Y-%b-%d %T.%f]: %v"); std::atomic msg_counter{0}; std::vector threads; + auto start = clock::now(); for (int t = 0; t < thread_count; ++t) { threads.push_back(std::thread([&]() { @@ -45,7 +48,16 @@ int main(int argc, char *argv[]) for (auto &t : threads) { t.join(); - }; + } + + duration delta = clock::now() - start; + float deltaf = delta.count(); + auto rate = howmany / deltaf; + + std::cout << "Total: " << howmany << std::endl; + std::cout << "Threads: " << thread_count << std::endl; + std::cout << "Delta = " << deltaf << " seconds" << std::endl; + std::cout << "Rate = " << rate << "/sec" << std::endl; return 0; } diff --git a/bench/spdlog-bench.cpp b/bench/spdlog-bench.cpp index 8d122249..e241fa5e 100644 --- a/bench/spdlog-bench.cpp +++ b/bench/spdlog-bench.cpp @@ -3,17 +3,32 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) // +#include +#include + #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("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("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 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; } diff --git a/bench/spdlog-null-async.cpp b/bench/spdlog-null-async.cpp index df07f834..e9b33c9d 100644 --- a/bench/spdlog-null-async.cpp +++ b/bench/spdlog-null-async.cpp @@ -93,7 +93,7 @@ size_t bench_as(int howmany, std::shared_ptr log, int thread_cou for (auto &t : threads) { t.join(); - }; + } auto delta = system_clock::now() - start; auto delta_d = duration_cast>(delta).count(); From fd1c4d78775a5a3ad5d5cc3f95469b9501cc39af Mon Sep 17 00:00:00 2001 From: Alexander Kiselev Date: Mon, 19 Mar 2018 20:03:47 +0300 Subject: [PATCH 3/3] Fix: unknown conversion specifier 'Y' --- bench/log4cpp-bench-mt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/log4cpp-bench-mt.cpp b/bench/log4cpp-bench-mt.cpp index 82f3a40f..dc6a5f58 100644 --- a/bench/log4cpp-bench-mt.cpp +++ b/bench/log4cpp-bench-mt.cpp @@ -31,7 +31,7 @@ int main(int argc, char * argv[]) log4cpp::Appender *appender = new log4cpp::FileAppender("default", "logs/log4cpp-bench-mt.log"); log4cpp::PatternLayout *layout = new log4cpp::PatternLayout(); - layout->setConversionPattern("{%Y-%m-%d %H:%M:%S.%l}: %p - %m %n"); + layout->setConversionPattern("%d{%Y-%m-%d %H:%M:%S.%l}: %p - %m %n"); appender->setLayout(layout); log4cpp::Category& root = log4cpp::Category::getRoot();