From c258a2c8c0a59b7f0c809576f23d534a897e6968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20L=C3=BCke?= Date: Tue, 11 Jul 2023 20:53:37 +0200 Subject: [PATCH] measure throughput --- src/mvlc_nng_replay.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mvlc_nng_replay.cc b/src/mvlc_nng_replay.cc index 93561d7..c5aa5c8 100644 --- a/src/mvlc_nng_replay.cc +++ b/src/mvlc_nng_replay.cc @@ -434,6 +434,7 @@ void listfile_parser_nng( std::chrono::microseconds tSend(0); std::chrono::microseconds tTotal(0); auto tLastReport = std::chrono::steady_clock::now(); + const auto tStart = std::chrono::steady_clock::now(); auto log_stats = [&] { @@ -448,6 +449,15 @@ void listfile_parser_nng( tProcess.count() / 1000.0, tSend.count() / 1000.0, tTotal.count() / 1000.0); + + auto totalElapsed = std::chrono::duration_cast( + std::chrono::steady_clock::now() - tStart); + auto totalBytes = parserCounters.bytesProcessed; + auto totalMiB = totalBytes / (1024.0*1024.0); + //auto bytesPerSecond = 1.0 * totalBytes / totalElapsed.count(); + auto MiBperSecond = totalMiB / totalElapsed.count(); + spdlog::info("listfile_parser_nng: bytesProcessed={:.2f}, rate={:.2f} MiB/s", + totalMiB, MiBperSecond); }; while (true) @@ -543,10 +553,10 @@ void listfile_parser_nng( { auto now = std::chrono::steady_clock::now(); - auto tElapsed = now - tLastReport; + auto tReportElapsed = now - tLastReport; static const auto ReportInterval = std::chrono::seconds(1); - if (tElapsed >= ReportInterval) + if (tReportElapsed >= ReportInterval) { log_stats(); tLastReport = now;