Skip to content
Myr

Fix number of runs in for loops

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by sharkdp · parent 407c738 · Browse files · 1 file+7 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−6 removed

  • other:+7 added−6 removed

1 file+7 added−6 removed

modified:src/main.rs+7 added-6 removed
136 unmodified lines
137 // Warmup phase138 if options.warmup_count > 0 {139 let bar = get_progress_bar(options.warmup_count, "Performing warmup runs");140141 for _ in 1..options.warmup_count {142 bar.inc(1);141 for _ in 0..options.warmup_count {142 let _ = time_shell_command(cmd, options.ignore_failure)?;143 bar.inc(1);144 }145 bar.finish_and_clear();146 }147
2 unmodified lines
150151 // Initial timing run152 let res = time_shell_command(cmd, options.ignore_failure)?;153154 // Determine number of benchmark runs155 let runs_in_min_time = (options.min_time_sec / res.execution_time_sec) as u64;156157 let count = if runs_in_min_time >= options.min_runs {158 runs_in_min_time
8 unmodified lines
167 bar.set_length(count);168 bar.set_message("Collecting statistics");169170 // Gather statistics170 for _ in 1..count {171 bar.inc(1);171 for _ in 0..count {172 let res = time_shell_command(cmd, options.ignore_failure)?;173 results.push(res);174 bar.inc(1);175 }176 bar.finish_and_clear();177178 // Compute statistical quantities
48 unmodified lines
227 const COUNT: u64 = 200;228 let bar = get_progress_bar(COUNT, "Measuring shell spawning time");229230 let mut times: Vec<Second> = vec![];230 for _ in 1..COUNT {231 bar.inc(1);231 for _ in 0..COUNT {232 let res = time_shell_command("", false);233234 match res {235 Err(_) => {
6 unmodified lines
242 Ok(r) => {243 times.push(r.execution_time_sec);244 }245 }246 bar.inc(1);247 }248 bar.finish_and_clear();249250 let mean: f64 = mean(times.iter().cloned()); // TODO: get rid of .cloned()
101 unmodified lines