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