|
@@ -201,9 +201,18 @@ pub fn print_errors(results: &[DomainResult], verbose: bool) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub fn print_progress(current: usize, total: usize) {
|
|
pub fn print_progress(current: usize, total: usize) {
|
|
|
|
|
+ use std::sync::Mutex;
|
|
|
|
|
+ use std::time::Instant;
|
|
|
|
|
+ static START: Mutex<Option<Instant>> = Mutex::new(None);
|
|
|
|
|
+
|
|
|
|
|
+ let mut lock = START.lock().unwrap();
|
|
|
|
|
+ let start = *lock.get_or_insert_with(Instant::now);
|
|
|
|
|
+
|
|
|
let percent = (current as f64 / total as f64 * 100.0) as u32;
|
|
let percent = (current as f64 / total as f64 * 100.0) as u32;
|
|
|
eprint!("\rParsing results : {}%", percent);
|
|
eprint!("\rParsing results : {}%", percent);
|
|
|
if current == total {
|
|
if current == total {
|
|
|
- eprintln!("\rParsing results : Done ");
|
|
|
|
|
|
|
+ let secs = start.elapsed().as_secs_f64();
|
|
|
|
|
+ eprintln!("\rParsing results : Done (Took {:.1}s) ", secs);
|
|
|
|
|
+ *lock = None; // reset for next search duh
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|