mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 01:10:26 +08:00
bench # threads can be passed at cmd line as first arg
This commit is contained in:
parent
5d3025322f
commit
29d1790f98
@ -36,11 +36,15 @@ void init()
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(int, char*[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int thread_count = 10;
|
int thread_count = 10;
|
||||||
|
if(argc > 1)
|
||||||
|
thread_count = atoi(argv[1]);
|
||||||
|
|
||||||
int howmany = 1000000;
|
int howmany = 1000000;
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
logging::add_common_attributes();
|
logging::add_common_attributes();
|
||||||
|
|
||||||
|
@ -30,14 +30,15 @@ void init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int, char*[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
int howmany = 1000000;
|
||||||
init();
|
init();
|
||||||
logging::add_common_attributes();
|
logging::add_common_attributes();
|
||||||
|
|
||||||
using namespace logging::trivial;
|
using namespace logging::trivial;
|
||||||
src::severity_logger_mt< severity_level > lg;
|
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;
|
BOOST_LOG_SEV(lg, info) << "Boost logger message #" << i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4,12 +4,16 @@
|
|||||||
|
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(int, char*[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
int thread_count = 10;
|
int thread_count = 10;
|
||||||
|
if(argc > 1)
|
||||||
|
thread_count = atoi(argv[1]);
|
||||||
|
|
||||||
int howmany = 1000000;
|
int howmany = 1000000;
|
||||||
|
|
||||||
namespace spd = spdlog;
|
namespace spd = spdlog;
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int, char*[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
int howmany = 1000000;
|
||||||
namespace spd = spdlog;
|
namespace spd = spdlog;
|
||||||
///Create a file rotating logger with 5mb size max and 3 rotated files
|
///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);
|
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
|
||||||
|
|
||||||
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
|
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;
|
logger->info() << "spdlogger message #" << i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user