tests.rs
This file
Path
src/export/tests.rs
478 lines · 18.5 KiB · Rust
Last changed by
Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
History of this fileTake it
Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 1–2why, one step back1use super::Exporter;2use crate::benchmark::benchmark_result::BenchmarkResult;Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
line 3why, one step back3use crate::benchmark::measurement::{Measurement, Measurements};Move more tests to instaDavid Peterbefore adoptionda399ab
line 4why, one step back4use crate::export::asciidoc::AsciidocExporter;Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 5why, one step back5use crate::export::markdown::MarkdownExporter;Move more tests to instaDavid Peterbefore adoptionda399ab
line 6why, one step back6use crate::export::orgmode::OrgmodeExporter;Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 7–8why, one step back7use crate::metric::{MetricSelection, Unit};8use crate::quantity::{byte, second, Information, Time, Zero};Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 9why, one step back9use std::collections::BTreeMap;Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
line 10why, one step back10use std::process::ExitStatus;Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 11why, one step back11Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 12why, one step back12fn get_output<E: Exporter + Default>(results: &[BenchmarkResult], unit: Option<Unit>) -> String {Move more tests to instaDavid Peterbefore adoptionda399ab
line 13why, one step back13 let exporter = E::default();Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 14–17why, one step back14 String::from_utf8(15 exporter16 .serialize(17 results,Export selected metrics side by side in CSVDavid Peterbefore adoption067ee70
line 18why, one step back18 &[MetricSelection {Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 19–20why, one step back19 unit,20 ..MetricSelection::default()Export selected metrics side by side in CSVDavid Peterbefore adoption067ee70
line 21why, one step back21 }],Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 22–25why, one step back22 )23 .unwrap(),24 )25 .unwrap()Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 26–27why, one step back26}27Move more tests to instaDavid Peterbefore adoptionda399ab
line 28why, one step back28/// Ensure the makrup output includes the table header and the multipleUse insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 29–32why, one step back29/// benchmark results as a table. The list of actual times is not included30/// in the output.31///32/// This also demonstrates that the first entry's units (ms) are used to setMove more tests to instaDavid Peterbefore adoptionda399ab
line 33why, one step back33/// the units for all entries when the time unit is not specified.Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 34why, one step back34#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
line 35why, one step back35fn test_markup_export_auto_ms() {Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 36–37why, one step back36 let results = [37 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 38why, one step back38 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 39why, one step back39 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 40–41why, one step back40 name: None,41 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 42–44why, one step back42 measurements: Measurements::new(vec![43 Measurement {44 time_wall_clock: Time::new::<second>(0.09),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 45why, one step back45 time_cpu: Time::new::<second>(0.09),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 46–47why, one step back46 time_user: Time::new::<second>(0.09),47 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 48why, one step back48 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 49why, one step back49 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 50–53why, one step back50 exit_status: ExitStatus::default(),51 },52 Measurement {53 time_wall_clock: Time::new::<second>(0.10),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 54why, one step back54 time_cpu: Time::new::<second>(0.10),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 55–56why, one step back55 time_user: Time::new::<second>(0.10),56 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 57why, one step back57 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 58why, one step back58 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 59–62why, one step back59 exit_status: ExitStatus::default(),60 },61 Measurement {62 time_wall_clock: Time::new::<second>(0.14),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 63why, one step back63 time_cpu: Time::new::<second>(0.14),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 64–65why, one step back64 time_user: Time::new::<second>(0.14),65 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 66why, one step back66 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 67why, one step back67 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 68–70why, one step back68 exit_status: ExitStatus::default(),69 },70 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 71–73why, one step back71 parameters: BTreeMap::new(),72 },73 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 74why, one step back74 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 75why, one step back75 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 76–77why, one step back76 name: None,77 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 78–80why, one step back78 measurements: Measurements::new(vec![79 Measurement {80 time_wall_clock: Time::new::<second>(2.0),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 81why, one step back81 time_cpu: Time::new::<second>(2.0),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 82–83why, one step back82 time_user: Time::new::<second>(2.0),83 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 84why, one step back84 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 85why, one step back85 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 86–89why, one step back86 exit_status: ExitStatus::default(),87 },88 Measurement {89 time_wall_clock: Time::new::<second>(3.0),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 90why, one step back90 time_cpu: Time::new::<second>(3.0),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 91–92why, one step back91 time_user: Time::new::<second>(3.0),92 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 93why, one step back93 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 94why, one step back94 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 95–98why, one step back95 exit_status: ExitStatus::default(),96 },97 Measurement {98 time_wall_clock: Time::new::<second>(4.0),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 99why, one step back99 time_cpu: Time::new::<second>(4.0),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 100–101why, one step back100 time_user: Time::new::<second>(4.0),101 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 102why, one step back102 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 103why, one step back103 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 104–106why, one step back104 exit_status: ExitStatus::default(),105 },106 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 107–110why, one step back107 parameters: BTreeMap::new(),108 },109 ];110Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 111–116why, one step back111 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, None), @"112 | Command | Mean Wall Time [ms] | Change | Factor |113 |:---|---:|---:|:---|114 | `sleep 0.1` | 110.0 ± 26.5 | | |115 | `sleep 2` | 3000.0 ± 1000.0 | +2627.3% | (27.3x slower) |116 ");Move more tests to instaDavid Peterbefore adoptionda399ab
line 117why, one step back117Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 118–119why, one step back118 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None), @r#"119 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 120why, one step back120 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 121–124why, one step back121 | Command122 | Mean Wall Time [ms]123 | Change124 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 125why, one step back125Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 126–129why, one step back126 | `sleep 0.1`127 | 110.0 ± 26.5128 |129 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 130why, one step back130Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 131–134why, one step back131 | `sleep 2`132 | 3000.0 ± 1000.0133 | +2627.3%134 | (27.3x slower)Move more tests to instaDavid Peterbefore adoptionda399ab
lines 135–137why, one step back135 |===136 "#);137Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 138–143why, one step back138 insta::assert_snapshot!(get_output::<OrgmodeExporter>(&results, None), @"139 | Command | Mean Wall Time [ms] | Change | Factor |140 |--+--+--+--|141 | =sleep 0.1= | 110.0 ± 26.5 | | |142 | =sleep 2= | 3000.0 ± 1000.0 | +2627.3% | (27.3x slower) |143 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 144–148why, one step back144}145146/// This (again) demonstrates that the first entry's units (s) are used to set147/// the units for all entries when the time unit is not given.148#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
line 149why, one step back149fn test_markup_export_auto_s() {Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 150–151why, one step back150 let results = [151 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 152why, one step back152 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 153why, one step back153 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 154–155why, one step back154 name: None,155 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 156–158why, one step back156 measurements: Measurements::new(vec![157 Measurement {158 time_wall_clock: Time::new::<second>(2.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 159why, one step back159 time_cpu: Time::new::<second>(2.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 160–161why, one step back160 time_user: Time::new::<second>(2.1),161 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 162why, one step back162 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 163why, one step back163 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 164–167why, one step back164 exit_status: ExitStatus::default(),165 },166 Measurement {167 time_wall_clock: Time::new::<second>(2.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 168why, one step back168 time_cpu: Time::new::<second>(2.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 169–170why, one step back169 time_user: Time::new::<second>(2.2),170 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 171why, one step back171 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 172why, one step back172 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 173–176why, one step back173 exit_status: ExitStatus::default(),174 },175 Measurement {176 time_wall_clock: Time::new::<second>(2.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 177why, one step back177 time_cpu: Time::new::<second>(2.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 178–179why, one step back178 time_user: Time::new::<second>(2.3),179 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 180why, one step back180 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 181why, one step back181 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 182–184why, one step back182 exit_status: ExitStatus::default(),183 },184 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 185–187why, one step back185 parameters: BTreeMap::new(),186 },187 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 188why, one step back188 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 189why, one step back189 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 190–191why, one step back190 name: None,191 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 192–194why, one step back192 measurements: Measurements::new(vec![193 Measurement {194 time_wall_clock: Time::new::<second>(0.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 195why, one step back195 time_cpu: Time::new::<second>(0.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 196–197why, one step back196 time_user: Time::new::<second>(0.1),197 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 198why, one step back198 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 199why, one step back199 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 200–203why, one step back200 exit_status: ExitStatus::default(),201 },202 Measurement {203 time_wall_clock: Time::new::<second>(0.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 204why, one step back204 time_cpu: Time::new::<second>(0.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 205–206why, one step back205 time_user: Time::new::<second>(0.2),206 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 207why, one step back207 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 208why, one step back208 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 209–212why, one step back209 exit_status: ExitStatus::default(),210 },211 Measurement {212 time_wall_clock: Time::new::<second>(0.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 213why, one step back213 time_cpu: Time::new::<second>(0.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 214–215why, one step back214 time_user: Time::new::<second>(0.3),215 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 216why, one step back216 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 217why, one step back217 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 218–220why, one step back218 exit_status: ExitStatus::default(),219 },220 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 221–224why, one step back221 parameters: BTreeMap::new(),222 },223 ];224Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 225–230why, one step back225 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, None), @"226 | Command | Mean Wall Time [s] | Change | Factor |227 |:---|---:|---:|:---|228 | `sleep 2` | 2.200 ± 0.100 | | |229 | `sleep 0.1` | 0.200 ± 0.100 | -90.9% | (11.0x faster) |230 ");Move more tests to instaDavid Peterbefore adoptionda399ab
line 231why, one step back231Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 232–233why, one step back232 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None), @r#"233 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 234why, one step back234 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 235–238why, one step back235 | Command236 | Mean Wall Time [s]237 | Change238 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 239why, one step back239Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 240–243why, one step back240 | `sleep 2`241 | 2.200 ± 0.100242 |243 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 244why, one step back244Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 245–248why, one step back245 | `sleep 0.1`246 | 0.200 ± 0.100247 | -90.9%248 | (11.0x faster)Move more tests to instaDavid Peterbefore adoptionda399ab
lines 249–251why, one step back249 |===250 "#);251Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 252–257why, one step back252 insta::assert_snapshot!(get_output::<OrgmodeExporter>(&results, None), @"253 | Command | Mean Wall Time [s] | Change | Factor |254 |--+--+--+--|255 | =sleep 2= | 2.200 ± 0.100 | | |256 | =sleep 0.1= | 0.200 ± 0.100 | -90.9% | (11.0x faster) |257 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 258–259why, one step back258}259Move more tests to instaDavid Peterbefore adoptionda399ab
lines 260–261why, one step back260/// This (again) demonstrates that the given time unit (ms) is used to set261/// the units for all entries.Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 262why, one step back262#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
lines 263–264why, one step back263fn test_markup_export_manual_ms() {264 let timing_results = [Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 265why, one step back265 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 266why, one step back266 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 267why, one step back267 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 268–269why, one step back268 name: None,269 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 270–272why, one step back270 measurements: Measurements::new(vec![271 Measurement {272 time_wall_clock: Time::new::<second>(2.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 273why, one step back273 time_cpu: Time::new::<second>(2.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 274–275why, one step back274 time_user: Time::new::<second>(2.1),275 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 276why, one step back276 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 277why, one step back277 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 278–281why, one step back278 exit_status: ExitStatus::default(),279 },280 Measurement {281 time_wall_clock: Time::new::<second>(2.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 282why, one step back282 time_cpu: Time::new::<second>(2.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 283–284why, one step back283 time_user: Time::new::<second>(2.2),284 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 285why, one step back285 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 286why, one step back286 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 287–290why, one step back287 exit_status: ExitStatus::default(),288 },289 Measurement {290 time_wall_clock: Time::new::<second>(2.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 291why, one step back291 time_cpu: Time::new::<second>(2.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 292–293why, one step back292 time_user: Time::new::<second>(2.3),293 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 294why, one step back294 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 295why, one step back295 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 296–298why, one step back296 exit_status: ExitStatus::default(),297 },298 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 299–301why, one step back299 parameters: BTreeMap::new(),300 },301 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 302why, one step back302 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 303why, one step back303 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 304–305why, one step back304 name: None,305 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 306–308why, one step back306 measurements: Measurements::new(vec![307 Measurement {308 time_wall_clock: Time::new::<second>(0.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 309why, one step back309 time_cpu: Time::new::<second>(0.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 310–311why, one step back310 time_user: Time::new::<second>(0.1),311 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 312why, one step back312 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 313why, one step back313 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 314–317why, one step back314 exit_status: ExitStatus::default(),315 },316 Measurement {317 time_wall_clock: Time::new::<second>(0.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 318why, one step back318 time_cpu: Time::new::<second>(0.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 319–320why, one step back319 time_user: Time::new::<second>(0.2),320 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 321why, one step back321 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 322why, one step back322 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 323–326why, one step back323 exit_status: ExitStatus::default(),324 },325 Measurement {326 time_wall_clock: Time::new::<second>(0.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 327why, one step back327 time_cpu: Time::new::<second>(0.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 328–329why, one step back328 time_user: Time::new::<second>(0.3),329 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 330why, one step back330 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 331why, one step back331 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 332–334why, one step back332 exit_status: ExitStatus::default(),333 },334 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 335–338why, one step back335 parameters: BTreeMap::new(),336 },337 ];338Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 339–344why, one step back339 insta::assert_snapshot!(get_output::<MarkdownExporter>(&timing_results, Some(Unit { symbol: "ms", scale: 0.001 })), @"340 | Command | Mean Wall Time [ms] | Change | Factor |341 |:---|---:|---:|:---|342 | `sleep 2` | 2200.0 ± 100.0 | | |343 | `sleep 0.1` | 200.0 ± 100.0 | -90.9% | (11.0x faster) |344 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 345why, one step back345Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 346–347why, one step back346 insta::assert_snapshot!(get_output::<AsciidocExporter>(&timing_results, Some(Unit { symbol: "ms", scale: 0.001 })), @r#"347 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 348why, one step back348 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 349–352why, one step back349 | Command350 | Mean Wall Time [ms]351 | Change352 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 353why, one step back353Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 354–357why, one step back354 | `sleep 2`355 | 2200.0 ± 100.0356 |357 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 358why, one step back358Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 359–362why, one step back359 | `sleep 0.1`360 | 200.0 ± 100.0361 | -90.9%362 | (11.0x faster)Move more tests to instaDavid Peterbefore adoptionda399ab
lines 363–365why, one step back363 |===364 "#);365Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 366–371why, one step back366 insta::assert_snapshot!(get_output::<OrgmodeExporter>(&timing_results, Some(Unit { symbol: "ms", scale: 0.001 })), @"367 | Command | Mean Wall Time [ms] | Change | Factor |368 |--+--+--+--|369 | =sleep 2= | 2200.0 ± 100.0 | | |370 | =sleep 0.1= | 200.0 ± 100.0 | -90.9% | (11.0x faster) |371 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 372–373why, one step back372}373Move more tests to instaDavid Peterbefore adoptionda399ab
line 374why, one step back374/// The given time unit (s) is used to set the units for all entries.Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 375why, one step back375#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
lines 376–377why, one step back376fn test_markup_export_manual_s() {377 let results = [Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 378why, one step back378 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 379why, one step back379 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 380why, one step back380 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 381–382why, one step back381 name: None,382 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 383–385why, one step back383 measurements: Measurements::new(vec![384 Measurement {385 time_wall_clock: Time::new::<second>(2.01),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 386why, one step back386 time_cpu: Time::new::<second>(2.01),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 387–388why, one step back387 time_user: Time::new::<second>(2.01),388 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 389why, one step back389 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 390why, one step back390 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 391–394why, one step back391 exit_status: ExitStatus::default(),392 },393 Measurement {394 time_wall_clock: Time::new::<second>(2.02),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 395why, one step back395 time_cpu: Time::new::<second>(2.02),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 396–397why, one step back396 time_user: Time::new::<second>(2.02),397 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 398why, one step back398 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 399why, one step back399 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 400–403why, one step back400 exit_status: ExitStatus::default(),401 },402 Measurement {403 time_wall_clock: Time::new::<second>(2.03),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 404why, one step back404 time_cpu: Time::new::<second>(2.03),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 405–406why, one step back405 time_user: Time::new::<second>(2.03),406 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 407why, one step back407 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 408why, one step back408 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 409–411why, one step back409 exit_status: ExitStatus::default(),410 },411 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 412–414why, one step back412 parameters: BTreeMap::new(),413 },414 BenchmarkResult {Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 415why, one step back415 environment: BTreeMap::new(),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 416why, one step back416 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 417–418why, one step back417 name: None,418 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 419–421why, one step back419 measurements: Measurements::new(vec![420 Measurement {421 time_wall_clock: Time::new::<second>(0.11),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 422why, one step back422 time_cpu: Time::new::<second>(0.11),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 423–424why, one step back423 time_user: Time::new::<second>(0.11),424 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 425why, one step back425 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 426why, one step back426 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 427–430why, one step back427 exit_status: ExitStatus::default(),428 },429 Measurement {430 time_wall_clock: Time::new::<second>(0.12),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 431why, one step back431 time_cpu: Time::new::<second>(0.12),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 432–433why, one step back432 time_user: Time::new::<second>(0.12),433 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 434why, one step back434 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 435why, one step back435 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 436–439why, one step back436 exit_status: ExitStatus::default(),437 },438 Measurement {439 time_wall_clock: Time::new::<second>(0.13),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 440why, one step back440 time_cpu: Time::new::<second>(0.13),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 441–442why, one step back441 time_user: Time::new::<second>(0.13),442 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 443why, one step back443 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 444why, one step back444 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 445–447why, one step back445 exit_status: ExitStatus::default(),446 },447 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 448–451why, one step back448 parameters: BTreeMap::new(),449 },450 ];451Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 452–457why, one step back452 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(Unit { symbol: "s", scale: 1.0 })), @"453 | Command | Mean Wall Time [s] | Change | Factor |454 |:---|---:|---:|:---|455 | `sleep 2` | 2.020 ± 0.010 | | |456 | `sleep 0.1` | 0.120 ± 0.010 | -94.1% | (16.8x faster) |457 ");Move more tests to instaDavid Peterbefore adoptionda399ab
line 458why, one step back458Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 459–460why, one step back459 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, Some(Unit { symbol: "s", scale: 1.0 })), @r#"460 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 461why, one step back461 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 462–465why, one step back462 | Command463 | Mean Wall Time [s]464 | Change465 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 466why, one step back466Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 467–470why, one step back467 | `sleep 2`468 | 2.020 ± 0.010469 |470 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 471why, one step back471Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 472–475why, one step back472 | `sleep 0.1`473 | 0.120 ± 0.010474 | -94.1%475 | (16.8x faster)Move more tests to instaDavid Peterbefore adoptionda399ab
line 476why, one step back476 |===Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 477–478why, one step back477 "#);478}