mirror of
https://github.com/gabime/spdlog.git
synced 2025-02-05 04:06:46 +08:00
Fixed async bench
Some checks failed
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[asan:ON build_type:Debug … (push) Has been cancelled
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Debug compiler… (push) Has been cancelled
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Release compil… (push) Has been cancelled
macos / macOS Clang (C++17, Release) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:ON BUILD_SHARED:OFF BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019]) (push) Has been cancelled
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019]) (push) Has been cancelled
Some checks failed
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[asan:ON build_type:Debug … (push) Has been cancelled
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Debug compiler… (push) Has been cancelled
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Release compil… (push) Has been cancelled
macos / macOS Clang (C++17, Release) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:ON BUILD_SHARED:OFF BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019]) (push) Has been cancelled
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019]) (push) Has been cancelled
This commit is contained in:
parent
27d8580131
commit
22405cf9ae
@ -21,8 +21,7 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
using namespace spdlog;
|
||||
using namespace spdlog::sinks;
|
||||
using spdlog::sinks::async_sink;
|
||||
|
||||
void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count);
|
||||
|
||||
@ -50,8 +49,8 @@ using namespace spdlog::sinks;
|
||||
int main(int argc, char *argv[]) {
|
||||
// setlocale to show thousands separators
|
||||
std::locale::global(std::locale("en_US.UTF-8"));
|
||||
int howmany = 1000000;
|
||||
int queue_size = std::min(howmany + 2, 8192);
|
||||
int howmany = 1'000'000;
|
||||
int queue_size = async_sink::default_queue_size;
|
||||
int threads = 10;
|
||||
int iters = 3;
|
||||
|
||||
@ -75,14 +74,14 @@ int main(int argc, char *argv[]) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
constexpr int max_q_size = sinks::async_sink::max_queue_size;
|
||||
constexpr int max_q_size = async_sink::max_queue_size;
|
||||
if(queue_size > max_q_size)
|
||||
{
|
||||
spdlog::error("Queue size too large. Max queue size is {:L}", max_q_size);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
auto slot_size = sizeof(details::async_log_msg);
|
||||
auto slot_size = sizeof(spdlog::details::async_log_msg);
|
||||
spdlog::info("-------------------------------------------------");
|
||||
spdlog::info("Messages : {:L}", howmany);
|
||||
spdlog::info("Threads : {:L}", threads);
|
||||
@ -102,8 +101,8 @@ int main(int argc, char *argv[]) {
|
||||
auto cfg = async_sink::config();
|
||||
cfg.queue_size = queue_size;
|
||||
cfg.sinks.push_back(std::move(file_sink));
|
||||
auto async_sink = std::make_shared<sinks::async_sink>(cfg);
|
||||
auto logger = std::make_shared<spdlog::logger>("async_logger", std::move(async_sink));
|
||||
auto sink = std::make_shared<async_sink>(cfg);
|
||||
auto logger = std::make_shared<spdlog::logger>("async_logger", std::move(sink));
|
||||
bench_mt(howmany, std::move(logger), threads);
|
||||
}
|
||||
// verify_file(filename, howmany); // in separate scope to ensure logger is destroyed and all logs were written
|
||||
@ -120,8 +119,8 @@ int main(int argc, char *argv[]) {
|
||||
cfg.queue_size = queue_size;
|
||||
auto file_sink = std::make_shared<basic_file_sink_mt>(filename, true);
|
||||
cfg.sinks.push_back(std::move(file_sink));
|
||||
auto async_sink = std::make_shared<sinks::async_sink>(cfg);
|
||||
auto logger = std::make_shared<spdlog::logger>("async_logger", std::move(async_sink));
|
||||
auto sink = std::make_shared<async_sink>(cfg);
|
||||
auto logger = std::make_shared<spdlog::logger>("async_logger", std::move(sink));
|
||||
bench_mt(howmany, std::move(logger), threads);
|
||||
}
|
||||
spdlog::shutdown();
|
||||
|
@ -153,8 +153,8 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
using spdlog::sinks::async_sink;
|
||||
async_sink::config config;
|
||||
config.queue_size = 3 * 1024 * 1024;
|
||||
;
|
||||
config.queue_size = async_sink::default_queue_size;;
|
||||
|
||||
config.sinks.push_back(std::make_shared<null_sink_st>());
|
||||
config.policy = async_sink::overflow_policy::overrun_oldest;
|
||||
auto async_logger = std::make_shared<spdlog::logger>("async_logger", std::make_shared<async_sink>(config));
|
||||
|
Loading…
Reference in New Issue
Block a user