feat: improve time reports

This commit is contained in:
Daumantas Kavolis 2023-09-28 13:05:10 +03:00 committed by Amaan Qureshi
parent 0feaddd0b5
commit 08d211a546
No known key found for this signature in database
GPG key ID: E67890ADC4227273
3 changed files with 54 additions and 22 deletions

View file

@ -568,20 +568,24 @@ fn run() -> Result<()> {
encoding,
};
let this_file_errored = parse::parse_file_at_path(&mut parser, &opts)?;
let parse_result = parse::parse_file_at_path(&mut parser, &opts)?;
if should_track_stats {
stats.total_parses += 1;
if !this_file_errored {
if parse_result.successful {
stats.successful_parses += 1;
}
if let Some(duration) = parse_result.duration {
stats.total_bytes += parse_result.bytes;
stats.total_duration += duration;
}
}
has_error |= this_file_errored;
has_error |= !parse_result.successful;
}
if should_track_stats {
println!("{stats}");
println!("\n{stats}");
}
if has_error {