mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 17:00:18 +00:00
Group units, formatting, and statistics under quantity
This commit is contained in:
1 parent
bef66df7e4
commit
aa14b8c0d9
20 files changed
+266
-265
No files matched your search
@@ -2,8 +2,6 @@ use std::collections::BTreeMap;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::util::units::Second;
|
||||
|
||||
/// Set of values that will be exported.
|
||||
// NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the
|
||||
// `parameters` map. Update `src/hyperfine/export/csv.rs` with new fields, as appropriate.
|
||||
@@ -18,29 +16,29 @@ pub struct BenchmarkResult {
|
||||
pub command_with_unused_parameters: String,
|
||||
|
||||
/// The average run time
|
||||
pub mean: Second,
|
||||
pub mean: f64,
|
||||
|
||||
/// The standard deviation of all run times. Not available if only one run has been performed
|
||||
pub stddev: Option<Second>,
|
||||
pub stddev: Option<f64>,
|
||||
|
||||
/// The median run time
|
||||
pub median: Second,
|
||||
pub median: f64,
|
||||
|
||||
/// Time spent in user mode
|
||||
pub user: Second,
|
||||
pub user: f64,
|
||||
|
||||
/// Time spent in kernel mode
|
||||
pub system: Second,
|
||||
pub system: f64,
|
||||
|
||||
/// Minimum of all measured times
|
||||
pub min: Second,
|
||||
pub min: f64,
|
||||
|
||||
/// Maximum of all measured times
|
||||
pub max: Second,
|
||||
pub max: f64,
|
||||
|
||||
/// All run time measurements
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub times: Option<Vec<Second>>,
|
||||
pub times: Option<Vec<f64>>,
|
||||
|
||||
/// Maximum memory usage of the process, in bytes
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use std::process::ExitStatus;
|
||||
|
||||
use crate::outlier_detection::modified_zscores;
|
||||
use crate::quantity::statistics::{max, mean, median, min, modified_zscores, standard_deviation};
|
||||
use crate::quantity::{second, Information, Time};
|
||||
use crate::util::statistics::{max, mean, median, min, standard_deviation};
|
||||
|
||||
/// Performance measurements and exit status from running a single command
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
|
||||
@@ -14,11 +14,12 @@ use crate::options::{
|
||||
};
|
||||
use crate::outlier_detection::OUTLIER_THRESHOLD;
|
||||
use crate::output::console_writeln;
|
||||
use crate::output::format::{format_duration, format_duration_unit};
|
||||
use crate::output::progress_bar::get_progress_bar;
|
||||
use crate::output::warnings::{OutlierWarningOptions, Warnings};
|
||||
use crate::parameter::ParameterNameAndValue;
|
||||
use crate::quantity::{byte, const_time_from_seconds, ratio, second, Time, Zero};
|
||||
use crate::quantity::{
|
||||
byte, const_time_from_seconds, format_duration, format_duration_unit, ratio, second, Time, Zero,
|
||||
};
|
||||
use crate::util::exit_code::extract_exit_code;
|
||||
use benchmark_result::BenchmarkResult;
|
||||
use measurement::{Measurement, Measurements};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use super::benchmark_result::BenchmarkResult;
|
||||
use crate::{options::SortOrder, util::units::Scalar};
|
||||
use crate::options::SortOrder;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BenchmarkResultWithRelativeSpeed<'a> {
|
||||
pub result: &'a BenchmarkResult,
|
||||
pub relative_speed: Scalar,
|
||||
pub relative_speed_stddev: Option<Scalar>,
|
||||
pub relative_speed: f64,
|
||||
pub relative_speed_stddev: Option<f64>,
|
||||
pub is_reference: bool,
|
||||
// Less means faster
|
||||
pub relative_ordering: Ordering,
|
||||
@@ -119,7 +119,7 @@ pub fn compute(
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn create_result(name: &str, mean: Scalar) -> BenchmarkResult {
|
||||
fn create_result(name: &str, mean: f64) -> BenchmarkResult {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
BenchmarkResult {
|
||||
|
||||
Reference in new issue
Block a user