Skip to content
Myr

Add new (hidden) --min-benchmarking-time option

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 77e1b5e · Browse files · 4 files+24 added−4 removed
This commit

State

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

Diff stats

4 files+24 added−4 removed

  • other:+24 added−4 removed

4 files+24 added−4 removed

modified:src/cli.rs+11 added
292 unmodified lines
293 .value_name("NAME")294 .help("Give a meaningful name to a command. This can be specified multiple times \295 if several commands are benchmarked."),296 )297 // This option is hidden for now, as it is not yet clear yet if we want to 'stabilize' this,298 // see discussion in https://github.com/sharkdp/hyperfine/issues/527299 .arg(300 Arg::new("min-benchmarking-time")301 .long("min-benchmarking-time")302 .takes_value(true)303 .hide(true)304 .help("Set the minimum time (in seconds) to run benchmarks. Note that the number of \305 benchmark runs is additionally influenced by the `--min-runs`, `--max-runs`, and \306 `--runs` option.")307 )308 .arg(309 Arg::new("debug-mode")310 .long("debug-mode")311 .hide(true)312 .help("Enable debug mode which does not actually run commands, but returns fake times when the command is 'sleep <time>'.")
7 unmodified lines
modified:src/error.rs+5 added-3 removed
1use std::num::{self, ParseIntError};1use std::num::{self, ParseFloatError, ParseIntError};23use rust_decimal::Error as DecimalError;4use thiserror::Error;5
36 unmodified lines
42 #[error("Too many --command-name options: Expected {0} at most")]43 TooManyCommandNames(usize),44 #[error("'--command-name' has been specified {0} times. It has to appear exactly once, or exactly {1} times (number of benchmarks)")]45 UnexpectedCommandNameCount(usize, usize),46 #[error("Could not read numeric argument to '--{0}': {1}")]47 NumericParsingError(&'a str, ParseIntError),46 #[error("Could not read numeric integer argument to '--{0}': {1}")]47 IntParsingError(&'a str, ParseIntError),48 #[error("Could not read numeric floating point argument to '--{0}': {1}")]49 FloatParsingError(&'a str, ParseFloatError),50 #[error("An empty command has been specified for the '--shell <command>' option")]51 EmptyShell,52 #[error("Failed to parse '--shell <command>' expression as command line: {0}")]53 ShellParseError(shell_words::ParseError),
3 unmodified lines
modified:src/options.rs+7 added-1 removed
224 unmodified lines
225 matches226 .value_of(param)227 .map(|n| {228 n.parse::<u64>()229 .map_err(|e| OptionsError::NumericParsingError(param, e))229 .map_err(|e| OptionsError::IntParsingError(param, e))230 })231 .transpose()232 };233
110 unmodified lines
344 Some("second") => Some(Unit::Second),345 _ => None,346 };347348 if let Some(time) = matches.value_of("min-benchmarking-time") {349 options.min_benchmarking_time = time350 .parse::<f64>()351 .map_err(|e| OptionsError::FloatParsingError("min-benchmarking-time", e))?;352 }353354 Ok(options)355 }356357 pub fn validate_against_command_list(&self, commands: &Commands) -> Result<()> {
56 unmodified lines
modified:CHANGELOG.md+1 added
1 unmodified line
23## Features45- Disable colorized output in case of `TERM=dumb` or `NO_COLOR=1`, see #542 and #555 (@nabijaczleweli)6- Add new (experimental) `--min-benchmarking-time <secs>` option, see #527 (@sharkdp)78## Changes910
314 unmodified lines