mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-29 08:38:56 +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);
|
||||
}
|
||||
}
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.inc(1);
|
||||
}
|
||||
}
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.finish_and_clear();
|
||||
|
||||
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||
}
|
||||
|
||||
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
|
||||
|
||||
Ok(TimingResult {
|
||||
time_real: mean(×_real),
|
||||
time_user: mean(×_user),
|
||||
@@ -253,13 +251,11 @@ pub fn run_benchmark(
|
||||
options.failure_action,
|
||||
None,
|
||||
)?;
|
||||
if let Some(ref pbar) = progress_bar {
|
||||
pbar.inc(1);
|
||||
}
|
||||
}
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.finish_and_clear();
|
||||
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||
|
||||
}
|
||||
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
|
||||
|
||||
}
|
||||
|
||||
// Set up progress bar (and spinner for initial measurement)
|
||||
@@ -310,11 +306,9 @@ pub fn run_benchmark(
|
||||
all_succeeded = all_succeeded && success;
|
||||
|
||||
// Re-configure the progress bar
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.set_length(count);
|
||||
bar.inc(1);
|
||||
}
|
||||
|
||||
progress_bar.as_ref().map(|bar| bar.set_length(count));
|
||||
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||
|
||||
// Gather statistics
|
||||
for _ in 0..count_remaining {
|
||||
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())
|
||||
};
|
||||
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.set_message(&msg);
|
||||
}
|
||||
progress_bar.as_ref().map(|bar| bar.set_message(&msg));
|
||||
|
||||
let (res, success) = time_shell_command(
|
||||
&options.shell,
|
||||
@@ -342,14 +334,12 @@ pub fn run_benchmark(
|
||||
|
||||
all_succeeded = all_succeeded && success;
|
||||
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.inc(1);
|
||||
}
|
||||
}
|
||||
if let Some(ref bar) = progress_bar {
|
||||
bar.finish_and_clear();
|
||||
progress_bar.as_ref().map(|bar| bar.inc(1));
|
||||
}
|
||||
|
||||
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
|
||||
|
||||
|
||||
// Compute statistical quantities
|
||||
let t_num = times_real.len();
|
||||
let t_mean = mean(×_real);
|
||||
|
||||
Reference in new issue
Block a user