diff --git a/bench-comparison/boost-bench-mt.cpp b/bench-comparison/boost-bench-mt.cpp index 16515ae6..501fcdde 100644 --- a/bench-comparison/boost-bench-mt.cpp +++ b/bench-comparison/boost-bench-mt.cpp @@ -36,10 +36,14 @@ void init() using namespace std; -int main(int, char*[]) +int main(int argc, char* argv[]) { int thread_count = 10; + if(argc > 1) + thread_count = atoi(argv[1]); + int howmany = 1000000; + init(); logging::add_common_attributes(); diff --git a/bench-comparison/boost-bench.cpp b/bench-comparison/boost-bench.cpp index 2734b63c..1938c67d 100644 --- a/bench-comparison/boost-bench.cpp +++ b/bench-comparison/boost-bench.cpp @@ -30,14 +30,15 @@ void init() } -int main(int, char*[]) +int main(int argc, char* argv[]) { + int howmany = 1000000; init(); logging::add_common_attributes(); using namespace logging::trivial; src::severity_logger_mt< severity_level > lg; - for(int i = 0 ; i < 1000000; ++i) + for(int i = 0 ; i < howmany; ++i) BOOST_LOG_SEV(lg, info) << "Boost logger message #" << i; return 0; diff --git a/bench-comparison/spdlog-bench-mt.cpp b/bench-comparison/spdlog-bench-mt.cpp index e5da8776..fafc0c5b 100644 --- a/bench-comparison/spdlog-bench-mt.cpp +++ b/bench-comparison/spdlog-bench-mt.cpp @@ -4,12 +4,16 @@ #include "spdlog/spdlog.h" - +#include using namespace std; -int main(int, char*[]) +int main(int argc, char* argv[]) { + int thread_count = 10; + if(argc > 1) + thread_count = atoi(argv[1]); + int howmany = 1000000; namespace spd = spdlog; diff --git a/bench-comparison/spdlog-bench.cpp b/bench-comparison/spdlog-bench.cpp index e7be6fd2..8a8321a1 100644 --- a/bench-comparison/spdlog-bench.cpp +++ b/bench-comparison/spdlog-bench.cpp @@ -2,14 +2,15 @@ #include "spdlog/spdlog.h" -int main(int, char*[]) +int main(int argc, char* argv[]) { + int howmany = 1000000; namespace spd = spdlog; ///Create a file rotating logger with 5mb size max and 3 rotated files auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5); logger->set_pattern("[%Y-%b-%d %T.%e]: %v"); - for(int i = 0 ; i < 1000000; ++i) + for(int i = 0 ; i < howmany; ++i) logger->info() << "spdlogger message #" << i; return 0;