mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-31 08:40:18 +00:00
Represent memory usage as f64 as well
This commit is contained in:
1 parent
27ad0fb65e
commit
6b4e9eb5c2
8 files changed
+93
-79
No files matched your search
@@ -9,7 +9,7 @@ use crate::options::{
|
||||
CmdFailureAction, CommandInputPolicy, CommandOutputPolicy, Options, OutputStyleOption, Shell,
|
||||
};
|
||||
use crate::output::progress_bar::get_progress_bar;
|
||||
use crate::quantity::{byte, second, Information, Time, TimeQuantity};
|
||||
use crate::quantity::{second, Information, InformationQuantity, Time, TimeQuantity};
|
||||
use crate::timer::execute_and_measure;
|
||||
use crate::util::randomized_environment_offset;
|
||||
|
||||
@@ -348,7 +348,7 @@ impl Executor for MockExecutor {
|
||||
time_wall_clock: Self::extract_time(command.get_command_line()),
|
||||
time_user: Time::zero(),
|
||||
time_system: Time::zero(),
|
||||
peak_memory_usage: Information::new::<byte>(0),
|
||||
peak_memory_usage: Information::zero(),
|
||||
exit_status,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ use std::process::ExitStatus;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::outlier_detection::modified_zscores;
|
||||
use crate::quantity::{
|
||||
max, mean, median, min, second, serialize_information, serialize_time, standard_deviation,
|
||||
Information, Time, TimeQuantity,
|
||||
max, mean, median, min, modified_zscores, serialize_information, serialize_time,
|
||||
standard_deviation, Information, Time,
|
||||
};
|
||||
use crate::util::exit_code::extract_exit_code;
|
||||
|
||||
@@ -103,6 +102,11 @@ impl Measurements {
|
||||
max(&self.wall_clock_times())
|
||||
}
|
||||
|
||||
/// Compute modified Z-scores for the wall clock times
|
||||
pub fn modified_zscores(&self) -> Vec<f64> {
|
||||
modified_zscores(&self.wall_clock_times())
|
||||
}
|
||||
|
||||
/// The average user time
|
||||
pub fn time_user_mean(&self) -> Time {
|
||||
mean(
|
||||
@@ -126,19 +130,11 @@ impl Measurements {
|
||||
}
|
||||
|
||||
pub fn peak_memory_usage_mean(&self) -> Information {
|
||||
self.measurements
|
||||
.iter()
|
||||
.map(|m| m.peak_memory_usage)
|
||||
.max() // TODO: should be mean: do we need InformationF64?
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn modified_zscores(&self) -> Vec<f64> {
|
||||
modified_zscores(
|
||||
mean(
|
||||
&self
|
||||
.wall_clock_times()
|
||||
.measurements
|
||||
.iter()
|
||||
.map(|t| t.value_in(second)) // TODO
|
||||
.map(|m| m.peak_memory_usage)
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user