mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Update warnings, switch to colored crate
This commit is contained in:
1 parent
2ddc21c7d4
commit
d5c21ec272
8 files changed
+101
-87
No files matched your search
@@ -1,5 +1,3 @@
|
||||
use std::fmt;
|
||||
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
|
||||
/// Type alias for unit of time
|
||||
@@ -62,41 +60,6 @@ pub fn get_progress_bar(length: u64, msg: &str) -> ProgressBar {
|
||||
progress_bar
|
||||
}
|
||||
|
||||
/// Possible benchmark warnings
|
||||
pub enum Warnings {
|
||||
FastExecutionTime,
|
||||
NonZeroExitCode,
|
||||
SlowInitialRun,
|
||||
OutliersDetected,
|
||||
}
|
||||
|
||||
impl fmt::Display for Warnings {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Warnings::FastExecutionTime => write!(
|
||||
f,
|
||||
"Command took less than {:.0} ms to complete. Results might be inaccurate.",
|
||||
MIN_EXECUTION_TIME * 1e3
|
||||
),
|
||||
Warnings::NonZeroExitCode => write!(f, "Ignoring non-zero exit code."),
|
||||
Warnings::SlowInitialRun => write!(
|
||||
f,
|
||||
"The first benchmarking run for this command was significantly slower than the \
|
||||
rest. This could be caused by (filesystem) caches that were not filled. You \
|
||||
should consider using the '--warmup' option to fill those caches before the \
|
||||
benchmark. Alternatively, use the '--prepare' option to clear the caches before \
|
||||
each timing run."
|
||||
),
|
||||
Warnings::OutliersDetected => write!(
|
||||
f,
|
||||
"Statistical outliers were detected. Consider re-running this benchmark without \
|
||||
any interferences from other programs. It might help to use the '--warmup' or \
|
||||
'--prepare' options to mitigate outliers."
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A max function for f64's without NaNs
|
||||
pub fn max(vals: &[f64]) -> f64 {
|
||||
*vals.iter()
|
||||
|
||||
Reference in new issue
Block a user