Store typed Measurements in BenchmarkResult

This commit is contained in:
David Peter committed 2026-10-05 12:46:10 +02:00
1 parent 05de077d8e
commit b23372c5e2
7 files changed
+432 -257

No files matched your search

+64 -30
View File
@@ -5,7 +5,7 @@ use csv::WriterBuilder;
use super::Exporter;
use crate::benchmark::benchmark_result::BenchmarkResult;
use crate::options::SortOrder;
use crate::quantity::TimeUnit;
use crate::quantity::{second, TimeUnit};
use anyhow::Result;
@@ -42,13 +42,16 @@ impl Exporter for CsvExporter {
for res in results {
let mut fields = vec![Cow::Borrowed(res.command.as_bytes())];
for f in &[
res.mean,
res.stddev.unwrap_or(0.0),
res.median,
res.user,
res.system,
res.min,
res.max,
res.mean_wall_clock_time().get::<second>(),
res.measurements
.stddev()
.unwrap_or_default()
.get::<second>(),
res.measurements.median().get::<second>(),
res.measurements.time_user_mean().get::<second>(),
res.measurements.time_system_mean().get::<second>(),
res.measurements.min().get::<second>(),
res.measurements.max().get::<second>(),
] {
fields.push(Cow::Owned(format!("{f:.CSV_PRECISION$}").into_bytes()))
}
@@ -65,23 +68,41 @@ impl Exporter for CsvExporter {
#[test]
fn test_csv() {
use crate::benchmark::benchmark_result::Parameter;
use crate::benchmark::measurement::{Measurement, Measurements};
use crate::quantity::{byte, second, Information, Time, Zero};
use std::collections::BTreeMap;
use std::process::ExitStatus;
let exporter = CsvExporter::default();
let results = vec![
BenchmarkResult {
command: String::from("command_a"),
command_with_unused_parameters: String::from("command_a"),
mean: 1.0,
stddev: Some(2.0),
median: 1.0,
user: 3.0,
system: 4.0,
min: 5.0,
max: 6.0,
times: Some(vec![7.0, 8.0, 9.0]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(7.0),
time_user: Time::new::<second>(7.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(8.0),
time_user: Time::new::<second>(8.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(12.0),
time_user: Time::new::<second>(12.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: {
let mut params = BTreeMap::new();
params.insert(
@@ -104,16 +125,29 @@ fn test_csv() {
BenchmarkResult {
command: String::from("command_b"),
command_with_unused_parameters: String::from("command_b"),
mean: 11.0,
stddev: Some(12.0),
median: 11.0,
user: 13.0,
system: 14.0,
min: 15.0,
max: 16.5,
times: Some(vec![17.0, 18.0, 19.0]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(17.0),
time_user: Time::new::<second>(17.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(18.0),
time_user: Time::new::<second>(18.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(19.0),
time_user: Time::new::<second>(19.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: {
let mut params = BTreeMap::new();
params.insert(
@@ -144,7 +178,7 @@ fn test_csv() {
insta::assert_snapshot!(actual, @r#"
command,mean,stddev,median,user,system,min,max,parameter_bar,parameter_foo
command_a,1.000000,2.000000,1.000000,3.000000,4.000000,5.000000,6.000000,two,one
command_b,11.000000,12.000000,11.000000,13.000000,14.000000,15.000000,16.500000,seven,one
command_a,9.000000,2.645751,8.000000,9.000000,0.000000,7.000000,12.000000,two,one
command_b,18.000000,1.000000,18.000000,18.000000,0.000000,17.000000,19.000000,seven,one
"#);
}
+7 -7
View File
@@ -1,7 +1,7 @@
use crate::benchmark::relative_speed::BenchmarkResultWithRelativeSpeed;
use crate::benchmark::{benchmark_result::BenchmarkResult, relative_speed};
use crate::options::SortOrder;
use crate::quantity::{second, FormatQuantity, IsUnit, Time, TimeUnit};
use crate::quantity::{FormatQuantity, IsUnit, TimeUnit};
use super::Exporter;
use anyhow::Result;
@@ -50,14 +50,14 @@ pub trait MarkupExporter {
let cmd_str = measurement
.command_with_unused_parameters
.replace('|', "\\|");
let mean_str = Time::new::<second>(measurement.mean).format_value(unit);
let stddev_str = if let Some(stddev) = measurement.stddev {
format!(" ± {}", Time::new::<second>(stddev).format_value(unit))
let mean_str = measurement.mean_wall_clock_time().format_value(unit);
let stddev_str = if let Some(stddev) = measurement.measurements.stddev() {
format!(" ± {}", stddev.format_value(unit))
} else {
"".into()
};
let min_str = Time::new::<second>(measurement.min).format_value(unit);
let max_str = Time::new::<second>(measurement.max).format_value(unit);
let min_str = measurement.measurements.min().format_value(unit);
let max_str = measurement.measurements.max().format_value(unit);
let rel_str = format!("{:.2}", entry.relative_speed);
let rel_stddev_str = if entry.is_reference {
"".into()
@@ -101,7 +101,7 @@ pub trait MarkupExporter {
fn determine_unit_from_results(results: &[BenchmarkResult]) -> TimeUnit {
if let Some(first_result) = results.first() {
// Use the first BenchmarkResult entry to determine the unit for all entries.
Time::new::<second>(first_result.mean).suitable_unit()
first_result.mean_wall_clock_time().suitable_unit()
} else {
// Default to `Second`.
TimeUnit::Second
+237 -131
View File
@@ -1,10 +1,12 @@
use super::Exporter;
use crate::benchmark::benchmark_result::BenchmarkResult;
use crate::benchmark::measurement::{Measurement, Measurements};
use crate::export::asciidoc::AsciidocExporter;
use crate::export::orgmode::OrgmodeExporter;
use crate::quantity::TimeUnit;
use crate::quantity::{byte, second, Information, Time, TimeUnit, Zero};
use crate::{export::markdown::MarkdownExporter, options::SortOrder};
use std::collections::BTreeMap;
use std::process::ExitStatus;
fn get_output<E: Exporter + Default>(
results: &[BenchmarkResult],
@@ -27,31 +29,57 @@ fn test_markup_export_auto_ms() {
BenchmarkResult {
command: String::from("sleep 0.1"),
command_with_unused_parameters: String::from("sleep 0.1"),
mean: 0.1057,
stddev: Some(0.0016),
median: 0.1057,
user: 0.0009,
system: 0.0011,
min: 0.1023,
max: 0.1080,
times: Some(vec![0.1, 0.1, 0.1]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(0.09),
time_user: Time::new::<second>(0.09),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.10),
time_user: Time::new::<second>(0.10),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.14),
time_user: Time::new::<second>(0.14),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
BenchmarkResult {
command: String::from("sleep 2"),
command_with_unused_parameters: String::from("sleep 2"),
mean: 2.0050,
stddev: Some(0.0020),
median: 2.0050,
user: 0.0009,
system: 0.0012,
min: 2.0020,
max: 2.0080,
times: Some(vec![2.0, 2.0, 2.0]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(2.0),
time_user: Time::new::<second>(2.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(3.0),
time_user: Time::new::<second>(3.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(4.0),
time_user: Time::new::<second>(4.0),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
];
@@ -59,8 +87,8 @@ fn test_markup_export_auto_ms() {
insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, None, SortOrder::Command), @r#"
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 0.1` | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 |
| `sleep 2` | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 ± 0.29 |
| `sleep 0.1` | 110.0 ± 26.5 | 90.0 | 140.0 | 1.00 |
| `sleep 2` | 3000.0 ± 1000.0 | 2000.0 | 4000.0 | 27.27 ± 11.21 |
"#);
insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None, SortOrder::Command), @r#"
@@ -73,24 +101,24 @@ fn test_markup_export_auto_ms() {
| Relative
| `sleep 0.1`
| 105.7 ± 1.6
| 102.3
| 108.0
| 110.0 ± 26.5
| 90.0
| 140.0
| 1.00
| `sleep 2`
| 2005.0 ± 2.0
| 2002.0
| 2008.0
| 18.97 ± 0.29
| 3000.0 ± 1000.0
| 2000.0
| 4000.0
| 27.27 ± 11.21
|===
"#);
insta::assert_snapshot!(get_output::<OrgmodeExporter>(&results, None, SortOrder::Command), @r#"
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|--+--+--+--+--|
| =sleep 0.1= | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 |
| =sleep 2= | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 ± 0.29 |
| =sleep 0.1= | 110.0 ± 26.5 | 90.0 | 140.0 | 1.00 |
| =sleep 2= | 3000.0 ± 1000.0 | 2000.0 | 4000.0 | 27.27 ± 11.21 |
"#);
}
@@ -102,31 +130,57 @@ fn test_markup_export_auto_s() {
BenchmarkResult {
command: String::from("sleep 2"),
command_with_unused_parameters: String::from("sleep 2"),
mean: 2.0050,
stddev: Some(0.0020),
median: 2.0050,
user: 0.0009,
system: 0.0012,
min: 2.0020,
max: 2.0080,
times: Some(vec![2.0, 2.0, 2.0]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(2.1),
time_user: Time::new::<second>(2.1),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.2),
time_user: Time::new::<second>(2.2),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.3),
time_user: Time::new::<second>(2.3),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
BenchmarkResult {
command: String::from("sleep 0.1"),
command_with_unused_parameters: String::from("sleep 0.1"),
mean: 0.1057,
stddev: Some(0.0016),
median: 0.1057,
user: 0.0009,
system: 0.0011,
min: 0.1023,
max: 0.1080,
times: Some(vec![0.1, 0.1, 0.1]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(0.1),
time_user: Time::new::<second>(0.1),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.2),
time_user: Time::new::<second>(0.2),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.3),
time_user: Time::new::<second>(0.3),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
];
@@ -134,8 +188,8 @@ fn test_markup_export_auto_s() {
insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, None, SortOrder::Command), @r#"
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 ± 0.29 |
| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 |
| `sleep 2` | 2.200 ± 0.100 | 2.100 | 2.300 | 11.00 ± 5.52 |
| `sleep 0.1` | 0.200 ± 0.100 | 0.100 | 0.300 | 1.00 |
"#);
insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None, SortOrder::Command), @r#"
@@ -148,15 +202,15 @@ fn test_markup_export_auto_s() {
| Relative
| `sleep 2`
| 2.005 ± 0.002
| 2.002
| 2.008
| 18.97 ± 0.29
| 2.200 ± 0.100
| 2.100
| 2.300
| 11.00 ± 5.52
| `sleep 0.1`
| 0.106 ± 0.002
| 0.102
| 0.108
| 0.200 ± 0.100
| 0.100
| 0.300
| 1.00
|===
"#);
@@ -164,8 +218,8 @@ fn test_markup_export_auto_s() {
insta::assert_snapshot!(get_output::<OrgmodeExporter>(&results, None, SortOrder::Command), @r#"
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|--+--+--+--+--|
| =sleep 2= | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 ± 0.29 |
| =sleep 0.1= | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 |
| =sleep 2= | 2.200 ± 0.100 | 2.100 | 2.300 | 11.00 ± 5.52 |
| =sleep 0.1= | 0.200 ± 0.100 | 0.100 | 0.300 | 1.00 |
"#);
}
@@ -177,31 +231,57 @@ fn test_markup_export_manual_ms() {
BenchmarkResult {
command: String::from("sleep 2"),
command_with_unused_parameters: String::from("sleep 2"),
mean: 2.0050,
stddev: Some(0.0020),
median: 2.0050,
user: 0.0009,
system: 0.0012,
min: 2.0020,
max: 2.0080,
times: Some(vec![2.0, 2.0, 2.0]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(2.1),
time_user: Time::new::<second>(2.1),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.2),
time_user: Time::new::<second>(2.2),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.3),
time_user: Time::new::<second>(2.3),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
BenchmarkResult {
command: String::from("sleep 0.1"),
command_with_unused_parameters: String::from("sleep 0.1"),
mean: 0.1057,
stddev: Some(0.0016),
median: 0.1057,
user: 0.0009,
system: 0.0011,
min: 0.1023,
max: 0.1080,
times: Some(vec![0.1, 0.1, 0.1]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(0.1),
time_user: Time::new::<second>(0.1),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.2),
time_user: Time::new::<second>(0.2),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.3),
time_user: Time::new::<second>(0.3),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
];
@@ -209,8 +289,8 @@ fn test_markup_export_manual_ms() {
insta::assert_snapshot!(get_output::<MarkdownExporter>(&timing_results, Some(TimeUnit::MilliSecond), SortOrder::Command), @r#"
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 2` | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 ± 0.29 |
| `sleep 0.1` | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 |
| `sleep 2` | 2200.0 ± 100.0 | 2100.0 | 2300.0 | 11.00 ± 5.52 |
| `sleep 0.1` | 200.0 ± 100.0 | 100.0 | 300.0 | 1.00 |
"#);
insta::assert_snapshot!(get_output::<AsciidocExporter>(&timing_results, Some(TimeUnit::MilliSecond), SortOrder::Command), @r#"
@@ -223,15 +303,15 @@ fn test_markup_export_manual_ms() {
| Relative
| `sleep 2`
| 2005.0 ± 2.0
| 2002.0
| 2008.0
| 18.97 ± 0.29
| 2200.0 ± 100.0
| 2100.0
| 2300.0
| 11.00 ± 5.52
| `sleep 0.1`
| 105.7 ± 1.6
| 102.3
| 108.0
| 200.0 ± 100.0
| 100.0
| 300.0
| 1.00
|===
"#);
@@ -239,8 +319,8 @@ fn test_markup_export_manual_ms() {
insta::assert_snapshot!(get_output::<OrgmodeExporter>(&timing_results, Some(TimeUnit::MilliSecond), SortOrder::Command), @r#"
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|--+--+--+--+--|
| =sleep 2= | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 ± 0.29 |
| =sleep 0.1= | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 |
| =sleep 2= | 2200.0 ± 100.0 | 2100.0 | 2300.0 | 11.00 ± 5.52 |
| =sleep 0.1= | 200.0 ± 100.0 | 100.0 | 300.0 | 1.00 |
"#);
}
@@ -251,48 +331,74 @@ fn test_markup_export_manual_s() {
BenchmarkResult {
command: String::from("sleep 2"),
command_with_unused_parameters: String::from("sleep 2"),
mean: 2.0050,
stddev: Some(0.0020),
median: 2.0050,
user: 0.0009,
system: 0.0012,
min: 2.0020,
max: 2.0080,
times: Some(vec![2.0, 2.0, 2.0]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(2.01),
time_user: Time::new::<second>(2.01),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.02),
time_user: Time::new::<second>(2.02),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.03),
time_user: Time::new::<second>(2.03),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
BenchmarkResult {
command: String::from("sleep 0.1"),
command_with_unused_parameters: String::from("sleep 0.1"),
mean: 0.1057,
stddev: Some(0.0016),
median: 0.1057,
user: 0.0009,
system: 0.0011,
min: 0.1023,
max: 0.1080,
times: Some(vec![0.1, 0.1, 0.1]),
memory_usage_byte: None,
exit_codes: vec![Some(0), Some(0), Some(0)],
measurements: Measurements::new(vec![
Measurement {
time_wall_clock: Time::new::<second>(0.11),
time_user: Time::new::<second>(0.11),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.12),
time_user: Time::new::<second>(0.12),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.13),
time_user: Time::new::<second>(0.13),
time_system: Time::zero(),
peak_memory_usage: Information::new::<byte>(1024.),
exit_status: ExitStatus::default(),
},
]),
parameters: BTreeMap::new(),
},
];
insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(TimeUnit::Second), SortOrder::Command), @r#"
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 ± 0.29 |
| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 |
"#);
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 2` | 2.020 ± 0.010 | 2.010 | 2.030 | 16.83 ± 1.41 |
| `sleep 0.1` | 0.120 ± 0.010 | 0.110 | 0.130 | 1.00 |
"#);
insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(TimeUnit::Second), SortOrder::MeanTime), @r#"
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 |
| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 ± 0.29 |
"#);
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `sleep 0.1` | 0.120 ± 0.010 | 0.110 | 0.130 | 1.00 |
| `sleep 2` | 2.020 ± 0.010 | 2.010 | 2.030 | 16.83 ± 1.41 |
"#);
insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, Some(TimeUnit::Second), SortOrder::Command), @r#"
[cols="<,>,>,>,>"]
@@ -304,15 +410,15 @@ fn test_markup_export_manual_s() {
| Relative
| `sleep 2`
| 2.005 ± 0.002
| 2.002
| 2.008
| 18.97 ± 0.29
| 2.020 ± 0.010
| 2.010
| 2.030
| 16.83 ± 1.41
| `sleep 0.1`
| 0.106 ± 0.002
| 0.102
| 0.108
| 0.120 ± 0.010
| 0.110
| 0.130
| 1.00
|===
"#);