Skip to content
Myr

Format CSV times with six decimal places

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

authored by David Peter · committed by David Peter · parent ecf8a24 · Browse files · 1 file+5 added−3 removed
This commit

State

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

Diff stats

1 file+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:src/export/csv.rs+5 added-3 removed
17 unmodified lines
18 results: &[BenchmarkResult],19 _unit: Option<TimeUnit>,20 _sort_order: SortOrder,21 ) -> Result<Vec<u8>> {22 const CSV_PRECISION: usize = 6;2324 let mut writer = WriterBuilder::new().from_writer(vec![]);2526 {27 let mut headers: Vec<Cow<[u8]>> = [
21 unmodified lines
49 res.system,50 res.min,51 res.max,52 ] {51 fields.push(Cow::Owned(f.to_string().into_bytes()))53 fields.push(Cow::Owned(format!("{f:.CSV_PRECISION$}").into_bytes()))54 }55 for v in res.parameters.values() {56 fields.push(Cow::Borrowed(v.as_bytes()))57 }
60 unmodified lines
118 .unwrap();119120 insta::assert_snapshot!(actual, @r#"121 command,mean,stddev,median,user,system,min,max,parameter_bar,parameter_foo120 command_a,1,2,1,3,4,5,6,two,one121 command_b,11,12,11,13,14,15,16.5,seven,one122 command_a,1.000000,2.000000,1.000000,3.000000,4.000000,5.000000,6.000000,two,one123 command_b,11.000000,12.000000,11.000000,13.000000,14.000000,15.000000,16.500000,seven,one124 "#);125}