measure throughput
This commit is contained in:
parent
20a4323fa2
commit
c258a2c8c0
1 changed files with 12 additions and 2 deletions
|
@ -434,6 +434,7 @@ void listfile_parser_nng(
|
||||||
std::chrono::microseconds tSend(0);
|
std::chrono::microseconds tSend(0);
|
||||||
std::chrono::microseconds tTotal(0);
|
std::chrono::microseconds tTotal(0);
|
||||||
auto tLastReport = std::chrono::steady_clock::now();
|
auto tLastReport = std::chrono::steady_clock::now();
|
||||||
|
const auto tStart = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
auto log_stats = [&]
|
auto log_stats = [&]
|
||||||
{
|
{
|
||||||
|
@ -448,6 +449,15 @@ void listfile_parser_nng(
|
||||||
tProcess.count() / 1000.0,
|
tProcess.count() / 1000.0,
|
||||||
tSend.count() / 1000.0,
|
tSend.count() / 1000.0,
|
||||||
tTotal.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)
|
while (true)
|
||||||
|
@ -543,10 +553,10 @@ void listfile_parser_nng(
|
||||||
|
|
||||||
{
|
{
|
||||||
auto now = std::chrono::steady_clock::now();
|
auto now = std::chrono::steady_clock::now();
|
||||||
auto tElapsed = now - tLastReport;
|
auto tReportElapsed = now - tLastReport;
|
||||||
static const auto ReportInterval = std::chrono::seconds(1);
|
static const auto ReportInterval = std::chrono::seconds(1);
|
||||||
|
|
||||||
if (tElapsed >= ReportInterval)
|
if (tReportElapsed >= ReportInterval)
|
||||||
{
|
{
|
||||||
log_stats();
|
log_stats();
|
||||||
tLastReport = now;
|
tLastReport = now;
|
||||||
|
|
Loading…
Reference in a new issue