mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-11-30 11:53:11 +03:00
parent
921f999018
commit
6a8dd1962c
@ -205,6 +205,19 @@ pub fn run_benchmark(
|
||||
let mut times_system: Vec<Second> = vec![];
|
||||
let mut all_succeeded = true;
|
||||
|
||||
// Run init command
|
||||
let prepare_cmd = options.preparation_command.as_ref().map(|values| {
|
||||
let preparation_command = if values.len() == 1 {
|
||||
&values[0]
|
||||
} else {
|
||||
&values[num]
|
||||
};
|
||||
match cmd.get_parameter() {
|
||||
Some((param, value)) => Command::new_parametrized(preparation_command, param, value),
|
||||
None => Command::new(preparation_command),
|
||||
}
|
||||
});
|
||||
|
||||
// Warmup phase
|
||||
if options.warmup_count > 0 {
|
||||
let progress_bar = get_progress_bar(
|
||||
@ -214,6 +227,7 @@ pub fn run_benchmark(
|
||||
);
|
||||
|
||||
for _ in 0..options.warmup_count {
|
||||
let _ = run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
|
||||
let _ = time_shell_command(
|
||||
&options.shell,
|
||||
cmd,
|
||||
@ -233,19 +247,6 @@ pub fn run_benchmark(
|
||||
options.output_style,
|
||||
);
|
||||
|
||||
// Run init command
|
||||
let prepare_cmd = options.preparation_command.as_ref().map(|values| {
|
||||
let preparation_command = if values.len() == 1 {
|
||||
&values[0]
|
||||
} else {
|
||||
&values[num]
|
||||
};
|
||||
match cmd.get_parameter() {
|
||||
Some((param, value)) => Command::new_parametrized(preparation_command, param, value),
|
||||
None => Command::new(preparation_command),
|
||||
}
|
||||
});
|
||||
|
||||
let prepare_res = run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
|
||||
|
||||
// Initial timing run
|
||||
|
Loading…
Reference in New Issue
Block a user