diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-16 19:36:55 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-16 19:36:55 +0000 |
commit | 9caeef98e3ba80c370f08b43f1317bd12ecd5504 (patch) | |
tree | 6992372cb752fc922dc851b723ff1e31923f2946 /xtask/src | |
parent | 9375207461dc69d622ecc46e924be70c08339d33 (diff) | |
parent | 81a2eaa92a221f754455e3abd0ec3939ae06cafe (diff) |
Merge #8042
8042: Add perf_revision to benchmark results r=lnicola a=d2weber
I gave it a try to add the hash as described in #8031
Feel free to tell me if there is something I could improve.
Co-authored-by: Douglas Weber <[email protected]>
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/metrics.rs | 8 |
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); |