(
id: &'static str,
label: String,
unit: &'static str,
operation_count: usize,
samples: Vec<u128>,
)
| 4302 | } |
| 4303 | |
| 4304 | fn samples_result( |
| 4305 | id: &'static str, |
| 4306 | label: String, |
| 4307 | unit: &'static str, |
| 4308 | operation_count: usize, |
| 4309 | samples: Vec<u128>, |
| 4310 | ) -> BenchmarkTestResult { |
| 4311 | let elapsed_micros = samples.iter().sum(); |
| 4312 | let mut sorted = samples; |
| 4313 | sorted.sort_unstable(); |
| 4314 | let trim = if sorted.len() >= 10 { |
| 4315 | sorted.len() / 10 |
| 4316 | } else { |
| 4317 | 0 |
| 4318 | }; |
| 4319 | let trimmed = &sorted[trim..sorted.len() - trim]; |
| 4320 | let average = trimmed.iter().sum::<u128>() as f64 / trimmed.len() as f64; |
| 4321 | let p50 = percentile_sorted(&sorted, 0.50); |
| 4322 | let p95 = percentile_sorted(&sorted, 0.95); |
| 4323 | BenchmarkTestResult { |
| 4324 | id, |
| 4325 | label, |
| 4326 | unit, |
| 4327 | operation_count, |
| 4328 | sample_count: sorted.len(), |
| 4329 | trimmed_sample_count: trimmed.len(), |
| 4330 | elapsed_micros, |
| 4331 | average_micros: Some(average), |
| 4332 | min_micros: sorted.first().copied(), |
| 4333 | p50_micros: p50, |
| 4334 | p95_micros: p95, |
| 4335 | } |
| 4336 | } |
| 4337 | |
| 4338 | fn single_sample_result( |
| 4339 | id: &'static str, |
no test coverage detected