aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorDouglas Weber <[email protected]>2021-03-15 21:21:02 +0000
committerDouglas Weber <[email protected]>2021-03-15 21:21:02 +0000
commit81a2eaa92a221f754455e3abd0ec3939ae06cafe (patch)
tree1e6a9e3ae15b175bf75ddb573bbce83100bb6824 /xtask/src
parentc0a2b4e826e1da20d3cfa8c279fcdffa24f32a7d (diff)
Add perf_revision to benchmark results
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/metrics.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs
index 3d8d7589b..97395738b 100644
--- a/xtask/src/metrics.rs
+++ b/xtask/src/metrics.rs
@@ -26,7 +26,8 @@ impl flags::Metrics {
26 } 26 }
27 { 27 {
28 let _d = pushd("./target/rustc-perf")?; 28 let _d = pushd("./target/rustc-perf")?;
29 cmd!("git reset --hard c52ee623e231e7690a93be88d943016968c1036b").run()?; 29 let revision = &metrics.perf_revision;
30 cmd!("git reset --hard {revision}").run()?;
30 } 31 }
31 32
32 let _env = pushenv("RA_METRICS", "1"); 33 let _env = pushenv("RA_METRICS", "1");
@@ -108,6 +109,7 @@ struct Metrics {
108 host: Host, 109 host: Host,
109 timestamp: SystemTime, 110 timestamp: SystemTime,
110 revision: String, 111 revision: String,
112 perf_revision: String,
111 metrics: BTreeMap<String, (u64, Unit)>, 113 metrics: BTreeMap<String, (u64, Unit)>,
112} 114}
113 115
@@ -123,7 +125,8 @@ impl Metrics {
123 let host = Host::new()?; 125 let host = Host::new()?;
124 let timestamp = SystemTime::now(); 126 let timestamp = SystemTime::now();
125 let revision = cmd!("git rev-parse HEAD").read()?; 127 let revision = cmd!("git rev-parse HEAD").read()?;
126 Ok(Metrics { host, timestamp, revision, metrics: BTreeMap::new() }) 128 let perf_revision = "c52ee623e231e7690a93be88d943016968c1036b".into();
129 Ok(Metrics { host, timestamp, revision, perf_revision, metrics: BTreeMap::new() })
127 } 130 }
128 131
129 fn report(&mut self, name: &str, value: u64, unit: Unit) { 132 fn report(&mut self, name: &str, value: u64, unit: Unit) {
@@ -141,6 +144,7 @@ impl Metrics {
141 let timestamp = self.timestamp.duration_since(UNIX_EPOCH).unwrap(); 144 let timestamp = self.timestamp.duration_since(UNIX_EPOCH).unwrap();
142 obj.number("timestamp", timestamp.as_secs() as f64); 145 obj.number("timestamp", timestamp.as_secs() as f64);
143 obj.string("revision", &self.revision); 146 obj.string("revision", &self.revision);
147 obj.string("perf_revision", &self.perf_revision);
144 let mut metrics = obj.object("metrics"); 148 let mut metrics = obj.object("metrics");
145 for (k, (value, unit)) in &self.metrics { 149 for (k, (value, unit)) in &self.metrics {
146 metrics.array(k).number(*value as f64).string(unit); 150 metrics.array(k).number(*value as f64).string(unit);