1
0
Fork 0
mirror of synced 2024-09-21 11:55:10 +12:00

Add support for checking how much data was read by tool[REAL FIX]

This commit is contained in:
Rafał Mikrut 2020-09-19 08:31:32 +02:00
parent 481b899b21
commit 5326024a9b

View file

@ -44,6 +44,7 @@ pub struct Info {
pub number_of_duplicated_files_by_hash: usize, pub number_of_duplicated_files_by_hash: usize,
pub lost_space_by_size: u64, pub lost_space_by_size: u64,
pub lost_space_by_hash: u64, pub lost_space_by_hash: u64,
pub bytes_read_when_hashing: u64,
pub number_of_removed_files: usize, pub number_of_removed_files: usize,
pub number_of_failed_to_remove_files: usize, pub number_of_failed_to_remove_files: usize,
pub gained_space: u64, pub gained_space: u64,
@ -61,6 +62,7 @@ impl Info {
number_of_duplicated_files_by_hash: 0, number_of_duplicated_files_by_hash: 0,
lost_space_by_size: 0, lost_space_by_size: 0,
lost_space_by_hash: 0, lost_space_by_hash: 0,
bytes_read_when_hashing: 0,
number_of_removed_files: 0, number_of_removed_files: 0,
number_of_failed_to_remove_files: 0, number_of_failed_to_remove_files: 0,
gained_space: 0, gained_space: 0,
@ -580,6 +582,7 @@ impl DuplicateFinder {
if n == 0 { if n == 0 {
break; break;
} }
self.information.bytes_read_when_hashing += n as u64;
hasher.update(&buffer[..n]); hasher.update(&buffer[..n]);
} }
if !error_reading_file { if !error_reading_file {
@ -640,6 +643,11 @@ impl DuplicateFinder {
self.information.gained_space.file_size(options::BINARY).unwrap(), self.information.gained_space.file_size(options::BINARY).unwrap(),
self.information.gained_space 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 removed files - {}", self.information.number_of_removed_files);
println!("Number of failed to remove files - {}", self.information.number_of_failed_to_remove_files); println!("Number of failed to remove files - {}", self.information.number_of_failed_to_remove_files);