Skip to content
Myr

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 file

Take it

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 1–2why, one step back
1use super::Exporter;
2use crate::benchmark::benchmark_result::BenchmarkResult;

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

line 3why, one step back
3use crate::benchmark::measurement::{Measurement, Measurements};

Move more tests to instaDavid Peterbefore adoptionda399ab

line 4why, one step back
4use crate::export::asciidoc::AsciidocExporter;

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

line 5why, one step back
5use crate::export::markdown::MarkdownExporter;

Move more tests to instaDavid Peterbefore adoptionda399ab

line 6why, one step back
6use crate::export::orgmode::OrgmodeExporter;

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 7–8why, one step back
7use crate::metric::{MetricSelection, Unit};
8use crate::quantity::{byte, second, Information, Time, Zero};

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 9why, one step back
9use std::collections::BTreeMap;

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

line 10why, one step back
10use std::process::ExitStatus;

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 11why, one step back
11

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

line 12why, one step back
12fn get_output<E: Exporter + Default>(results: &[BenchmarkResult], unit: Option<Unit>) -> String {

Move more tests to instaDavid Peterbefore adoptionda399ab

line 13why, one step back
13 let exporter = E::default();

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 14–25why, one step back
14 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 back
26}
27

Move more tests to instaDavid Peterbefore adoptionda399ab

line 28why, one step back
28/// Ensure the makrup output includes the table header and the multiple

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 29–32why, one step back
29/// benchmark results as a table. The list of actual times is not included
30/// in the output.31///32/// This also demonstrates that the first entry's units (ms) are used to set

Move more tests to instaDavid Peterbefore adoptionda399ab

line 33why, one step back
33/// the units for all entries when the time unit is not specified.

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 34why, one step back
34#[test]

Move more tests to instaDavid Peterbefore adoptionda399ab

line 35why, one step back
35fn test_markup_export_auto_ms() {

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 36–38why, one step back
36 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 back
39 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 back
41 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 back
44 time_cpu: Time::new::<second>(0.09),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 45–46why, one step back
45 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 back
47 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 48why, one step back
48 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 49–52why, one step back
49 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 back
53 time_cpu: Time::new::<second>(0.10),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 54–55why, one step back
54 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 back
56 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 57why, one step back
57 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 58–61why, one step back
58 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 back
62 time_cpu: Time::new::<second>(0.14),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 63–64why, one step back
63 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 back
65 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 66why, one step back
66 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 67–69why, one step back
67 exit_status: ExitStatus::default(),
68 },69 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 70–73why, one step back
70 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 back
74 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 back
76 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 back
79 time_cpu: Time::new::<second>(2.0),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 80–81why, one step back
80 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 back
82 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 83why, one step back
83 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 84–87why, one step back
84 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 back
88 time_cpu: Time::new::<second>(3.0),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 89–90why, one step back
89 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 back
91 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 92why, one step back
92 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 93–96why, one step back
93 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 back
97 time_cpu: Time::new::<second>(4.0),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 98–99why, one step back
98 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 back
100 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 101why, one step back
101 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 102–104why, one step back
102 exit_status: ExitStatus::default(),
103 },104 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 105–108why, one step back
105 parameters: BTreeMap::new(),
106 },107 ];108

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 109–114why, one step back
109 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 back
115

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 116–117why, one step back
116 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None), @r#"
117 [cols="<,>,>,<"]

Move more tests to instaDavid Peterbefore adoptionda399ab

line 118why, one step back
118 |===

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 119–122why, one step back
119 | Command
120 | Mean Wall Time [ms]121 | Change122 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 123why, one step back
123

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 124–127why, one step back
124 | `sleep 0.1`
125 | 110.0 ± 26.5126 |127 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 128why, one step back
128

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 129–132why, one step back
129 | `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 back
133 |===
134 "#);135

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 136–141why, one step back
136 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 back
142}
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 back
147fn test_markup_export_auto_s() {

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 148–150why, one step back
148 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 back
151 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 back
153 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 back
156 time_cpu: Time::new::<second>(2.1),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 157–158why, one step back
157 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 back
159 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 160why, one step back
160 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 161–164why, one step back
161 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 back
165 time_cpu: Time::new::<second>(2.2),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 166–167why, one step back
166 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 back
168 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 169why, one step back
169 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 170–173why, one step back
170 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 back
174 time_cpu: Time::new::<second>(2.3),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 175–176why, one step back
175 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 back
177 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 178why, one step back
178 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 179–181why, one step back
179 exit_status: ExitStatus::default(),
180 },181 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 182–185why, one step back
182 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 back
186 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 back
188 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 back
191 time_cpu: Time::new::<second>(0.1),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 192–193why, one step back
192 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 back
194 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 195why, one step back
195 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 196–199why, one step back
196 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 back
200 time_cpu: Time::new::<second>(0.2),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 201–202why, one step back
201 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 back
203 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 204why, one step back
204 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 205–208why, one step back
205 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 back
209 time_cpu: Time::new::<second>(0.3),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 210–211why, one step back
210 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 back
212 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 213why, one step back
213 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 214–216why, one step back
214 exit_status: ExitStatus::default(),
215 },216 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 217–220why, one step back
217 parameters: BTreeMap::new(),
218 },219 ];220

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 221–226why, one step back
221 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 back
227

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 228–229why, one step back
228 insta::assert_snapshot!(get_output::<AsciidocExporter>(&results, None), @r#"
229 [cols="<,>,>,<"]

Move more tests to instaDavid Peterbefore adoptionda399ab

line 230why, one step back
230 |===

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 231–234why, one step back
231 | Command
232 | Mean Wall Time [s]233 | Change234 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 235why, one step back
235

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 236–239why, one step back
236 | `sleep 2`
237 | 2.200 ± 0.100238 |239 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 240why, one step back
240

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 241–244why, one step back
241 | `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 back
245 |===
246 "#);247

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 248–253why, one step back
248 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 back
254}
255

Move more tests to instaDavid Peterbefore adoptionda399ab

lines 256–257why, one step back
256/// This (again) demonstrates that the given time unit (ms) is used to set
257/// the units for all entries.

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 258why, one step back
258#[test]

Move more tests to instaDavid Peterbefore adoptionda399ab

lines 259–260why, one step back
259fn test_markup_export_manual_ms() {
260 let timing_results = [

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 261–262why, one step back
261 BenchmarkResult {
262 command: String::from("sleep 2"),

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

lines 263–264why, one step back
263 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 back
265 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 back
268 time_cpu: Time::new::<second>(2.1),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 269–270why, one step back
269 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 back
271 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 272why, one step back
272 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 273–276why, one step back
273 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 back
277 time_cpu: Time::new::<second>(2.2),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 278–279why, one step back
278 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 back
280 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 281why, one step back
281 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 282–285why, one step back
282 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 back
286 time_cpu: Time::new::<second>(2.3),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 287–288why, one step back
287 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 back
289 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 290why, one step back
290 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 291–293why, one step back
291 exit_status: ExitStatus::default(),
292 },293 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 294–297why, one step back
294 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 back
298 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 back
300 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 back
303 time_cpu: Time::new::<second>(0.1),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 304–305why, one step back
304 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 back
306 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 307why, one step back
307 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 308–311why, one step back
308 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 back
312 time_cpu: Time::new::<second>(0.2),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 313–314why, one step back
313 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 back
315 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 316why, one step back
316 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 317–320why, one step back
317 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 back
321 time_cpu: Time::new::<second>(0.3),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 322–323why, one step back
322 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 back
324 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 325why, one step back
325 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 326–328why, one step back
326 exit_status: ExitStatus::default(),
327 },328 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 329–332why, one step back
329 parameters: BTreeMap::new(),
330 },331 ];332

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 333–338why, one step back
333 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 back
339

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 340–341why, one step back
340 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 back
342 |===

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 343–346why, one step back
343 | Command
344 | Mean Wall Time [ms]345 | Change346 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 347why, one step back
347

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 348–351why, one step back
348 | `sleep 2`
349 | 2200.0 ± 100.0350 |351 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 352why, one step back
352

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 353–356why, one step back
353 | `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 back
357 |===
358 "#);359

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 360–365why, one step back
360 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 back
366}
367

Move more tests to instaDavid Peterbefore adoptionda399ab

line 368why, one step back
368/// 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 back
369#[test]

Move more tests to instaDavid Peterbefore adoptionda399ab

lines 370–371why, one step back
370fn test_markup_export_manual_s() {
371 let results = [

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 372–373why, one step back
372 BenchmarkResult {
373 command: String::from("sleep 2"),

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

lines 374–375why, one step back
374 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 back
376 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 back
379 time_cpu: Time::new::<second>(2.01),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 380–381why, one step back
380 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 back
382 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 383why, one step back
383 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 384–387why, one step back
384 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 back
388 time_cpu: Time::new::<second>(2.02),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 389–390why, one step back
389 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 back
391 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 392why, one step back
392 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 393–396why, one step back
393 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 back
397 time_cpu: Time::new::<second>(2.03),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 398–399why, one step back
398 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 back
400 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 401why, one step back
401 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 402–404why, one step back
402 exit_status: ExitStatus::default(),
403 },404 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 405–408why, one step back
405 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 back
409 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 back
411 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 back
414 time_cpu: Time::new::<second>(0.11),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 415–416why, one step back
415 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 back
417 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 418why, one step back
418 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 419–422why, one step back
419 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 back
423 time_cpu: Time::new::<second>(0.12),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 424–425why, one step back
424 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 back
426 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 427why, one step back
427 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 428–431why, one step back
428 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 back
432 time_cpu: Time::new::<second>(0.13),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 433–434why, one step back
433 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 back
435 memory_peak_resident: Some(Information::new::<byte>(1024.)),

Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0

line 436why, one step back
436 hardware_counters: Default::default(),

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 437–439why, one step back
437 exit_status: ExitStatus::default(),
438 },439 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 440–443why, one step back
440 parameters: BTreeMap::new(),
441 },442 ];443

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 444–449why, one step back
444 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 back
450

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 451–452why, one step back
451 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 back
453 |===

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 454–457why, one step back
454 | Command
455 | Mean Wall Time [s]456 | Change457 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 458why, one step back
458

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 459–462why, one step back
459 | `sleep 2`
460 | 2.020 ± 0.010461 |462 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 463why, one step back
463

Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9

lines 464–467why, one step back
464 | `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 back
468 |===

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 469–470why, one step back
469 "#);
470}