13#ifdef SPDLOG_FMT_EXTERNAL
14# include <fmt/format.h>
36# pragma warning(disable : 4996)
42 auto *infile =
fopen(filename,
"r");
44 while (EOF != (ch =
getc(infile)))
56 spdlog::info(
"Verifying {} to contain {} line..", filename, expected_count);
58 if (
count != expected_count)
60 spdlog::error(
"Test failed. {} has {} lines instead of {}", filename,
count, expected_count);
70int main(
int argc,
char *argv[])
73 int howmany = 1000000;
74 int queue_size =
std::min(howmany + 2, 8192);
83 spdlog::info(
"Usage: {} <message_count> <threads> <q_size> <iterations>", argv[0]);
88 howmany =
atoi(argv[1]);
90 threads =
atoi(argv[2]);
93 queue_size =
atoi(argv[3]);
94 if (queue_size > 500000)
102 iters =
atoi(argv[4]);
105 spdlog::info(
"-------------------------------------------------");
109 spdlog::info(
"Queue memory : {:L} x {:L} = {:L} KB ", queue_size, slot_size, (queue_size * slot_size) / 1024);
111 spdlog::info(
"-------------------------------------------------");
113 const char *filename =
"logs/basic_async.log";
118 for (
int i = 0; i < iters; i++)
132 filename =
"logs/basic_async-overrun.log";
133 for (
int i = 0; i <
iters; i++)
154 for (
int i = 0; i <
howmany; i++)
156 logger->
info(
"Hello logger: msg number {}", i);
int main(int argc, char *argv[])
void thread_fun(std::shared_ptr< spdlog::logger > logger, int howmany)
int count_lines(const char *filename)
void bench_mt(int howmany, std::shared_ptr< spdlog::logger > log, int thread_count)
void verify_file(const char *filename, int expected_count)
void info(fmt::format_string< Args... > fmt, Args &&...args)
constexpr auto count() -> size_t
void error(fmt::format_string< Args... > fmt, Args &&...args)
SPDLOG_INLINE void shutdown()
void info(fmt::format_string< Args... > fmt, Args &&...args)
SPDLOG_INLINE void set_pattern(std::string pattern, pattern_time_type time_type)