Skip to content
Myr

Rename to Options

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 39a85b8 · Browse files · 3 files+10 added−10 removed
This commit

State

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

Diff stats

3 files+10 added−10 removed

  • other:+10 added−10 removed

3 files+10 added−10 removed

modified:src/benchmark.rs+2 added-2 removed
6 unmodified lines
7use crate::benchmark_result::BenchmarkResult;8use crate::command::Command;9use crate::format::{format_duration, format_duration_unit};10use crate::min_max::{max, min};11use crate::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption, Shell};11use crate::options::{CmdFailureAction, Options, OutputStyleOption, Shell};12use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};13use crate::progress_bar::get_progress_bar;14use crate::shell::execute_and_time;15use crate::timer::wallclocktimer::WallClockTimer;
223 unmodified lines
239pub fn run_benchmark(240 num: usize,241 cmd: &Command<'_>,242 shell_spawning_time: TimingResult,243 options: &HyperfineOptions,243 options: &Options,244) -> Result<BenchmarkResult> {245 let command_name = cmd.get_name();246 if options.output_style != OutputStyleOption::Disabled {247 println!(
269 unmodified lines
modified:src/main.rs+3 added-3 removed
28 unmodified lines
29use benchmark_result::BenchmarkResult;30use command::Command;31use error::OptionsError;32use export::{ExportManager, ExportType};33use options::{HyperfineOptions, OutputStyleOption};33use options::{Options, OutputStyleOption};34use parameter_range::get_parameterized_commands;35use tokenize::tokenize;36use types::ParameterValue;37
38 unmodified lines
76}7778fn run_benchmarks_and_print_comparison(79 commands: &[Command<'_>],80 options: &HyperfineOptions,80 options: &Options,81 export_manager: &ExportManager,82) -> Result<()> {83 let shell_spawning_time =84 mean_shell_spawning_time(&options.shell, options.output_style, options.show_output)?;
30 unmodified lines
115 #[cfg(windows)]116 colored::control::set_virtual_terminal(true).unwrap();117118 let matches = get_arg_matches(env::args_os());119 let options = HyperfineOptions::from_cli_arguments(&matches)?;119 let options = Options::from_cli_arguments(&matches)?;120 let commands = build_commands(&matches)?;121 let export_manager = build_export_manager(&matches)?;122123 run_benchmarks_and_print_comparison(&commands, &options, &export_manager)
226 unmodified lines
modified:src/options.rs+5 added-5 removed
102 unmodified lines
103 }104}105106/// A set of options for hyperfine107pub struct HyperfineOptions {107pub struct Options {108 /// Number of warmup runs109 pub warmup_count: u64,110111 /// Number of benchmark runs
31 unmodified lines
143 /// benchmark outputs.144 pub names: Option<Vec<String>>,145}146147impl Default for HyperfineOptions {148 fn default() -> HyperfineOptions {149 HyperfineOptions {147impl Default for Options {148 fn default() -> Options {149 Options {150 names: None,151 warmup_count: 0,152 runs: Runs::default(),153 min_time_sec: 3.0,
8 unmodified lines
162 }163 }164}165166impl HyperfineOptions {166impl Options {167 pub fn from_cli_arguments<'a>(matches: &ArgMatches) -> Result<Self, OptionsError<'a>> {168 let mut options = Self::default();169 let param_to_u64 = |param| {170 matches
136 unmodified lines