Fixes to CI bench comparison (#2319)

* Fixes to CI bench comparison

- The table columns did not match the header
- The last commit was not identified correctly

* review comments
This commit is contained in:
Pankaj Garg
2019-01-07 14:26:21 -08:00
committed by GitHub
parent 6000df9779
commit 0a0c62f384

View File

@@ -59,10 +59,9 @@ fn main() {
if v["type"] == "bench" { if v["type"] == "bench" {
let name = v["name"].as_str().unwrap().trim_matches('\"').to_string(); let name = v["name"].as_str().unwrap().trim_matches('\"').to_string();
last_commit = match get_last_metrics(&"commit".to_string(), &db, &name, &branch) { if last_commit.is_none() {
Result::Ok(v) => Some(v), last_commit = get_last_metrics(&"commit".to_string(), &db, &name, &branch).ok();
Result::Err(_) => None, }
};
let median = v["median"].to_string().parse().unwrap(); let median = v["median"].to_string().parse().unwrap();
let deviation = v["deviation"].to_string().parse().unwrap(); let deviation = v["deviation"].to_string().parse().unwrap();
@@ -99,12 +98,12 @@ fn main() {
println!("bench_name, median, last_median, deviation, last_deviation"); println!("bench_name, median, last_median, deviation, last_deviation");
for (entry, values) in results { for (entry, values) in results {
println!( println!(
"{:#10?}, {:#10?}, {:#10?}, {:#10?}, {}", "{}, {:#10?}, {:#10?}, {:#10?}, {:#10?}",
entry,
values.0, values.0,
values.2.parse::<i32>().unwrap(), values.2.parse::<i32>().unwrap(),
values.1, values.1,
values.3.parse::<i32>().unwrap(), values.3.parse::<i32>().unwrap(),
entry,
); );
} }
} else { } else {
@@ -112,7 +111,7 @@ fn main() {
println!("hash: {}", trimmed_hash); println!("hash: {}", trimmed_hash);
println!("bench_name, median, deviation"); println!("bench_name, median, deviation");
for (entry, values) in results { for (entry, values) in results {
println!("{:10?}, {:10?}, {}", values.0, values.1, entry); println!("{}, {:10?}, {:10?}", entry, values.0, values.1);
} }
} }
solana_metrics::flush(); solana_metrics::flush();