tests.rs
This file
Path
src/export/tests.rs
470 lines · 18.2 KiB · Rust
Last changed by
Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
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–25why, one step back14 String::from_utf8(15 exporter16 .serialize(17 results,18 MetricSelection {19 unit,20 ..MetricSelection::default()21 },22 )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–38why, one step back36 let results = [37 BenchmarkResult {38 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 39–40why, one step back39 name: None,40 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 41–43why, one step back41 measurements: Measurements::new(vec![42 Measurement {43 time_wall_clock: Time::new::<second>(0.09),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 44why, one step back44 time_cpu: Time::new::<second>(0.09),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 45–46why, one step back45 time_user: Time::new::<second>(0.09),46 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 47why, one step back47 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 48why, one step back48 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 49–52why, one step back49 exit_status: ExitStatus::default(),50 },51 Measurement {52 time_wall_clock: Time::new::<second>(0.10),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 53why, one step back53 time_cpu: Time::new::<second>(0.10),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 54–55why, one step back54 time_user: Time::new::<second>(0.10),55 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 56why, one step back56 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 57why, one step back57 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 58–61why, one step back58 exit_status: ExitStatus::default(),59 },60 Measurement {61 time_wall_clock: Time::new::<second>(0.14),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 62why, one step back62 time_cpu: Time::new::<second>(0.14),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 63–64why, one step back63 time_user: Time::new::<second>(0.14),64 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 65why, one step back65 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 66why, one step back66 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 67–69why, one step back67 exit_status: ExitStatus::default(),68 },69 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 70–73why, one step back70 parameters: BTreeMap::new(),71 },72 BenchmarkResult {73 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 74–75why, one step back74 name: None,75 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 76–78why, one step back76 measurements: Measurements::new(vec![77 Measurement {78 time_wall_clock: Time::new::<second>(2.0),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 79why, one step back79 time_cpu: Time::new::<second>(2.0),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 80–81why, one step back80 time_user: Time::new::<second>(2.0),81 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 82why, one step back82 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 83why, one step back83 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 84–87why, one step back84 exit_status: ExitStatus::default(),85 },86 Measurement {87 time_wall_clock: Time::new::<second>(3.0),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 88why, one step back88 time_cpu: Time::new::<second>(3.0),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 89–90why, one step back89 time_user: Time::new::<second>(3.0),90 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 91why, one step back91 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 92why, one step back92 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 93–96why, one step back93 exit_status: ExitStatus::default(),94 },95 Measurement {96 time_wall_clock: Time::new::<second>(4.0),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 97why, one step back97 time_cpu: Time::new::<second>(4.0),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 98–99why, one step back98 time_user: Time::new::<second>(4.0),99 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 100why, one step back100 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 101why, one step back101 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 102–104why, one step back102 exit_status: ExitStatus::default(),103 },104 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 105–108why, one step back105 parameters: BTreeMap::new(),106 },107 ];108Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 109–114why, one step back109 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, None), @"110 | Command | Mean Wall Time [ms] | Change | Factor |111 |:---|---:|---:|:---|112 | `sleep 0.1` | 110.0 ± 26.5 | | |113 | `sleep 2` | 3000.0 ± 1000.0 | +2627.3% | (27.3x slower) |114 ");Move more tests to instaDavid Peterbefore adoptionda399ab
line 115why, one step back115Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 116–117why, one step back116 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None), @r#"117 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 118why, one step back118 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 119–122why, one step back119 | Command120 | Mean Wall Time [ms]121 | Change122 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 123why, one step back123Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 124–127why, one step back124 | `sleep 0.1`125 | 110.0 ± 26.5126 |127 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 128why, one step back128Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 129–132why, one step back129 | `sleep 2`130 | 3000.0 ± 1000.0131 | +2627.3%132 | (27.3x slower)Move more tests to instaDavid Peterbefore adoptionda399ab
lines 133–135why, one step back133 |===134 "#);135Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 136–141why, one step back136 insta::assert_snapshot!(get_output::<OrgmodeExporter>(&results, None), @"137 | Command | Mean Wall Time [ms] | Change | Factor |138 |--+--+--+--|139 | =sleep 0.1= | 110.0 ± 26.5 | | |140 | =sleep 2= | 3000.0 ± 1000.0 | +2627.3% | (27.3x slower) |141 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 142–146why, one step back142}143144/// This (again) demonstrates that the first entry's units (s) are used to set145/// the units for all entries when the time unit is not given.146#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
line 147why, one step back147fn test_markup_export_auto_s() {Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 148–150why, one step back148 let results = [149 BenchmarkResult {150 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 151–152why, one step back151 name: None,152 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 153–155why, one step back153 measurements: Measurements::new(vec![154 Measurement {155 time_wall_clock: Time::new::<second>(2.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 156why, one step back156 time_cpu: Time::new::<second>(2.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 157–158why, one step back157 time_user: Time::new::<second>(2.1),158 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 159why, one step back159 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 160why, one step back160 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 161–164why, one step back161 exit_status: ExitStatus::default(),162 },163 Measurement {164 time_wall_clock: Time::new::<second>(2.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 165why, one step back165 time_cpu: Time::new::<second>(2.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 166–167why, one step back166 time_user: Time::new::<second>(2.2),167 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 168why, one step back168 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 169why, one step back169 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 170–173why, one step back170 exit_status: ExitStatus::default(),171 },172 Measurement {173 time_wall_clock: Time::new::<second>(2.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 174why, one step back174 time_cpu: Time::new::<second>(2.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 175–176why, one step back175 time_user: Time::new::<second>(2.3),176 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 177why, one step back177 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 178why, one step back178 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 179–181why, one step back179 exit_status: ExitStatus::default(),180 },181 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 182–185why, one step back182 parameters: BTreeMap::new(),183 },184 BenchmarkResult {185 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 186–187why, one step back186 name: None,187 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 188–190why, one step back188 measurements: Measurements::new(vec![189 Measurement {190 time_wall_clock: Time::new::<second>(0.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 191why, one step back191 time_cpu: Time::new::<second>(0.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 192–193why, one step back192 time_user: Time::new::<second>(0.1),193 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 194why, one step back194 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 195why, one step back195 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 196–199why, one step back196 exit_status: ExitStatus::default(),197 },198 Measurement {199 time_wall_clock: Time::new::<second>(0.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 200why, one step back200 time_cpu: Time::new::<second>(0.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 201–202why, one step back201 time_user: Time::new::<second>(0.2),202 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 203why, one step back203 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 204why, one step back204 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 205–208why, one step back205 exit_status: ExitStatus::default(),206 },207 Measurement {208 time_wall_clock: Time::new::<second>(0.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 209why, one step back209 time_cpu: Time::new::<second>(0.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 210–211why, one step back210 time_user: Time::new::<second>(0.3),211 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 212why, one step back212 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 213why, one step back213 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 214–216why, one step back214 exit_status: ExitStatus::default(),215 },216 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 217–220why, one step back217 parameters: BTreeMap::new(),218 },219 ];220Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 221–226why, one step back221 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, None), @"222 | Command | Mean Wall Time [s] | Change | Factor |223 |:---|---:|---:|:---|224 | `sleep 2` | 2.200 ± 0.100 | | |225 | `sleep 0.1` | 0.200 ± 0.100 | -90.9% | (11.0x faster) |226 ");Move more tests to instaDavid Peterbefore adoptionda399ab
line 227why, one step back227Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 228–229why, one step back228 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None), @r#"229 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 230why, one step back230 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 231–234why, one step back231 | Command232 | Mean Wall Time [s]233 | Change234 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 235why, one step back235Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 236–239why, one step back236 | `sleep 2`237 | 2.200 ± 0.100238 |239 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 240why, one step back240Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 241–244why, one step back241 | `sleep 0.1`242 | 0.200 ± 0.100243 | -90.9%244 | (11.0x faster)Move more tests to instaDavid Peterbefore adoptionda399ab
lines 245–247why, one step back245 |===246 "#);247Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 248–253why, one step back248 insta::assert_snapshot!(get_output::<OrgmodeExporter>(&results, None), @"249 | Command | Mean Wall Time [s] | Change | Factor |250 |--+--+--+--|251 | =sleep 2= | 2.200 ± 0.100 | | |252 | =sleep 0.1= | 0.200 ± 0.100 | -90.9% | (11.0x faster) |253 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 254–255why, one step back254}255Move more tests to instaDavid Peterbefore adoptionda399ab
lines 256–257why, one step back256/// This (again) demonstrates that the given time unit (ms) is used to set257/// the units for all entries.Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 258why, one step back258#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
lines 259–260why, one step back259fn test_markup_export_manual_ms() {260 let timing_results = [Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 261–262why, one step back261 BenchmarkResult {262 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 263–264why, one step back263 name: None,264 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 265–267why, one step back265 measurements: Measurements::new(vec![266 Measurement {267 time_wall_clock: Time::new::<second>(2.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 268why, one step back268 time_cpu: Time::new::<second>(2.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 269–270why, one step back269 time_user: Time::new::<second>(2.1),270 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 271why, one step back271 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 272why, one step back272 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 273–276why, one step back273 exit_status: ExitStatus::default(),274 },275 Measurement {276 time_wall_clock: Time::new::<second>(2.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 277why, one step back277 time_cpu: Time::new::<second>(2.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 278–279why, one step back278 time_user: Time::new::<second>(2.2),279 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 280why, one step back280 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 281why, one step back281 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 282–285why, one step back282 exit_status: ExitStatus::default(),283 },284 Measurement {285 time_wall_clock: Time::new::<second>(2.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 286why, one step back286 time_cpu: Time::new::<second>(2.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 287–288why, one step back287 time_user: Time::new::<second>(2.3),288 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 289why, one step back289 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 290why, one step back290 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 291–293why, one step back291 exit_status: ExitStatus::default(),292 },293 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 294–297why, one step back294 parameters: BTreeMap::new(),295 },296 BenchmarkResult {297 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 298–299why, one step back298 name: None,299 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 300–302why, one step back300 measurements: Measurements::new(vec![301 Measurement {302 time_wall_clock: Time::new::<second>(0.1),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 303why, one step back303 time_cpu: Time::new::<second>(0.1),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 304–305why, one step back304 time_user: Time::new::<second>(0.1),305 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 306why, one step back306 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 307why, one step back307 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 308–311why, one step back308 exit_status: ExitStatus::default(),309 },310 Measurement {311 time_wall_clock: Time::new::<second>(0.2),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 312why, one step back312 time_cpu: Time::new::<second>(0.2),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 313–314why, one step back313 time_user: Time::new::<second>(0.2),314 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 315why, one step back315 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 316why, one step back316 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 317–320why, one step back317 exit_status: ExitStatus::default(),318 },319 Measurement {320 time_wall_clock: Time::new::<second>(0.3),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 321why, one step back321 time_cpu: Time::new::<second>(0.3),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 322–323why, one step back322 time_user: Time::new::<second>(0.3),323 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 324why, one step back324 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 325why, one step back325 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 326–328why, one step back326 exit_status: ExitStatus::default(),327 },328 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 329–332why, one step back329 parameters: BTreeMap::new(),330 },331 ];332Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 333–338why, one step back333 insta::assert_snapshot!(get_output::<MarkdownExporter>(&timing_results, Some(Unit { symbol: "ms", scale: 0.001 })), @"334 | Command | Mean Wall Time [ms] | Change | Factor |335 |:---|---:|---:|:---|336 | `sleep 2` | 2200.0 ± 100.0 | | |337 | `sleep 0.1` | 200.0 ± 100.0 | -90.9% | (11.0x faster) |338 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 339why, one step back339Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 340–341why, one step back340 insta::assert_snapshot!(get_output::<AsciidocExporter>(&timing_results, Some(Unit { symbol: "ms", scale: 0.001 })), @r#"341 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 342why, one step back342 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 343–346why, one step back343 | Command344 | Mean Wall Time [ms]345 | Change346 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 347why, one step back347Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 348–351why, one step back348 | `sleep 2`349 | 2200.0 ± 100.0350 |351 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 352why, one step back352Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 353–356why, one step back353 | `sleep 0.1`354 | 200.0 ± 100.0355 | -90.9%356 | (11.0x faster)Move more tests to instaDavid Peterbefore adoptionda399ab
lines 357–359why, one step back357 |===358 "#);359Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 360–365why, one step back360 insta::assert_snapshot!(get_output::<OrgmodeExporter>(&timing_results, Some(Unit { symbol: "ms", scale: 0.001 })), @"361 | Command | Mean Wall Time [ms] | Change | Factor |362 |--+--+--+--|363 | =sleep 2= | 2200.0 ± 100.0 | | |364 | =sleep 0.1= | 200.0 ± 100.0 | -90.9% | (11.0x faster) |365 ");Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 366–367why, one step back366}367Move more tests to instaDavid Peterbefore adoptionda399ab
line 368why, one step back368/// The given time unit (s) is used to set the units for all entries.Use insta for exporter testsDavid Peterbefore adoption7a9d04d
line 369why, one step back369#[test]Move more tests to instaDavid Peterbefore adoptionda399ab
lines 370–371why, one step back370fn test_markup_export_manual_s() {371 let results = [Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 372–373why, one step back372 BenchmarkResult {373 command: String::from("sleep 2"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 374–375why, one step back374 name: None,375 display_name: String::from("sleep 2"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 376–378why, one step back376 measurements: Measurements::new(vec![377 Measurement {378 time_wall_clock: Time::new::<second>(2.01),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 379why, one step back379 time_cpu: Time::new::<second>(2.01),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 380–381why, one step back380 time_user: Time::new::<second>(2.01),381 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 382why, one step back382 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 383why, one step back383 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 384–387why, one step back384 exit_status: ExitStatus::default(),385 },386 Measurement {387 time_wall_clock: Time::new::<second>(2.02),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 388why, one step back388 time_cpu: Time::new::<second>(2.02),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 389–390why, one step back389 time_user: Time::new::<second>(2.02),390 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 391why, one step back391 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 392why, one step back392 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 393–396why, one step back393 exit_status: ExitStatus::default(),394 },395 Measurement {396 time_wall_clock: Time::new::<second>(2.03),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 397why, one step back397 time_cpu: Time::new::<second>(2.03),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 398–399why, one step back398 time_user: Time::new::<second>(2.03),399 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 400why, one step back400 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 401why, one step back401 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 402–404why, one step back402 exit_status: ExitStatus::default(),403 },404 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 405–408why, one step back405 parameters: BTreeMap::new(),406 },407 BenchmarkResult {408 command: String::from("sleep 0.1"),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 409–410why, one step back409 name: None,410 display_name: String::from("sleep 0.1"),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 411–413why, one step back411 measurements: Measurements::new(vec![412 Measurement {413 time_wall_clock: Time::new::<second>(0.11),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 414why, one step back414 time_cpu: Time::new::<second>(0.11),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 415–416why, one step back415 time_user: Time::new::<second>(0.11),416 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 417why, one step back417 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 418why, one step back418 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 419–422why, one step back419 exit_status: ExitStatus::default(),420 },421 Measurement {422 time_wall_clock: Time::new::<second>(0.12),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 423why, one step back423 time_cpu: Time::new::<second>(0.12),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 424–425why, one step back424 time_user: Time::new::<second>(0.12),425 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 426why, one step back426 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 427why, one step back427 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 428–431why, one step back428 exit_status: ExitStatus::default(),429 },430 Measurement {431 time_wall_clock: Time::new::<second>(0.13),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 432why, one step back432 time_cpu: Time::new::<second>(0.13),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 433–434why, one step back433 time_user: Time::new::<second>(0.13),434 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 435why, one step back435 memory_peak_resident: Some(Information::new::<byte>(1024.)),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 436why, one step back436 hardware_counters: Default::default(),Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520
lines 437–439why, one step back437 exit_status: ExitStatus::default(),438 },439 ]),Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 440–443why, one step back440 parameters: BTreeMap::new(),441 },442 ];443Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 444–449why, one step back444 insta::assert_snapshot!(get_output::<MarkdownExporter>(&results, Some(Unit { symbol: "s", scale: 1.0 })), @"445 | Command | Mean Wall Time [s] | Change | Factor |446 |:---|---:|---:|:---|447 | `sleep 2` | 2.020 ± 0.010 | | |448 | `sleep 0.1` | 0.120 ± 0.010 | -94.1% | (16.8x faster) |449 ");Move more tests to instaDavid Peterbefore adoptionda399ab
line 450why, one step back450Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 451–452why, one step back451 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, Some(Unit { symbol: "s", scale: 1.0 })), @r#"452 [cols="<,>,>,<"]Move more tests to instaDavid Peterbefore adoptionda399ab
line 453why, one step back453 |===Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 454–457why, one step back454 | Command455 | Mean Wall Time [s]456 | Change457 | FactorMove more tests to instaDavid Peterbefore adoptionda399ab
line 458why, one step back458Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 459–462why, one step back459 | `sleep 2`460 | 2.020 ± 0.010461 |462 |Move more tests to instaDavid Peterbefore adoptionda399ab
line 463why, one step back463Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
lines 464–467why, one step back464 | `sleep 0.1`465 | 0.120 ± 0.010466 | -94.1%467 | (16.8x faster)Move more tests to instaDavid Peterbefore adoptionda399ab
line 468why, one step back468 |===Use insta for exporter testsDavid Peterbefore adoption7a9d04d
lines 469–470why, one step back469 "#);470}