From 96fc342734833175e6fd8ccfb7be3ae973fba701 Mon Sep 17 00:00:00 2001 From: "Jarno N. Alanko" Date: Thu, 13 Apr 2023 12:21:31 +0300 Subject: [PATCH] Start printing output rate only after first bytes are written --- src/pseudoalign.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pseudoalign.cpp b/src/pseudoalign.cpp index fad0630..9f89da8 100644 --- a/src/pseudoalign.cpp +++ b/src/pseudoalign.cpp @@ -75,10 +75,14 @@ void pseudoalignment::print_thread(atomic* total_length_of_sequence_pro first_print = false; std::this_thread::sleep_for(std::chrono::seconds(1)); seconds++; - std::cerr << "Input: " - << *total_length_of_sequence_processed / 1e6 / seconds << " Mbase/s" - << ", Output: " - << ((double) *total_bytes_written) / (1 << 20) / seconds << " MB/s " << std::flush; + + std::cerr << "Input: " << *total_length_of_sequence_processed / 1e6 / seconds << " Mbase/s"; + + if(*total_bytes_written > 0){ + std::cerr << ", Output: " << ((double) *total_bytes_written) / (1 << 20) / seconds << " MB/s"; + } + + std::cerr << " " << std::flush; // Added spaces to the end to erase trailing characters from the previous line } cerr << endl;