pub struct BenchReport {
pub spec: BenchSpec,
pub samples: Vec<BenchSample>,
pub phases: Vec<SemanticPhase>,
pub timeline: Vec<HarnessTimelineSpan>,
}Expand description
Complete benchmark report with all timing samples.
Contains the original specification and all collected samples. Can be serialized to JSON for storage or transmission.
§Example
use mobench_sdk::timing::{BenchSpec, run_closure};
let spec = BenchSpec::new("example", 50, 5)?;
let report = run_closure(spec, || {
std::hint::black_box(42);
Ok(())
})?;
// Calculate statistics
let samples: Vec<u64> = report.samples.iter()
.map(|s| s.duration_ns)
.collect();
let min = samples.iter().min().unwrap();
let max = samples.iter().max().unwrap();
let mean = samples.iter().sum::<u64>() / samples.len() as u64;
println!("Min: {} ns, Max: {} ns, Mean: {} ns", min, max, mean);Fields§
§spec: BenchSpecThe specification used for this benchmark run.
samples: Vec<BenchSample>All collected timing samples.
The length equals spec.iterations. Samples are in execution order.
phases: Vec<SemanticPhase>Optional semantic phase timings captured during measured iterations.
Defaults to an empty vector when deserializing reports produced by older mobench versions that did not emit phase data.
timeline: Vec<HarnessTimelineSpan>Exact harness timeline spans in execution order.
Defaults to an empty vector when deserializing reports produced by older mobench versions that did not emit timeline data.
Implementations§
Source§impl BenchReport
impl BenchReport
Sourcepub fn std_dev_ns(&self) -> f64
pub fn std_dev_ns(&self) -> f64
Returns the standard deviation in nanoseconds (sample std dev, n-1).
Sourcepub fn percentile_ns(&self, p: f64) -> f64
pub fn percentile_ns(&self, p: f64) -> f64
Returns the given percentile (0-100) in nanoseconds.
Sourcepub fn cpu_total_ms(&self) -> Option<u64>
pub fn cpu_total_ms(&self) -> Option<u64>
Returns the total measured CPU time in milliseconds across all iterations.
Sourcepub fn cpu_median_ms(&self) -> Option<u64>
pub fn cpu_median_ms(&self) -> Option<u64>
Returns the median measured CPU time in milliseconds across all iterations.
Sourcepub fn peak_memory_kb(&self) -> Option<u64>
pub fn peak_memory_kb(&self) -> Option<u64>
Returns the maximum baseline-adjusted peak memory growth in kilobytes.
This is the legacy accessor for the serialized peak_memory_kb sample
field. It does not report absolute process or device peak memory.
Sourcepub fn peak_memory_growth_kb(&self) -> Option<u64>
pub fn peak_memory_growth_kb(&self) -> Option<u64>
Returns the maximum baseline-adjusted peak memory growth in kilobytes.
This is an explicit alias for BenchReport::peak_memory_kb to make the
growth semantics clear while preserving the legacy wire field.
Sourcepub fn process_peak_memory_kb(&self) -> Option<u64>
pub fn process_peak_memory_kb(&self) -> Option<u64>
Returns the maximum process resident memory peak in kilobytes.
This reports the current benchmark process peak sampled during measured iterations. It excludes BrowserStack/session-level provider memory.
Sourcepub fn summary(&self) -> BenchSummary
pub fn summary(&self) -> BenchSummary
Returns a statistical summary of the benchmark results.
Trait Implementations§
Source§impl Clone for BenchReport
impl Clone for BenchReport
Source§fn clone(&self) -> BenchReport
fn clone(&self) -> BenchReport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more