Files
hyperfine/src/benchmark/benchmark_result.rs
T
2023-04-20 21:39:23 +02:00

52 lines
1.5 KiB
Rust

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.
#[derive(Debug, Default, Clone, Serialize, PartialEq)]
pub struct BenchmarkResult {
/// The full command line of the program that is being benchmarked
pub command: String,
/// The full command line of the program that is being benchmarked, possibly including a list of
/// parameters that were not used in the command line template.
#[serde(skip_serializing)]
pub command_with_unused_parameters: String,
/// The average run time
pub mean: Second,
/// The standard deviation of all run times. Not available if only one run has been performed
pub stddev: Option<Second>,
/// The median run time
pub median: Second,
/// Time spent in user mode
pub user: Second,
/// Time spent in kernel mode
pub system: Second,
/// Minimum of all measured times
pub min: Second,
/// Maximum of all measured times
pub max: Second,
/// All run time measurements
#[serde(skip_serializing_if = "Option::is_none")]
pub times: Option<Vec<Second>>,
/// Exit codes of all command invocations
pub exit_codes: Vec<Option<i32>>,
/// Parameter values for this benchmark
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub parameters: BTreeMap<String, String>,
}