Files
hyperfine/src/benchmark/benchmark_result.rs
T

55 lines
1.7 KiB
Rust
Raw Normal View History

2021-08-22 19:08:08 +02:00
use std::collections::BTreeMap;
2021-08-24 21:33:48 +02:00
use serde::Serialize;
2022-02-06 20:01:41 +01:00
use crate::util::units::Second;
2021-08-22 19:08:08 +02:00
/// 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 {
2022-02-20 17:08:39 +01:00
/// The full command line of the program that is being benchmarked
2021-08-22 19:08:08 +02:00
pub command: String,
2023-04-20 21:32:06 +02:00
/// 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,
2022-02-20 17:08:39 +01:00
/// The average run time
2021-08-22 19:08:08 +02:00
pub mean: Second,
/// The standard deviation of all run times. Not available if only one run has been performed
pub stddev: Option<Second>,
2021-08-22 19:08:08 +02:00
/// The median run time
pub median: Second,
2022-02-20 17:08:39 +01:00
/// Time spent in user mode
2021-08-22 19:08:08 +02:00
pub user: Second,
2022-02-20 17:08:39 +01:00
/// Time spent in kernel mode
2021-08-22 19:08:08 +02:00
pub system: Second,
2022-02-20 17:08:39 +01:00
/// Minimum of all measured times
2021-08-22 19:08:08 +02:00
pub min: Second,
2022-02-20 17:08:39 +01:00
/// Maximum of all measured times
2021-08-22 19:08:08 +02:00
pub max: Second,
/// All run time measurements
#[serde(skip_serializing_if = "Option::is_none")]
pub times: Option<Vec<Second>>,
2024-06-23 13:29:05 +02:00
/// Maximum memory usage of the process, in bytes
#[serde(skip_serializing_if = "Option::is_none")]
pub memory_usage_byte: Option<Vec<u64>>,
2022-02-20 17:08:39 +01:00
/// Exit codes of all command invocations
2021-08-22 19:08:08 +02:00
pub exit_codes: Vec<Option<i32>>,
2022-02-20 17:08:39 +01:00
/// Parameter values for this benchmark
2021-08-22 19:08:08 +02:00
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub parameters: BTreeMap<String, String>,
}