@@ -87,22 +87,12 @@ impl<'a> BenchProcessor<'a> {
87
87
88
88
async fn insert_stats (
89
89
& mut self ,
90
+ collection : CollectionId ,
90
91
scenario : database:: Scenario ,
91
- profile : Profile ,
92
+ profile : database :: Profile ,
92
93
backend : CodegenBackend ,
93
94
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
+ ) {
106
96
let backend = match backend {
107
97
CodegenBackend :: Llvm => database:: CodegenBackend :: Llvm ,
108
98
CodegenBackend :: Cranelift => database:: CodegenBackend :: Cranelift ,
@@ -123,7 +113,6 @@ impl<'a> BenchProcessor<'a> {
123
113
}
124
114
125
115
while let Some ( ( ) ) = buf. next ( ) . await { }
126
- ( collection, profile)
127
116
}
128
117
129
118
pub async fn measure_rustc ( & mut self , toolchain : & Toolchain ) -> anyhow:: Result < ( ) > {
@@ -184,17 +173,30 @@ impl<'a> Processor for BenchProcessor<'a> {
184
173
database:: Scenario :: IncrementalPatch ( patch. name )
185
174
}
186
175
} ;
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 ;
190
186
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.
191
190
if let Some ( files) = res. 2 {
192
191
self . self_profiles . push ( RecordedSelfProfile {
193
- collection : collection_id ,
192
+ collection,
194
193
scenario,
195
194
profile,
196
195
files,
197
196
} ) ;
197
+ } else {
198
+ self . insert_stats ( collection, scenario, profile, data. backend , res. 0 )
199
+ . await ;
198
200
}
199
201
200
202
Ok ( Retry :: No )
0 commit comments