(results: &[&FetchLocalRunBenchmarkResult])
| 224 | } |
| 225 | |
| 226 | fn build_memory_table(results: &[&FetchLocalRunBenchmarkResult]) -> String { |
| 227 | let rows: Vec<MemoryRow> = results |
| 228 | .iter() |
| 229 | .map(|result| { |
| 230 | let (peak_memory, total_allocated, alloc_calls) = if let Some(mem) = &result.memory { |
| 231 | ( |
| 232 | format!( |
| 233 | "{}", |
| 234 | style(helpers::format_memory(mem.peak_memory as f64, Some(1))).cyan() |
| 235 | ), |
| 236 | helpers::format_memory(mem.total_allocated as f64, Some(1)), |
| 237 | format_with_thousands_sep(mem.alloc_calls as u64), |
| 238 | ) |
| 239 | } else { |
| 240 | ( |
| 241 | format!( |
| 242 | "{}", |
| 243 | style(helpers::format_memory(result.value, Some(1))).cyan() |
| 244 | ), |
| 245 | "-".to_string(), |
| 246 | "-".to_string(), |
| 247 | ) |
| 248 | }; |
| 249 | MemoryRow { |
| 250 | name: result.benchmark.name.clone(), |
| 251 | peak_memory, |
| 252 | total_allocated, |
| 253 | alloc_calls, |
| 254 | } |
| 255 | }) |
| 256 | .collect(); |
| 257 | build_table_with_style( |
| 258 | &rows, |
| 259 | ExecutorName::Memory.label(), |
| 260 | ExecutorName::Memory.icon(), |
| 261 | ) |
| 262 | } |
| 263 | |
| 264 | pub fn build_benchmark_table(results: &[FetchLocalRunBenchmarkResult]) -> String { |
| 265 | // Group results by executor |
no test coverage detected