Skip to content

Commit 965ad78

Browse files
Reset to benchmarked artifact in rustc repo
Previously we reset to origin/master which isn't quite right
1 parent 7be4802 commit 965ad78

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

collector/src/execute.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ pub struct MeasureProcessor<'a> {
504504
rt: &'a mut Runtime,
505505
krate: &'a BenchmarkName,
506506
conn: &'a mut dyn database::Connection,
507+
artifact: &'a database::ArtifactId,
507508
cid: database::ArtifactIdNumber,
508509
upload: Option<Upload>,
509510
is_first_collection: bool,
@@ -516,6 +517,7 @@ impl<'a> MeasureProcessor<'a> {
516517
rt: &'a mut Runtime,
517518
conn: &'a mut dyn database::Connection,
518519
krate: &'a BenchmarkName,
520+
artifact: &'a database::ArtifactId,
519521
cid: database::ArtifactIdNumber,
520522
self_profile: bool,
521523
) -> Self {
@@ -528,6 +530,7 @@ impl<'a> MeasureProcessor<'a> {
528530
upload: None,
529531
conn,
530532
krate,
533+
artifact,
531534
cid,
532535
is_first_collection: true,
533536
// Command::new("summarize").status().is_ok()
@@ -773,7 +776,7 @@ impl<'a> Processor for MeasureProcessor<'a> {
773776
}
774777

775778
fn measure_rustc(&mut self, compiler: Compiler<'_>) -> anyhow::Result<()> {
776-
rustc::measure(self.rt, self.conn, compiler, self.cid)
779+
rustc::measure(self.rt, self.conn, compiler, self.artifact, self.cid)
777780
}
778781
}
779782

collector/src/execute/rustc.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
1010
use crate::Compiler;
1111
use anyhow::Context;
12+
use database::ArtifactId;
1213
use std::env;
1314
use std::{collections::HashMap, process::Command};
1415
use std::{path::Path, time::Duration};
@@ -18,6 +19,7 @@ pub fn measure(
1819
rt: &mut Runtime,
1920
conn: &mut dyn database::Connection,
2021
compiler: Compiler<'_>,
22+
artifact: &database::ArtifactId,
2123
aid: database::ArtifactIdNumber,
2224
) -> anyhow::Result<()> {
2325
checkout().context("checking out rust-lang/rust")?;
@@ -26,8 +28,8 @@ pub fn measure(
2628
// on. This should (hopefully) reduce variance. It's also a 2x bump in
2729
// compile times, but we can afford the extra 6 minutes (presuming it
2830
// actually benefits us).
29-
record(rt, conn, compiler, aid)?;
30-
record(rt, conn, compiler, aid)?;
31+
record(rt, conn, compiler, artifact, aid)?;
32+
record(rt, conn, compiler, artifact, aid)?;
3133

3234
Ok(())
3335
}
@@ -36,16 +38,20 @@ fn record(
3638
rt: &mut Runtime,
3739
conn: &mut dyn database::Connection,
3840
compiler: Compiler<'_>,
41+
artifact: &database::ArtifactId,
3942
aid: database::ArtifactIdNumber,
4043
) -> anyhow::Result<()> {
4144
let checkout = Path::new("rust");
4245
let status = Command::new("git")
4346
.current_dir("rust")
4447
.arg("reset")
4548
.arg("--hard")
46-
.arg("origin/master")
49+
.arg(match artifact {
50+
ArtifactId::Commit(c) => c.sha.as_str(),
51+
ArtifactId::Artifact(id) => id.as_str(),
52+
})
4753
.status()
48-
.context("git reset --hard origin/master")?;
54+
.context("git reset --hard")?;
4955
assert!(status.success(), "git reset --hard successful");
5056
let status = Command::new("git")
5157
.current_dir("rust")

collector/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ fn bench(
247247
rt,
248248
tx.conn(),
249249
&benchmark.name,
250+
&cid,
250251
interned_cid,
251252
self_profile,
252253
);

0 commit comments

Comments
 (0)