Skip to content

Commit c2aa920

Browse files
authored
Merge pull request #1790 from Kobzol/self-profile-metrics
Do not store metrics from self-profile runs into the DB
2 parents 66faa28 + fbf2e06 commit c2aa920

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

collector/src/compile/execute/bencher.rs

+20-18
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,12 @@ impl<'a> BenchProcessor<'a> {
8787

8888
async fn insert_stats(
8989
&mut self,
90+
collection: CollectionId,
9091
scenario: database::Scenario,
91-
profile: Profile,
92+
profile: database::Profile,
9293
backend: CodegenBackend,
9394
stats: Stats,
94-
) -> (CollectionId, database::Profile) {
95-
let version = get_rustc_perf_commit();
96-
97-
let collection = self.conn.collection_id(&version).await;
98-
let profile = match profile {
99-
Profile::Check => database::Profile::Check,
100-
Profile::Debug => database::Profile::Debug,
101-
Profile::Doc => database::Profile::Doc,
102-
Profile::Opt => database::Profile::Opt,
103-
Profile::Clippy => database::Profile::Clippy,
104-
};
105-
95+
) {
10696
let backend = match backend {
10797
CodegenBackend::Llvm => database::CodegenBackend::Llvm,
10898
CodegenBackend::Cranelift => database::CodegenBackend::Cranelift,
@@ -123,7 +113,6 @@ impl<'a> BenchProcessor<'a> {
123113
}
124114

125115
while let Some(()) = buf.next().await {}
126-
(collection, profile)
127116
}
128117

129118
pub async fn measure_rustc(&mut self, toolchain: &Toolchain) -> anyhow::Result<()> {
@@ -184,17 +173,30 @@ impl<'a> Processor for BenchProcessor<'a> {
184173
database::Scenario::IncrementalPatch(patch.name)
185174
}
186175
};
187-
let (collection_id, profile) = self
188-
.insert_stats(scenario, data.profile, data.backend, res.0)
189-
.await;
176+
let profile = match data.profile {
177+
Profile::Check => database::Profile::Check,
178+
Profile::Debug => database::Profile::Debug,
179+
Profile::Doc => database::Profile::Doc,
180+
Profile::Opt => database::Profile::Opt,
181+
Profile::Clippy => database::Profile::Clippy,
182+
};
183+
184+
let version = get_rustc_perf_commit();
185+
let collection = self.conn.collection_id(&version).await;
190186

187+
// If the gathered metrics were produced with self profile enabled, then they
188+
// are not realistic. Do not store the metrics into the DB for self-profile
189+
// runs to avoid unnecessary DB storage.
191190
if let Some(files) = res.2 {
192191
self.self_profiles.push(RecordedSelfProfile {
193-
collection: collection_id,
192+
collection,
194193
scenario,
195194
profile,
196195
files,
197196
});
197+
} else {
198+
self.insert_stats(collection, scenario, profile, data.backend, res.0)
199+
.await;
198200
}
199201

200202
Ok(Retry::No)

0 commit comments

Comments
 (0)