mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Serialize command parameters to data output files
This patch adds any parameter used to data output files (currently JSON and CSV files). With that users have direct access to both input values (i.e., benchmark parameters) and the resulting timings which should simplify follow-up analyses.
This commit is contained in:
1 parent
9afe57dcd2
commit
b252531bde
3 files changed
+15
No files matched your search
@@ -412,5 +412,6 @@ pub fn run_benchmark(
|
||||
t_min,
|
||||
t_max,
|
||||
times_real,
|
||||
cmd.get_parameter().map(|p| p.1),
|
||||
))
|
||||
}
|
||||
@@ -83,6 +83,7 @@ fn test_markdown_format_ms() {
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
@@ -94,6 +95,7 @@ fn test_markdown_format_ms() {
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(exporter.serialize(&timing_results, None).unwrap()).unwrap();
|
||||
@@ -126,6 +128,7 @@ fn test_markdown_format_s() {
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
@@ -137,6 +140,7 @@ fn test_markdown_format_s() {
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(exporter.serialize(&timing_results, None).unwrap()).unwrap();
|
||||
@@ -168,6 +172,7 @@ fn test_markdown_format_time_unit_s() {
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
@@ -179,6 +184,7 @@ fn test_markdown_format_time_unit_s() {
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(
|
||||
@@ -216,6 +222,7 @@ fn test_markdown_format_time_unit_ms() {
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
@@ -227,6 +234,7 @@ fn test_markdown_format_time_unit_ms() {
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
None, // parameter
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(
|
||||
|
||||
@@ -173,6 +173,10 @@ pub struct BenchmarkResult {
|
||||
/// All run time measurements
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub times: Option<Vec<Second>>,
|
||||
|
||||
/// Any parameter used
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parameter: Option<i32>,
|
||||
}
|
||||
|
||||
impl BenchmarkResult {
|
||||
@@ -186,6 +190,7 @@ impl BenchmarkResult {
|
||||
min: Second,
|
||||
max: Second,
|
||||
times: Vec<Second>,
|
||||
parameter: Option<i32>,
|
||||
) -> Self {
|
||||
BenchmarkResult {
|
||||
command,
|
||||
@@ -196,6 +201,7 @@ impl BenchmarkResult {
|
||||
min,
|
||||
max,
|
||||
times: Some(times),
|
||||
parameter,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user