From 1aba2149d3f85b0af60c5965608e069a5e09e26b Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Tue, 12 Sep 2023 16:58:49 +0200 Subject: [PATCH] Clean up console writer --- include/dwarfs/progress.h | 1 + src/dwarfs/console_writer.cpp | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/dwarfs/progress.h b/include/dwarfs/progress.h index 70f5f37be..a3ad2f842 100644 --- a/include/dwarfs/progress.h +++ b/include/dwarfs/progress.h @@ -116,6 +116,7 @@ class progress { std::atomic bytes{0}; std::atomic usec{0}; std::atomic chunk_size{UINT64_C(16) << 20}; + std::atomic bytes_per_sec{0}; }; class scan_updater { diff --git a/src/dwarfs/console_writer.cpp b/src/dwarfs/console_writer.cpp index e3355253d..619339fbb 100644 --- a/src/dwarfs/console_writer.cpp +++ b/src/dwarfs/console_writer.cpp @@ -217,6 +217,7 @@ void console_writer::update(progress& p, bool last) { sp.chunk_size.store(std::min( UINT64_C(1) << 25, std::max(UINT64_C(1) << 15, std::bit_ceil(bytes_per_second / 32)))); + sp.bytes_per_sec.store(bytes_per_second); } }; @@ -246,9 +247,15 @@ void console_writer::update(progress& p, bool last) { << newline << "original size: " << size_with_unit(p.original_size) - << ", scanned: " << size_with_unit(p.similarity.bytes) << ", hashed: " << size_with_unit(p.hash.bytes) << " (" - << p.hash.scans << " files)" << newline + << p.hash.scans << " files, " << size_with_unit(p.hash.bytes_per_sec) + << "/s)" << newline + + << "scanned: " << size_with_unit(p.similarity.bytes) << " (" + << p.similarity.scans << " files, " + << size_with_unit(p.similarity.bytes_per_sec) << "/s)" + << ", categorizing: " << size_with_unit(p.categorize.bytes_per_sec) + << "/s" << newline << "saved by deduplication: " << size_with_unit(p.saved_by_deduplication) << " (" @@ -269,10 +276,7 @@ void console_writer::update(progress& p, bool last) { << newline << "compressed filesystem: " << p.blocks_written << " blocks/" - << size_with_unit(p.compressed_size) << " written" - << " [" << size_with_unit(p.hash.chunk_size) << ", " - << size_with_unit(p.similarity.chunk_size) << ", " - << size_with_unit(p.categorize.chunk_size) << "]" << newline; + << size_with_unit(p.compressed_size) << " written" << newline; break; case REWRITE: @@ -345,7 +349,7 @@ void console_writer::update(progress& p, bool last) { std::lock_guard lock(log_mutex()); - rewind(8 + ctxs.size()); + rewind(9 + ctxs.size()); statebuf_ = oss.str();