Skip to content
Myr

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 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–17why, one step back
14 String::from_utf8(
15 exporter16 .serialize(17 results,

Export selected metrics side by side in CSVDavid Peterbefore adoption067ee70

line 18why, one step back
18 &[MetricSelection {

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

lines 19–20why, one step back
19 unit,
20 ..MetricSelection::default()

Export selected metrics side by side in CSVDavid Peterbefore adoption067ee70

line 21why, one step back
21 }],

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

lines 22–25why, one step back
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–37why, one step back
36 let results = [
37 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 38why, one step back
38 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 39why, one step back
39 command: String::from("sleep 0.1"),

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

lines 40–41why, one step back
40 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 back
42 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 back
45 time_cpu: Time::new::<second>(0.09),

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 71–73why, one step back
71 parameters: BTreeMap::new(),
72 },73 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 74why, one step back
74 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 75why, one step back
75 command: String::from("sleep 2"),

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

lines 76–77why, one step back
76 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 back
78 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 back
81 time_cpu: Time::new::<second>(2.0),

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

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

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

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

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

lines 86–89why, one step back
86 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 back
90 time_cpu: Time::new::<second>(3.0),

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

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

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

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

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

lines 95–98why, one step back
95 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 back
99 time_cpu: Time::new::<second>(4.0),

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

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

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

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

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

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

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

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

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

lines 111–116why, one step back
111 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 back
117

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

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

Move more tests to instaDavid Peterbefore adoptionda399ab

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

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

lines 121–124why, one step back
121 | Command
122 | Mean Wall Time [ms]123 | Change124 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 125why, one step back
125

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

lines 126–129why, one step back
126 | `sleep 0.1`
127 | 110.0 ± 26.5128 |129 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 130why, one step back
130

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

lines 131–134why, one step back
131 | `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 back
135 |===
136 "#);137

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

lines 138–143why, one step back
138 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 back
144}
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 back
149fn test_markup_export_auto_s() {

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 150–151why, one step back
150 let results = [
151 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 152why, one step back
152 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 153why, one step back
153 command: String::from("sleep 2"),

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

lines 154–155why, one step back
154 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 back
156 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 back
159 time_cpu: Time::new::<second>(2.1),

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

lines 182–184why, one step back
182 exit_status: ExitStatus::default(),
183 },184 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 185–187why, one step back
185 parameters: BTreeMap::new(),
186 },187 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 188why, one step back
188 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 189why, one step back
189 command: String::from("sleep 0.1"),

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

lines 190–191why, one step back
190 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 back
192 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 back
195 time_cpu: Time::new::<second>(0.1),

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

lines 218–220why, one step back
218 exit_status: ExitStatus::default(),
219 },220 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 221–224why, one step back
221 parameters: BTreeMap::new(),
222 },223 ];224

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

lines 225–230why, one step back
225 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 back
231

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

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

Move more tests to instaDavid Peterbefore adoptionda399ab

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

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

lines 235–238why, one step back
235 | Command
236 | Mean Wall Time [s]237 | Change238 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 239why, one step back
239

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

lines 240–243why, one step back
240 | `sleep 2`
241 | 2.200 ± 0.100242 |243 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 244why, one step back
244

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

lines 245–248why, one step back
245 | `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 back
249 |===
250 "#);251

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

lines 252–257why, one step back
252 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 back
258}
259

Move more tests to instaDavid Peterbefore adoptionda399ab

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

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

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

Move more tests to instaDavid Peterbefore adoptionda399ab

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

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 265why, one step back
265 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 266why, one step back
266 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 267why, one step back
267 command: String::from("sleep 2"),

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

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

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

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

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

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

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

lines 278–281why, one step back
278 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 back
282 time_cpu: Time::new::<second>(2.2),

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

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

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

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

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

lines 287–290why, one step back
287 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 back
291 time_cpu: Time::new::<second>(2.3),

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

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

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

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

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

lines 296–298why, one step back
296 exit_status: ExitStatus::default(),
297 },298 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 299–301why, one step back
299 parameters: BTreeMap::new(),
300 },301 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 302why, one step back
302 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 303why, one step back
303 command: String::from("sleep 0.1"),

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

lines 304–305why, one step back
304 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 back
306 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 back
309 time_cpu: Time::new::<second>(0.1),

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

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

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

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

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

lines 314–317why, one step back
314 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 back
318 time_cpu: Time::new::<second>(0.2),

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

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

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

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

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

lines 323–326why, one step back
323 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 back
327 time_cpu: Time::new::<second>(0.3),

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

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

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

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

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

lines 332–334why, one step back
332 exit_status: ExitStatus::default(),
333 },334 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 335–338why, one step back
335 parameters: BTreeMap::new(),
336 },337 ];338

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

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

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

lines 346–347why, one step back
346 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 back
348 |===

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

lines 349–352why, one step back
349 | Command
350 | Mean Wall Time [ms]351 | Change352 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 353why, one step back
353

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

lines 354–357why, one step back
354 | `sleep 2`
355 | 2200.0 ± 100.0356 |357 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 358why, one step back
358

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

lines 359–362why, one step back
359 | `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 back
363 |===
364 "#);365

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

lines 366–371why, one step back
366 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 back
372}
373

Move more tests to instaDavid Peterbefore adoptionda399ab

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

Move more tests to instaDavid Peterbefore adoptionda399ab

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

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 378why, one step back
378 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 379why, one step back
379 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 380why, one step back
380 command: String::from("sleep 2"),

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

lines 381–382why, one step back
381 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 back
383 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 back
386 time_cpu: Time::new::<second>(2.01),

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

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

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

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

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

lines 391–394why, one step back
391 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 back
395 time_cpu: Time::new::<second>(2.02),

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

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

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

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

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

lines 400–403why, one step back
400 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 back
404 time_cpu: Time::new::<second>(2.03),

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

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

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

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

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

lines 409–411why, one step back
409 exit_status: ExitStatus::default(),
410 },411 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 412–414why, one step back
412 parameters: BTreeMap::new(),
413 },414 BenchmarkResult {

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

line 415why, one step back
415 environment: BTreeMap::new(),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

line 416why, one step back
416 command: String::from("sleep 0.1"),

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

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

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

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

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

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

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

lines 427–430why, one step back
427 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 back
431 time_cpu: Time::new::<second>(0.12),

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

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

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

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

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

lines 436–439why, one step back
436 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 back
440 time_cpu: Time::new::<second>(0.13),

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

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

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

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

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

lines 445–447why, one step back
445 exit_status: ExitStatus::default(),
446 },447 ]),

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 448–451why, one step back
448 parameters: BTreeMap::new(),
449 },450 ];451

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

lines 452–457why, one step back
452 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 back
458

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

lines 459–460why, one step back
459 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 back
461 |===

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

lines 462–465why, one step back
462 | Command
463 | Mean Wall Time [s]464 | Change465 | Factor

Move more tests to instaDavid Peterbefore adoptionda399ab

line 466why, one step back
466

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

lines 467–470why, one step back
467 | `sleep 2`
468 | 2.020 ± 0.010469 |470 |

Move more tests to instaDavid Peterbefore adoptionda399ab

line 471why, one step back
471

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

lines 472–475why, one step back
472 | `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 back
476 |===

Use insta for exporter testsDavid Peterbefore adoption7a9d04d

lines 477–478why, one step back
477 "#);
478}