From 5326024a9b8c77adb38294cca876e69ca10db623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 19 Sep 2020 08:31:32 +0200 Subject: [PATCH] Add support for checking how much data was read by tool[REAL FIX] --- czkawka_core/src/duplicate.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index e5c4d81..a4f65e2 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -44,6 +44,7 @@ pub struct Info { pub number_of_duplicated_files_by_hash: usize, pub lost_space_by_size: u64, pub lost_space_by_hash: u64, + pub bytes_read_when_hashing: u64, pub number_of_removed_files: usize, pub number_of_failed_to_remove_files: usize, pub gained_space: u64, @@ -61,6 +62,7 @@ impl Info { number_of_duplicated_files_by_hash: 0, lost_space_by_size: 0, lost_space_by_hash: 0, + bytes_read_when_hashing: 0, number_of_removed_files: 0, number_of_failed_to_remove_files: 0, gained_space: 0, @@ -580,6 +582,7 @@ impl DuplicateFinder { if n == 0 { break; } + self.information.bytes_read_when_hashing += n as u64; hasher.update(&buffer[..n]); } if !error_reading_file { @@ -640,6 +643,11 @@ impl DuplicateFinder { self.information.gained_space.file_size(options::BINARY).unwrap(), self.information.gained_space ); + println!( + "Bytes read when hashing - {} ({} bytes)", + self.information.bytes_read_when_hashing.file_size(options::BINARY).unwrap(), + self.information.bytes_read_when_hashing + ); println!("Number of removed files - {}", self.information.number_of_removed_files); println!("Number of failed to remove files - {}", self.information.number_of_failed_to_remove_files);