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
Provenance
- Commit
bea0cfa- Tree
6128e1e- Author
David Peter <mail@david-peter.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
250db61
2 files changed+16 added−16 removed
modified:src/benchmark/mod.rs+3 added-3 removed
309 unmodified lines310 311 // 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 lines336 / (res.time_real + prepare_res.time_real + shell_spawning_time.time_real))337 as u64;338 339 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);341 342 options343- .runs343+ .run_bounds344 .max345 .as_ref()346 .map(|max| cmp::min(min, *max))347 .unwrap_or(min)173 unmodified linesmodified:src/options.rs+13 added-13 removed
91 unmodified lines92 /// Disable all the output93 Disabled,94 }95 96-/// Number of runs for a benchmark97-pub struct Runs {96+/// Bounds for the number of benchmark runs97+pub struct RunBounds {98 /// Minimum number of benchmark runs99 pub min: u64,100 101 /// Maximum number of benchmark runs102 pub max: Option<u64>,103 }104 105-impl Default for Runs {106- fn default() -> Runs {107- Runs { min: 10, max: None }105+impl Default for RunBounds {106+ fn default() -> RunBounds {107+ RunBounds { min: 10, max: None }108 }109 }110 111 /// A set of options for hyperfine112 pub struct Options {113 /// Number of warmup runs114 pub warmup_count: u64,115 116- /// Number of benchmark runs117- pub runs: Runs,116+ /// Upper and lower bound for the number of benchmark runs117+ pub run_bounds: RunBounds,118 119 /// Minimum benchmarking time120 pub min_time_sec: Second,121 31 unmodified lines153 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 lines192 }193 194 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