Skip to content
Myr

Introduce new BenchmarkRun struct

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by David Peter · parent 46e1f9f · Browse files · 7 files+247 added−264 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+247 added−264 removed

  • other:+247 added−264 removed

7 files+247 added−264 removed

modified:src/benchmark/benchmark_result.rs+67 added-4 removed
1use std::collections::BTreeMap;23use serde::ser::SerializeStruct;4use serde::{Serialize, Serializer};3use serde::Serialize;4use statistical::{mean, median, standard_deviation};56use crate::util::{7 min_max::{max, min},8 units::Second,9};1011#[derive(Debug, Default, Clone, Serialize, PartialEq)]12pub struct BenchmarkRun {13 pub wall_clock_time: Second,14 // user_time: Second,15 // system_time: Second,16}1718use crate::benchmark::measurement::Measurements;19use crate::quantity::{byte, second, Time};20use crate::util::exit_code::extract_exit_code;21
14 unmodified lines
3637 /// The full command line, including parameters not used in the command template.38 pub command_with_unused_parameters: String,3928 /// Performance measurements and exit statuses for each run29 pub measurements: Measurements,40 /// Time spent in user mode41 pub user: f64,4243 /// Time spent in kernel mode44 pub system: f64,4546 /// All run time measurements47 pub runs: Vec<BenchmarkRun>,4849 /// Maximum memory usage of the process, in bytes50 #[serde(skip_serializing_if = "Option::is_none")]51 pub memory_usage_byte: Option<Vec<u64>>,5253 /// Exit codes of all command invocations54 pub exit_codes: Vec<Option<i32>>,5556 /// Parameter values for this benchmark57 pub parameters: BTreeMap<String, Parameter>,58}59
59 unmodified lines
119 }120 state.end()121 }122}123124impl BenchmarkResult {125 fn wall_clock_times(&self) -> Vec<Second> {126 self.runs.iter().map(|run| run.wall_clock_time).collect()127 }128129 /// The average run time130 pub fn mean(&self) -> Second {131 mean(&self.wall_clock_times())132 }133134 /// The standard deviation of all run times. Not available if only one run has been performed135 pub fn stddev(&self) -> Option<Second> {136 let times = self.wall_clock_times();137138 let t_mean = mean(&times);139 if times.len() > 1 {140 Some(standard_deviation(&times, Some(t_mean)))141 } else {142 None143 }144 }145146 /// The median run time147 pub fn median(&self) -> Second {148 median(&self.wall_clock_times())149 }150151 /// The minimum run time152 pub fn min(&self) -> Second {153 min(&self.wall_clock_times())154 }155156 /// The maximum run time157 pub fn max(&self) -> Second {158 max(&self.wall_clock_times())159 }160}
modified:src/benchmark/mod.rs+21 added-6 removed
6 unmodified lines
7use std::cmp;8use std::io::{self, Write};9use std::time::Instant;1011use crate::benchmark::benchmark_result::BenchmarkRun;12use crate::benchmark::executor::BenchmarkIteration;13use crate::command::Command;14use crate::options::{15 CmdFailureAction, CommandOutputPolicy, ExecutorKind, Options, OutputStyleOption,
10 unmodified lines
26use measurement::{Measurement, Measurements};2728use anyhow::{anyhow, Result};29use colored::*;30use statistical::{mean, standard_deviation};3132use self::executor::Executor;3334/// Threshold for warning about fast execution time
335 unmodified lines
370 bar.finish_and_clear()371 }372373 // Compute statistical quantities372 let t_num = measurements.len();373 let t_mean = measurements.time_wall_clock_mean();374 let t_stddev = measurements.stddev();375 let t_min = measurements.min();376 let t_max = measurements.max();374 let t_num = times_real.len();375 let t_mean = mean(&times_real);376 let t_stddev = if times_real.len() > 1 {377 Some(standard_deviation(&times_real, Some(t_mean)))378 } else {379 None380 };381 let t_min = min(&times_real);382 let t_max = max(&times_real);383384 let user_mean = measurements.time_user_mean();385 let system_mean = measurements.time_system_mean();386
102 unmodified lines
489490 Ok(BenchmarkResult {491 command: self.command.get_name(),492 command_with_unused_parameters: self.command.get_name_with_unused_parameters(),487 measurements,493 user: user_mean,494 system: system_mean,495 runs: times_real496 .iter()497 .map(|t| BenchmarkRun {498 wall_clock_time: *t,499 })500 .collect(),501 memory_usage_byte: Some(memory_usage_byte),502 exit_codes,503 parameters: self504 .command505 .get_parameters()506 .iter()
13 unmodified lines
modified:src/benchmark/relative_speed.rs+14 added-21 removed
29 unmodified lines
30 }31}3233pub fn compare_mean_time(l: &BenchmarkResult, r: &BenchmarkResult) -> Ordering {34 l.mean_wall_clock_time()35 .partial_cmp(&r.mean_wall_clock_time())36 .unwrap_or(Ordering::Equal)34 l.mean().partial_cmp(&r.mean()).unwrap_or(Ordering::Equal)35}3637pub fn fastest_of(results: &[BenchmarkResult]) -> &BenchmarkResult {38 results
26 unmodified lines
65 };66 }6768 let ratio = match relative_ordering {71 Ordering::Less => reference.mean_wall_clock_time() / result.mean_wall_clock_time(),72 Ordering::Equal => Ratio::new::<quantity::ratio>(1.0),73 Ordering::Greater => {74 result.mean_wall_clock_time() / reference.mean_wall_clock_time()75 }69 Ordering::Less => reference.mean() / result.mean(),70 Ordering::Equal => 1.0,71 Ordering::Greater => result.mean() / reference.mean(),72 };7374 // https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas75 // Covariance assumed to be 0, i.e. variables are assumed to be independent
36 unmodified lines
112 results: &'a [BenchmarkResult],113 reference: &'a BenchmarkResult,114 sort_order: SortOrder,115) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'a>>> {120 if fastest_of(results).mean_wall_clock_time() == Time::zero()121 || reference.mean_wall_clock_time() == Time::zero()122 {116 if fastest_of(results).mean() == 0.0 || reference.mean() == 0.0 {117 return None;118 }119120 Some(compute_relative_speeds(results, reference, sort_order))
4 unmodified lines
125 sort_order: SortOrder,126) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'_>>> {127 let fastest = fastest_of(results);128135 if fastest.mean_wall_clock_time() == Time::zero() {129 if fastest.mean() == 0.0 {130 return None;131 }132133 Some(compute_relative_speeds(results, fastest, sort_order))
12 unmodified lines
146#[cfg(test)]147fn create_result(name: &str, mean: f64) -> BenchmarkResult {148 use std::collections::BTreeMap;149156 use crate::benchmark::measurement::{Measurement, Measurements};157 use crate::quantity::{second, Time};150 use crate::benchmark::benchmark_result::BenchmarkRun;151152 BenchmarkResult {153 command: name.into(),154 command_with_unused_parameters: name.into(),162 measurements: Measurements {163 measurements: vec![Measurement {164 time_wall_clock: Time::new::<second>(mean),165 time_user: Time::new::<second>(mean),166 ..Default::default()167 }],168 },155 user: mean,156 system: 0.0,157 runs: vec![BenchmarkRun {158 wall_clock_time: mean,159 }],160 memory_usage_byte: None,161 exit_codes: Vec::new(),162 parameters: BTreeMap::new(),163 }164}165
64 unmodified lines
modified:src/benchmark/scheduler.rs+6 added-16 removed
203 unmodified lines
204#[test]205fn scheduler_basic() -> Result<()> {206 insta::assert_yaml_snapshot!(generate_results(&["--runs=2", "sleep 0.123", "sleep 0.456"])?, @r#"207 - command: sleep 0.123208 mean: 0.123209 stddev: 0210 median: 0.123208 user: 0209 system: 0213 min: 0.123214 max: 0.123215 times:216 - 0.123217 - 0.123210 runs:211 - wall_clock_time: 0.123212 - wall_clock_time: 0.123213 memory_usage_byte:214 - 0215 - 0216 exit_codes:217 - 0218 - 0219 - command: sleep 0.456225 mean: 0.456226 stddev: 0227 median: 0.456220 user: 0221 system: 0230 min: 0.456231 max: 0.456232 times:233 - 0.456234 - 0.456222 runs:223 - wall_clock_time: 0.456224 - wall_clock_time: 0.456225 memory_usage_byte:226 - 0227 - 0228 exit_codes:
6 unmodified lines
modified:src/export/csv.rs+36 added-49 removed
42 unmodified lines
4344 for res in results {45 let mut fields = vec![Cow::Borrowed(res.command.as_bytes())];46 for f in &[47 res.mean_wall_clock_time(),48 res.measurements.stddev().unwrap_or_default(),49 res.measurements.median(),50 res.measurements.time_user_mean(),51 res.measurements.time_system_mean(),52 res.measurements.min(),53 res.measurements.max(),47 res.mean(),48 res.stddev().unwrap_or(0.0),49 res.median(),50 res.user,51 res.system,52 res.min(),53 res.max(),54 ] {55 fields.push(Cow::Owned(56 f.format_with_precision(CSV_UNIT, CSV_PRECISION)57 .into_bytes(),
8 unmodified lines
66 Ok(writer.into_inner()?)67 }68}6970#[cfg(test)]71use crate::benchmark::benchmark_result::BenchmarkRun;7273#[test]74fn test_csv() {75 use crate::benchmark::benchmark_result::Parameter;76 use crate::benchmark::measurement::{Measurement, Measurements};
7 unmodified lines
84 let results = vec![85 BenchmarkResult {86 command: String::from("command_a"),87 command_with_unused_parameters: String::from("command_a"),85 measurements: Measurements::new(vec![86 Measurement {87 time_wall_clock: Time::new::<second>(7.0),88 time_user: Time::new::<second>(7.0),89 time_system: Time::zero(),90 peak_memory_usage: Information::new::<byte>(1024.),91 exit_status: ExitStatus::default(),88 user: 3.0,89 system: 4.0,90 runs: vec![91 BenchmarkRun {92 wall_clock_time: 7.0,93 },93 Measurement {94 time_wall_clock: Time::new::<second>(8.0),95 time_user: Time::new::<second>(8.0),96 time_system: Time::zero(),97 peak_memory_usage: Information::new::<byte>(1024.),98 exit_status: ExitStatus::default(),94 BenchmarkRun {95 wall_clock_time: 8.0,96 },100 Measurement {101 time_wall_clock: Time::new::<second>(12.0),102 time_user: Time::new::<second>(12.0),103 time_system: Time::zero(),104 peak_memory_usage: Information::new::<byte>(1024.),105 exit_status: ExitStatus::default(),97 BenchmarkRun {98 wall_clock_time: 12.0,99 },107 ]),100 ],101 memory_usage_byte: None,102 exit_codes: vec![Some(0), Some(0), Some(0)],103 parameters: {104 let mut params = BTreeMap::new();105 params.insert(106 "foo".into(),
14 unmodified lines
121 },122 BenchmarkResult {123 command: String::from("command_b"),124 command_with_unused_parameters: String::from("command_b"),130 measurements: Measurements::new(vec![131 Measurement {132 time_wall_clock: Time::new::<second>(17.0),133 time_user: Time::new::<second>(17.0),134 time_system: Time::zero(),135 peak_memory_usage: Information::new::<byte>(1024.),136 exit_status: ExitStatus::default(),125 user: 13.0,126 system: 14.0,127 runs: vec![128 BenchmarkRun {129 wall_clock_time: 17.0,130 },138 Measurement {139 time_wall_clock: Time::new::<second>(18.0),140 time_user: Time::new::<second>(18.0),141 time_system: Time::zero(),142 peak_memory_usage: Information::new::<byte>(1024.),143 exit_status: ExitStatus::default(),131 BenchmarkRun {132 wall_clock_time: 18.0,133 },145 Measurement {146 time_wall_clock: Time::new::<second>(19.0),147 time_user: Time::new::<second>(19.0),148 time_system: Time::zero(),149 peak_memory_usage: Information::new::<byte>(1024.),150 exit_status: ExitStatus::default(),134 BenchmarkRun {135 wall_clock_time: 19.0,136 },152 ]),137 ],138 memory_usage_byte: None,139 exit_codes: vec![Some(0), Some(0), Some(0)],140 parameters: {141 let mut params = BTreeMap::new();142 params.insert(143 "foo".into(),
22 unmodified lines
166 .unwrap();167168 insta::assert_snapshot!(actual, @r#"169 command,mean,stddev,median,user,system,min,max,parameter_bar,parameter_foo183 command_a,9.000000,2.645751,8.000000,9.000000,0.000000,7.000000,12.000000,two,one184 command_b,18.000000,1.000000,18.000000,18.000000,0.000000,17.000000,19.000000,seven,one170 command_a,9,2.6457513110645907,8,3,4,7,12,two,one171 command_b,18,1,18,13,14,17,19,seven,one172 "#);173}
modified:src/export/markup.rs+4 added-4 removed
51 unmodified lines
52 // prepare data row strings53 let cmd_str = measurement54 .command_with_unused_parameters55 .replace('|', "\\|");56 let mean_str = measurement.mean_wall_clock_time().format_value(unit);57 let stddev_str = if let Some(stddev) = measurement.measurements.stddev() {58 format!(" ± {}", stddev.format_value(unit))56 let mean_str = format_duration_value(measurement.mean(), Some(unit)).0;57 let stddev_str = if let Some(stddev) = measurement.stddev() {58 format!(" ± {}", format_duration_value(stddev, Some(unit)).0)59 } else {60 "".into()61 };62 let min_str = measurement.measurements.min().format_value(unit);
52 unmodified lines
115116fn determine_unit_from_results(results: &[BenchmarkResult]) -> TimeUnit {117 if let Some(first_result) = results.first() {118 // Use the first BenchmarkResult entry to determine the unit for all entries.119 first_result.mean_wall_clock_time().suitable_unit()119 format_duration_value(first_result.mean(), None).1120 } else {121 // Default to `Second`.122 TimeUnit::Second123 }
25 unmodified lines
modified:src/export/tests.rs+99 added-164 removed
1use super::Exporter;2use crate::benchmark::benchmark_result::BenchmarkResult;3use crate::benchmark::measurement::{Measurement, Measurements};2use crate::benchmark::benchmark_result::{BenchmarkResult, BenchmarkRun};3use crate::export::asciidoc::AsciidocExporter;4use crate::export::orgmode::OrgmodeExporter;5use crate::quantity::{byte, second, Information, Time, TimeUnit, Zero};6use crate::{export::markdown::MarkdownExporter, options::SortOrder};
20 unmodified lines
27 let results = [28 BenchmarkResult {29 command: String::from("sleep 0.1"),30 command_with_unused_parameters: String::from("sleep 0.1"),32 measurements: Measurements::new(vec![33 Measurement {34 time_wall_clock: Time::new::<second>(0.09),35 time_user: Time::new::<second>(0.09),36 time_system: Time::zero(),37 peak_memory_usage: Information::new::<byte>(1024.),38 exit_status: ExitStatus::default(),31 user: 0.0009,32 system: 0.0011,33 runs: vec![34 BenchmarkRun {35 wall_clock_time: 0.09,36 },40 Measurement {41 time_wall_clock: Time::new::<second>(0.10),42 time_user: Time::new::<second>(0.10),43 time_system: Time::zero(),44 peak_memory_usage: Information::new::<byte>(1024.),45 exit_status: ExitStatus::default(),37 BenchmarkRun {38 wall_clock_time: 0.10,39 },47 Measurement {48 time_wall_clock: Time::new::<second>(0.14),49 time_user: Time::new::<second>(0.14),50 time_system: Time::zero(),51 peak_memory_usage: Information::new::<byte>(1024.),52 exit_status: ExitStatus::default(),40 BenchmarkRun {41 wall_clock_time: 0.14,42 },54 ]),43 ],44 memory_usage_byte: None,45 exit_codes: vec![Some(0), Some(0), Some(0)],46 parameters: BTreeMap::new(),47 },48 BenchmarkResult {49 command: String::from("sleep 2"),50 command_with_unused_parameters: String::from("sleep 2"),60 measurements: Measurements::new(vec![61 Measurement {62 time_wall_clock: Time::new::<second>(2.0),63 time_user: Time::new::<second>(2.0),64 time_system: Time::zero(),65 peak_memory_usage: Information::new::<byte>(1024.),66 exit_status: ExitStatus::default(),51 user: 0.0009,52 system: 0.0012,53 runs: vec![54 BenchmarkRun {55 wall_clock_time: 2.0,56 },68 Measurement {69 time_wall_clock: Time::new::<second>(3.0),70 time_user: Time::new::<second>(3.0),71 time_system: Time::zero(),72 peak_memory_usage: Information::new::<byte>(1024.),73 exit_status: ExitStatus::default(),57 BenchmarkRun {58 wall_clock_time: 3.0,59 },75 Measurement {76 time_wall_clock: Time::new::<second>(4.0),77 time_user: Time::new::<second>(4.0),78 time_system: Time::zero(),79 peak_memory_usage: Information::new::<byte>(1024.),80 exit_status: ExitStatus::default(),60 BenchmarkRun {61 wall_clock_time: 4.0,62 },82 ]),63 ],64 memory_usage_byte: None,65 exit_codes: vec![Some(0), Some(0), Some(0)],66 parameters: BTreeMap::new(),67 },68 ];69
42 unmodified lines
112 let results = [113 BenchmarkResult {114 command: String::from("sleep 2"),115 command_with_unused_parameters: String::from("sleep 2"),133 measurements: Measurements::new(vec![134 Measurement {135 time_wall_clock: Time::new::<second>(2.1),136 time_user: Time::new::<second>(2.1),137 time_system: Time::zero(),138 peak_memory_usage: Information::new::<byte>(1024.),139 exit_status: ExitStatus::default(),116 user: 0.0009,117 system: 0.0012,118 runs: vec![119 BenchmarkRun {120 wall_clock_time: 2.1,121 },141 Measurement {142 time_wall_clock: Time::new::<second>(2.2),143 time_user: Time::new::<second>(2.2),144 time_system: Time::zero(),145 peak_memory_usage: Information::new::<byte>(1024.),146 exit_status: ExitStatus::default(),122 BenchmarkRun {123 wall_clock_time: 2.2,124 },148 Measurement {149 time_wall_clock: Time::new::<second>(2.3),150 time_user: Time::new::<second>(2.3),151 time_system: Time::zero(),152 peak_memory_usage: Information::new::<byte>(1024.),153 exit_status: ExitStatus::default(),125 BenchmarkRun {126 wall_clock_time: 2.3,127 },155 ]),128 ],129 memory_usage_byte: None,130 exit_codes: vec![Some(0), Some(0), Some(0)],131 parameters: BTreeMap::new(),132 },133 BenchmarkResult {134 command: String::from("sleep 0.1"),135 command_with_unused_parameters: String::from("sleep 0.1"),161 measurements: Measurements::new(vec![162 Measurement {163 time_wall_clock: Time::new::<second>(0.1),164 time_user: Time::new::<second>(0.1),165 time_system: Time::zero(),166 peak_memory_usage: Information::new::<byte>(1024.),167 exit_status: ExitStatus::default(),136 user: 0.0009,137 system: 0.0011,138 runs: vec![139 BenchmarkRun {140 wall_clock_time: 0.1,141 },169 Measurement {170 time_wall_clock: Time::new::<second>(0.2),171 time_user: Time::new::<second>(0.2),172 time_system: Time::zero(),173 peak_memory_usage: Information::new::<byte>(1024.),174 exit_status: ExitStatus::default(),142 BenchmarkRun {143 wall_clock_time: 0.2,144 },176 Measurement {177 time_wall_clock: Time::new::<second>(0.3),178 time_user: Time::new::<second>(0.3),179 time_system: Time::zero(),180 peak_memory_usage: Information::new::<byte>(1024.),181 exit_status: ExitStatus::default(),145 BenchmarkRun {146 wall_clock_time: 0.3,147 },183 ]),148 ],149 memory_usage_byte: None,150 exit_codes: vec![Some(0), Some(0), Some(0)],151 parameters: BTreeMap::new(),152 },153 ];154
42 unmodified lines
197 let timing_results = [198 BenchmarkResult {199 command: String::from("sleep 2"),200 command_with_unused_parameters: String::from("sleep 2"),234 measurements: Measurements::new(vec![235 Measurement {236 time_wall_clock: Time::new::<second>(2.1),237 time_user: Time::new::<second>(2.1),238 time_system: Time::zero(),239 peak_memory_usage: Information::new::<byte>(1024.),240 exit_status: ExitStatus::default(),201 user: 0.0009,202 system: 0.0012,203 runs: vec![204 BenchmarkRun {205 wall_clock_time: 2.1,206 },242 Measurement {243 time_wall_clock: Time::new::<second>(2.2),244 time_user: Time::new::<second>(2.2),245 time_system: Time::zero(),246 peak_memory_usage: Information::new::<byte>(1024.),247 exit_status: ExitStatus::default(),207 BenchmarkRun {208 wall_clock_time: 2.2,209 },249 Measurement {250 time_wall_clock: Time::new::<second>(2.3),251 time_user: Time::new::<second>(2.3),252 time_system: Time::zero(),253 peak_memory_usage: Information::new::<byte>(1024.),254 exit_status: ExitStatus::default(),210 BenchmarkRun {211 wall_clock_time: 2.3,212 },256 ]),213 ],214 memory_usage_byte: None,215 exit_codes: vec![Some(0), Some(0), Some(0)],216 parameters: BTreeMap::new(),217 },218 BenchmarkResult {219 command: String::from("sleep 0.1"),220 command_with_unused_parameters: String::from("sleep 0.1"),262 measurements: Measurements::new(vec![263 Measurement {264 time_wall_clock: Time::new::<second>(0.1),265 time_user: Time::new::<second>(0.1),266 time_system: Time::zero(),267 peak_memory_usage: Information::new::<byte>(1024.),268 exit_status: ExitStatus::default(),221 user: 0.0009,222 system: 0.0011,223 runs: vec![224 BenchmarkRun {225 wall_clock_time: 0.1,226 },270 Measurement {271 time_wall_clock: Time::new::<second>(0.2),272 time_user: Time::new::<second>(0.2),273 time_system: Time::zero(),274 peak_memory_usage: Information::new::<byte>(1024.),275 exit_status: ExitStatus::default(),227 BenchmarkRun {228 wall_clock_time: 0.2,229 },277 Measurement {278 time_wall_clock: Time::new::<second>(0.3),279 time_user: Time::new::<second>(0.3),280 time_system: Time::zero(),281 peak_memory_usage: Information::new::<byte>(1024.),282 exit_status: ExitStatus::default(),230 BenchmarkRun {231 wall_clock_time: 0.3,232 },284 ]),233 ],234 memory_usage_byte: None,235 exit_codes: vec![Some(0), Some(0), Some(0)],236 parameters: BTreeMap::new(),237 },238 ];239
41 unmodified lines
281 let results = [282 BenchmarkResult {283 command: String::from("sleep 2"),284 command_with_unused_parameters: String::from("sleep 2"),334 measurements: Measurements::new(vec![335 Measurement {336 time_wall_clock: Time::new::<second>(2.01),337 time_user: Time::new::<second>(2.01),338 time_system: Time::zero(),339 peak_memory_usage: Information::new::<byte>(1024.),340 exit_status: ExitStatus::default(),285 user: 0.0009,286 system: 0.0012,287 runs: vec![288 BenchmarkRun {289 wall_clock_time: 2.01,290 },342 Measurement {343 time_wall_clock: Time::new::<second>(2.02),344 time_user: Time::new::<second>(2.02),345 time_system: Time::zero(),346 peak_memory_usage: Information::new::<byte>(1024.),347 exit_status: ExitStatus::default(),291 BenchmarkRun {292 wall_clock_time: 2.02,293 },349 Measurement {350 time_wall_clock: Time::new::<second>(2.03),351 time_user: Time::new::<second>(2.03),352 time_system: Time::zero(),353 peak_memory_usage: Information::new::<byte>(1024.),354 exit_status: ExitStatus::default(),294 BenchmarkRun {295 wall_clock_time: 2.03,296 },356 ]),297 ],298 memory_usage_byte: None,299 exit_codes: vec![Some(0), Some(0), Some(0)],300 parameters: BTreeMap::new(),301 },302 BenchmarkResult {303 command: String::from("sleep 0.1"),304 command_with_unused_parameters: String::from("sleep 0.1"),362 measurements: Measurements::new(vec![363 Measurement {364 time_wall_clock: Time::new::<second>(0.11),365 time_user: Time::new::<second>(0.11),366 time_system: Time::zero(),367 peak_memory_usage: Information::new::<byte>(1024.),368 exit_status: ExitStatus::default(),305 user: 0.0009,306 system: 0.0011,307 runs: vec![308 BenchmarkRun {309 wall_clock_time: 0.11,310 },370 Measurement {371 time_wall_clock: Time::new::<second>(0.12),372 time_user: Time::new::<second>(0.12),373 time_system: Time::zero(),374 peak_memory_usage: Information::new::<byte>(1024.),375 exit_status: ExitStatus::default(),311 BenchmarkRun {312 wall_clock_time: 0.12,313 },377 Measurement {378 time_wall_clock: Time::new::<second>(0.13),379 time_user: Time::new::<second>(0.13),380 time_system: Time::zero(),381 peak_memory_usage: Information::new::<byte>(1024.),382 exit_status: ExitStatus::default(),314 BenchmarkRun {315 wall_clock_time: 0.13,316 },384 ]),317 ],318 memory_usage_byte: None,319 exit_codes: vec![Some(0), Some(0), Some(0)],320 parameters: BTreeMap::new(),321 },322 ];323389 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(TimeUnit::Second), SortOrder::Command), @r#"324 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(Unit::Second), SortOrder::Command), @r#"325 | Command | Mean [s] | Min [s] | Max [s] | Relative |326 |:---|---:|---:|---:|---:|327 | `sleep 2` | 2.020 ± 0.010 | 2.010 | 2.030 | 16.83 ± 1.41 |328 | `sleep 0.1` | 0.120 ± 0.010 | 0.110 | 0.130 | 1.00 |329 "#);330396 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(TimeUnit::Second), SortOrder::MeanTime), @r#"331 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(Unit::Second), SortOrder::MeanTime), @r#"332 | Command | Mean [s] | Min [s] | Max [s] | Relative |333 |:---|---:|---:|---:|---:|334 | `sleep 0.1` | 0.120 ± 0.010 | 0.110 | 0.130 | 1.00 |335 | `sleep 2` | 2.020 ± 0.010 | 2.010 | 2.030 | 16.83 ± 1.41 |
25 unmodified lines