Skip to content

Add perf_revision to benchmark results #8042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions xtask/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl flags::Metrics {
}
{
let _d = pushd("./target/rustc-perf")?;
cmd!("git reset --hard c52ee623e231e7690a93be88d943016968c1036b").run()?;
let revision = &metrics.perf_revision;
cmd!("git reset --hard {revision}").run()?;
}

let _env = pushenv("RA_METRICS", "1");
Expand Down Expand Up @@ -108,6 +109,7 @@ struct Metrics {
host: Host,
timestamp: SystemTime,
revision: String,
perf_revision: String,
metrics: BTreeMap<String, (u64, Unit)>,
}

Expand All @@ -123,7 +125,8 @@ impl Metrics {
let host = Host::new()?;
let timestamp = SystemTime::now();
let revision = cmd!("git rev-parse HEAD").read()?;
Ok(Metrics { host, timestamp, revision, metrics: BTreeMap::new() })
let perf_revision = "c52ee623e231e7690a93be88d943016968c1036b".into();
Ok(Metrics { host, timestamp, revision, perf_revision, metrics: BTreeMap::new() })
}

fn report(&mut self, name: &str, value: u64, unit: Unit) {
Expand All @@ -141,6 +144,7 @@ impl Metrics {
let timestamp = self.timestamp.duration_since(UNIX_EPOCH).unwrap();
obj.number("timestamp", timestamp.as_secs() as f64);
obj.string("revision", &self.revision);
obj.string("perf_revision", &self.perf_revision);
let mut metrics = obj.object("metrics");
for (k, (value, unit)) in &self.metrics {
metrics.array(k).number(*value as f64).string(unit);
Expand Down