mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 09:01:25 +00:00
Improve hints for outlier warnings
Improve hints for outlier warnings if `--warmup` or `--prepare` are in use already. Closes #570
This commit is contained in:
1 parent
781a6815c1
commit
5b5daa0493
3 files changed
+56
-14
No files matched your search
+18
-3
@@ -11,7 +11,7 @@ use crate::options::{CmdFailureAction, ExecutorKind, Options, OutputStyleOption}
|
||||
use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
|
||||
use crate::output::format::{format_duration, format_duration_unit};
|
||||
use crate::output::progress_bar::get_progress_bar;
|
||||
use crate::output::warnings::Warnings;
|
||||
use crate::output::warnings::{OutlierWarningOptions, Warnings};
|
||||
use crate::parameter::ParameterNameAndValue;
|
||||
use crate::util::exit_code::extract_exit_code;
|
||||
use crate::util::min_max::{max, min};
|
||||
@@ -333,10 +333,25 @@ impl<'a> Benchmark<'a> {
|
||||
|
||||
// Run outlier detection
|
||||
let scores = modified_zscores(×_real);
|
||||
|
||||
let outlier_warning_options = OutlierWarningOptions {
|
||||
warmup_in_use: self.options.warmup_count > 0,
|
||||
prepare_in_use: self
|
||||
.options
|
||||
.preparation_command
|
||||
.as_ref()
|
||||
.map(|v| v.len())
|
||||
.unwrap_or(0)
|
||||
> 0,
|
||||
};
|
||||
|
||||
if scores[0] > OUTLIER_THRESHOLD {
|
||||
warnings.push(Warnings::SlowInitialRun(times_real[0]));
|
||||
warnings.push(Warnings::SlowInitialRun(
|
||||
times_real[0],
|
||||
outlier_warning_options,
|
||||
));
|
||||
} else if scores.iter().any(|&s| s.abs() > OUTLIER_THRESHOLD) {
|
||||
warnings.push(Warnings::OutliersDetected);
|
||||
warnings.push(Warnings::OutliersDetected(outlier_warning_options));
|
||||
}
|
||||
|
||||
if !warnings.is_empty() {
|
||||
|
||||
Reference in new issue
Block a user