mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Add new (hidden) --min-benchmarking-time option
This commit is contained in:
1 parent
77e1b5e72f
commit
dffbdc34d4
4 files changed
+24
-4
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Disable colorized output in case of `TERM=dumb` or `NO_COLOR=1`, see #542 and #555 (@nabijaczleweli)
|
- Disable colorized output in case of `TERM=dumb` or `NO_COLOR=1`, see #542 and #555 (@nabijaczleweli)
|
||||||
|
- Add new (experimental) `--min-benchmarking-time <secs>` option, see #527 (@sharkdp)
|
||||||
|
|
||||||
## Changes
|
## Changes
|
||||||
|
|
||||||
|
|||||||
+11
@@ -294,6 +294,17 @@ fn build_command() -> Command<'static> {
|
|||||||
.help("Give a meaningful name to a command. This can be specified multiple times \
|
.help("Give a meaningful name to a command. This can be specified multiple times \
|
||||||
if several commands are benchmarked."),
|
if several commands are benchmarked."),
|
||||||
)
|
)
|
||||||
|
// This option is hidden for now, as it is not yet clear yet if we want to 'stabilize' this,
|
||||||
|
// see discussion in https://github.com/sharkdp/hyperfine/issues/527
|
||||||
|
.arg(
|
||||||
|
Arg::new("min-benchmarking-time")
|
||||||
|
.long("min-benchmarking-time")
|
||||||
|
.takes_value(true)
|
||||||
|
.hide(true)
|
||||||
|
.help("Set the minimum time (in seconds) to run benchmarks. Note that the number of \
|
||||||
|
benchmark runs is additionally influenced by the `--min-runs`, `--max-runs`, and \
|
||||||
|
`--runs` option.")
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("debug-mode")
|
Arg::new("debug-mode")
|
||||||
.long("debug-mode")
|
.long("debug-mode")
|
||||||
|
|||||||
+5
-3
@@ -1,4 +1,4 @@
|
|||||||
use std::num::{self, ParseIntError};
|
use std::num::{self, ParseFloatError, ParseIntError};
|
||||||
|
|
||||||
use rust_decimal::Error as DecimalError;
|
use rust_decimal::Error as DecimalError;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
@@ -43,8 +43,10 @@ pub enum OptionsError<'a> {
|
|||||||
TooManyCommandNames(usize),
|
TooManyCommandNames(usize),
|
||||||
#[error("'--command-name' has been specified {0} times. It has to appear exactly once, or exactly {1} times (number of benchmarks)")]
|
#[error("'--command-name' has been specified {0} times. It has to appear exactly once, or exactly {1} times (number of benchmarks)")]
|
||||||
UnexpectedCommandNameCount(usize, usize),
|
UnexpectedCommandNameCount(usize, usize),
|
||||||
#[error("Could not read numeric argument to '--{0}': {1}")]
|
#[error("Could not read numeric integer argument to '--{0}': {1}")]
|
||||||
NumericParsingError(&'a str, ParseIntError),
|
IntParsingError(&'a str, ParseIntError),
|
||||||
|
#[error("Could not read numeric floating point argument to '--{0}': {1}")]
|
||||||
|
FloatParsingError(&'a str, ParseFloatError),
|
||||||
#[error("An empty command has been specified for the '--shell <command>' option")]
|
#[error("An empty command has been specified for the '--shell <command>' option")]
|
||||||
EmptyShell,
|
EmptyShell,
|
||||||
#[error("Failed to parse '--shell <command>' expression as command line: {0}")]
|
#[error("Failed to parse '--shell <command>' expression as command line: {0}")]
|
||||||
|
|||||||
+7
-1
@@ -226,7 +226,7 @@ impl Options {
|
|||||||
.value_of(param)
|
.value_of(param)
|
||||||
.map(|n| {
|
.map(|n| {
|
||||||
n.parse::<u64>()
|
n.parse::<u64>()
|
||||||
.map_err(|e| OptionsError::NumericParsingError(param, e))
|
.map_err(|e| OptionsError::IntParsingError(param, e))
|
||||||
})
|
})
|
||||||
.transpose()
|
.transpose()
|
||||||
};
|
};
|
||||||
@@ -345,6 +345,12 @@ impl Options {
|
|||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(time) = matches.value_of("min-benchmarking-time") {
|
||||||
|
options.min_benchmarking_time = time
|
||||||
|
.parse::<f64>()
|
||||||
|
.map_err(|e| OptionsError::FloatParsingError("min-benchmarking-time", e))?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(options)
|
Ok(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user