pub struct BenchmarkStats {
pub name: String,
pub samples: usize,
pub mean_ns: f64,
pub median_ns: f64,
pub std_dev_ns: f64,
pub min_ns: u64,
pub max_ns: u64,
pub timestamp: String,
pub distribution: Option<Vec<u64>>,
}Expand description
Statistics for a single benchmark
Fields§
§name: StringBenchmark name
samples: usizeNumber of samples
mean_ns: f64Mean execution time (nanoseconds)
median_ns: f64Median execution time
std_dev_ns: f64Standard deviation
min_ns: u64Minimum execution time
max_ns: u64Maximum execution time
timestamp: StringTimestamp when benchmark was run
distribution: Option<Vec<u64>>Optional: full distribution of timings
Implementations§
Source§impl BenchmarkStats
impl BenchmarkStats
Sourcepub fn from_samples(name: String, samples: Vec<u64>) -> Self
pub fn from_samples(name: String, samples: Vec<u64>) -> Self
Create from a list of timing samples
Sourcepub fn coefficient_of_variation(&self) -> f64
pub fn coefficient_of_variation(&self) -> f64
Calculate coefficient of variation (CV)
Sourcepub fn format_mean(&self) -> String
pub fn format_mean(&self) -> String
Format duration in human-readable form
Sourcepub fn format_median(&self) -> String
pub fn format_median(&self) -> String
Format median duration
Sourcepub fn percentile(&self, p: f64) -> Option<f64>
pub fn percentile(&self, p: f64) -> Option<f64>
Calculate percentile (0.0 to 100.0)
Sourcepub fn confidence_interval_95(&self) -> (f64, f64)
pub fn confidence_interval_95(&self) -> (f64, f64)
Calculate 95% confidence interval for the mean
Sourcepub fn detect_outliers(&self) -> Option<Vec<u64>>
pub fn detect_outliers(&self) -> Option<Vec<u64>>
Detect outliers using IQR method
Sourcepub fn without_outliers(&self) -> Option<Self>
pub fn without_outliers(&self) -> Option<Self>
Create a new BenchmarkStats with outliers removed
Trait Implementations§
Source§impl Clone for BenchmarkStats
impl Clone for BenchmarkStats
Source§fn clone(&self) -> BenchmarkStats
fn clone(&self) -> BenchmarkStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BenchmarkStats
impl Debug for BenchmarkStats
Source§impl<'de> Deserialize<'de> for BenchmarkStats
impl<'de> Deserialize<'de> for BenchmarkStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BenchmarkStats
impl RefUnwindSafe for BenchmarkStats
impl Send for BenchmarkStats
impl Sync for BenchmarkStats
impl Unpin for BenchmarkStats
impl UnwindSafe for BenchmarkStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more