diff options
| author | UMTS at Teleco <crt@teleco.ch> | 2026-03-08 07:39:28 +0100 |
|---|---|---|
| committer | UMTS at Teleco <crt@teleco.ch> | 2026-03-08 07:39:28 +0100 |
| commit | 6cd20735eb3176a83d6c3dfd27f30c91cd70ec3b (patch) | |
| tree | fc9956b0c85526b2ad863beaf2a5cd4a32cd9357 /src | |
| parent | 8623ef0ee74ff48a5ee24ee032f5b549f662f09d (diff) | |
added timer to flex on how fast it is to cli command.
Diffstat (limited to 'src')
| -rw-r--r-- | src/output.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/output.rs b/src/output.rs index fe3b141..6a02f32 100644 --- a/src/output.rs +++ b/src/output.rs @@ -201,9 +201,18 @@ pub fn print_errors(results: &[DomainResult], verbose: bool) { } 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; eprint!("\rParsing results : {}%", percent); 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 } } |
