Clean up console writer

This commit is contained in:
Marcus Holland-Moritz 2023-09-12 16:58:49 +02:00
parent f8e7f66b6a
commit fb8c01cf18
2 changed files with 12 additions and 7 deletions

View File

@ -116,6 +116,7 @@ class progress {
std::atomic<uint64_t> bytes{0};
std::atomic<uint64_t> usec{0};
std::atomic<uint64_t> chunk_size{UINT64_C(16) << 20};
std::atomic<uint64_t> bytes_per_sec{0};
};
class scan_updater {

View File

@ -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();