| 262 | } |
| 263 | |
| 264 | pub fn build_benchmark_table(results: &[FetchLocalRunBenchmarkResult]) -> String { |
| 265 | // Group results by executor |
| 266 | let mut grouped: HashMap<&ExecutorName, Vec<&FetchLocalRunBenchmarkResult>> = HashMap::new(); |
| 267 | for result in results { |
| 268 | grouped |
| 269 | .entry(&result.benchmark.executor) |
| 270 | .or_default() |
| 271 | .push(result); |
| 272 | } |
| 273 | |
| 274 | // Build tables in a consistent order: Simulation (Valgrind), Walltime, Memory |
| 275 | let executor_order = [ |
| 276 | ExecutorName::Valgrind, |
| 277 | ExecutorName::WallTime, |
| 278 | ExecutorName::Memory, |
| 279 | ]; |
| 280 | |
| 281 | let mut output = String::new(); |
| 282 | for executor in &executor_order { |
| 283 | if let Some(executor_results) = grouped.get(executor) { |
| 284 | if !output.is_empty() { |
| 285 | output.push('\n'); |
| 286 | } |
| 287 | let table = match executor { |
| 288 | ExecutorName::Valgrind => build_simulation_table(executor_results), |
| 289 | ExecutorName::WallTime => build_walltime_table(executor_results), |
| 290 | ExecutorName::Memory => build_memory_table(executor_results), |
| 291 | // Not in `executor_order`: analysis runs have no performance results. |
| 292 | ExecutorName::Analysis => continue, |
| 293 | }; |
| 294 | output.push_str(&table); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | output |
| 299 | } |
| 300 | |
| 301 | pub fn build_detailed_summary(result: &FetchLocalRunBenchmarkResult) -> String { |
| 302 | let name = &result.benchmark.name; |