measure throughput

This commit is contained in:
Florian Lüke 2023-07-11 20:53:37 +02:00
parent 20a4323fa2
commit c258a2c8c0

View file

@ -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::seconds>(
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;