Skip to content
Myr

Rename Runs to RunBounds

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

authored by David Peter · committed by David Peter · parent 250db61 · Browse files · 2 files+16 added−16 removed
This commit

State

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

Diff stats

2 files+16 added−16 removed

  • other:+16 added−16 removed

2 files+16 added−16 removed

modified:src/benchmark/mod.rs+3 added-3 removed
309 unmodified lines
310311 // Set up progress bar (and spinner for initial measurement)312 let progress_bar = if options.output_style != OutputStyleOption::Disabled {313 Some(get_progress_bar(314 options.runs.min,314 options.run_bounds.min,315 "Initial time measurement",316 options.output_style,317 ))318 } else {
17 unmodified lines
336 / (res.time_real + prepare_res.time_real + shell_spawning_time.time_real))337 as u64;338339 let count = {340 let min = cmp::max(runs_in_min_time, options.runs.min);340 let min = cmp::max(runs_in_min_time, options.run_bounds.min);341342 options343 .runs343 .run_bounds344 .max345 .as_ref()346 .map(|max| cmp::min(min, *max))347 .unwrap_or(min)
173 unmodified lines
modified:src/options.rs+13 added-13 removed
91 unmodified lines
92 /// Disable all the output93 Disabled,94}9596/// Number of runs for a benchmark97pub struct Runs {96/// Bounds for the number of benchmark runs97pub struct RunBounds {98 /// Minimum number of benchmark runs99 pub min: u64,100101 /// Maximum number of benchmark runs102 pub max: Option<u64>,103}104105impl Default for Runs {106 fn default() -> Runs {107 Runs { min: 10, max: None }105impl Default for RunBounds {106 fn default() -> RunBounds {107 RunBounds { min: 10, max: None }108 }109}110111/// A set of options for hyperfine112pub struct Options {113 /// Number of warmup runs114 pub warmup_count: u64,115116 /// Number of benchmark runs117 pub runs: Runs,116 /// Upper and lower bound for the number of benchmark runs117 pub run_bounds: RunBounds,118119 /// Minimum benchmarking time120 pub min_time_sec: Second,121
31 unmodified lines
153 fn default() -> Options {154 Options {155 names: None,156 warmup_count: 0,157 runs: Runs::default(),157 run_bounds: RunBounds::default(),158 min_time_sec: 3.0,159 failure_action: CmdFailureAction::RaiseError,160 setup_command: None,161 preparation_command: None,
30 unmodified lines
192 }193194 match (min_runs, max_runs) {195 (Some(min), None) => {196 options.runs.min = min;196 options.run_bounds.min = min;197 }198 (None, Some(max)) => {199 // Since the minimum was not explicit we lower it if max is below the default min.200 options.runs.min = cmp::min(options.runs.min, max);201 options.runs.max = Some(max);200 options.run_bounds.min = cmp::min(options.run_bounds.min, max);201 options.run_bounds.max = Some(max);202 }203 (Some(min), Some(max)) if min > max => {204 return Err(OptionsError::EmptyRunsRange);205 }206 (Some(min), Some(max)) => {207 options.runs.min = min;208 options.runs.max = Some(max);207 options.run_bounds.min = min;208 options.run_bounds.max = Some(max);209 }210 (None, None) => {}211 };212
112 unmodified lines