Skip to content

Commit

Permalink
Nicer job summary
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Dec 17, 2024
1 parent 5b54cf7 commit 16fc11e
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions benchmarker/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::process::Command;
use std::time::SystemTime;
use std::{env, fs};
Expand Down Expand Up @@ -69,16 +69,36 @@ impl BenchData {

for bench_group in &self.bench_groups {
writeln!(md, "### {}", bench_group.group_name).unwrap();
writeln!(md, "").unwrap();
writeln!(md).unwrap();

let mut available_counters = BTreeSet::new();
for bench in &bench_group.results {
for counter in bench.counters.keys() {
available_counters.insert(counter);
}
}

write!(md, "|command|").unwrap();
for counter in &available_counters {
write!(md, "{counter}|").unwrap();
}
writeln!(md).unwrap();
write!(md, "|---|").unwrap();
for _ in &available_counters {
write!(md, "---|").unwrap();
}
writeln!(md).unwrap();

for bench in &bench_group.results {
writeln!(md, "#### `{}`", bench.cmd.join(" ")).unwrap();
writeln!(md, "").unwrap();
writeln!(md, "|metric|value|").unwrap();
writeln!(md, "|------|-----|").unwrap();
for (name, data) in bench.counters.iter() {
writeln!(md, "|{name}|`{}` {}|", data.value, data.unit).unwrap();
write!(md, "|`{}`|", bench.cmd.join(" ")).unwrap();
for &counter in &available_counters {
if let Some(data) = bench.counters.get(counter) {
write!(md, "`{}` {}|", data.value, data.unit).unwrap();
} else {
write!(md, "|").unwrap();
}
}
writeln!(md, "").unwrap();
writeln!(md).unwrap();
}
}

Expand Down

0 comments on commit 16fc11e

Please sign in to comment.