mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 09:01:25 +00:00
update output condition check to use .map
This commit is contained in:
1 parent
34eb150fef
commit
b3084cbb58
1 file changed
+16
-26
+16
-26
@@ -141,14 +141,12 @@ pub fn mean_shell_spawning_time(
|
|||||||
times_system.push(r.time_system);
|
times_system.push(r.time_system);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(ref bar) = progress_bar {
|
|
||||||
bar.inc(1);
|
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(ref bar) = progress_bar {
|
|
||||||
bar.finish_and_clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
|
||||||
|
|
||||||
Ok(TimingResult {
|
Ok(TimingResult {
|
||||||
time_real: mean(×_real),
|
time_real: mean(×_real),
|
||||||
time_user: mean(×_user),
|
time_user: mean(×_user),
|
||||||
@@ -253,13 +251,11 @@ pub fn run_benchmark(
|
|||||||
options.failure_action,
|
options.failure_action,
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
if let Some(ref pbar) = progress_bar {
|
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||||
pbar.inc(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(ref bar) = progress_bar {
|
|
||||||
bar.finish_and_clear();
|
|
||||||
}
|
}
|
||||||
|
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up progress bar (and spinner for initial measurement)
|
// Set up progress bar (and spinner for initial measurement)
|
||||||
@@ -310,11 +306,9 @@ pub fn run_benchmark(
|
|||||||
all_succeeded = all_succeeded && success;
|
all_succeeded = all_succeeded && success;
|
||||||
|
|
||||||
// Re-configure the progress bar
|
// Re-configure the progress bar
|
||||||
if let Some(ref bar) = progress_bar {
|
progress_bar.as_ref().map(|bar| bar.set_length(count));
|
||||||
bar.set_length(count);
|
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||||
bar.inc(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gather statistics
|
// Gather statistics
|
||||||
for _ in 0..count_remaining {
|
for _ in 0..count_remaining {
|
||||||
run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
|
run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
|
||||||
@@ -324,9 +318,7 @@ pub fn run_benchmark(
|
|||||||
format!("Current estimate: {}", mean.to_string().green())
|
format!("Current estimate: {}", mean.to_string().green())
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(ref bar) = progress_bar {
|
progress_bar.as_ref().map(|bar| bar.set_message(&msg));
|
||||||
bar.set_message(&msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (res, success) = time_shell_command(
|
let (res, success) = time_shell_command(
|
||||||
&options.shell,
|
&options.shell,
|
||||||
@@ -342,14 +334,12 @@ pub fn run_benchmark(
|
|||||||
|
|
||||||
all_succeeded = all_succeeded && success;
|
all_succeeded = all_succeeded && success;
|
||||||
|
|
||||||
if let Some(ref bar) = progress_bar {
|
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||||
bar.inc(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(ref bar) = progress_bar {
|
|
||||||
bar.finish_and_clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
|
||||||
|
|
||||||
|
|
||||||
// Compute statistical quantities
|
// Compute statistical quantities
|
||||||
let t_num = times_real.len();
|
let t_num = times_real.len();
|
||||||
let t_mean = mean(×_real);
|
let t_mean = mean(×_real);
|
||||||
|
|||||||
Reference in new issue
Block a user