@@ -45,7 +45,7 @@ pub async fn handle_triage(
45
45
let mut before = start. clone ( ) ;
46
46
47
47
let mut num_comparisons = 0 ;
48
- let metric = Metric :: Instructions ;
48
+ let metric = Metric :: InstructionsUser ;
49
49
let benchmark_map = ctxt. get_benchmark_category_map ( ) . await ;
50
50
loop {
51
51
let comparison =
@@ -180,34 +180,48 @@ async fn populate_report(
180
180
}
181
181
}
182
182
183
+ /// This enum contains all "known" metrics coming from rustc or profiling tools that we know
184
+ /// (and care) about.
183
185
#[ derive( Copy , Clone , Debug , PartialEq , Serialize , Deserialize ) ]
184
186
pub enum Metric {
185
- #[ serde( rename = "instructions:u" ) ]
186
- Instructions ,
187
+ #[ serde( rename = "context-switches" ) ]
188
+ ContextSwitches ,
189
+ #[ serde( rename = "cpu-clock" ) ]
190
+ CpuClock ,
191
+ #[ serde( rename = "cpu-clock:u" ) ]
192
+ CpuClockUser ,
187
193
#[ serde( rename = "cycles:u" ) ]
188
- Cycles ,
194
+ CyclesUser ,
189
195
#[ serde( rename = "faults" ) ]
190
196
Faults ,
197
+ #[ serde( rename = "faults:u" ) ]
198
+ FaultsUser ,
199
+ #[ serde( rename = "instructions:u" ) ]
200
+ InstructionsUser ,
191
201
#[ serde( rename = "max-rss" ) ]
192
202
MaxRSS ,
193
203
#[ serde( rename = "task-clock" ) ]
194
204
TaskClock ,
205
+ #[ serde( rename = "task-clock:u" ) ]
206
+ TaskClockUser ,
195
207
#[ serde( rename = "wall-time" ) ]
196
208
WallTime ,
197
- #[ serde( rename = "cpu-clock" ) ]
198
- CpuClock ,
199
209
}
200
210
201
211
impl Metric {
202
- pub fn as_str ( & self ) -> & ' static str {
212
+ pub fn as_str ( & self ) -> & str {
203
213
match self {
204
- Self :: Instructions => "instructions:u" ,
205
- Self :: Cycles => "cycles:u" ,
206
- Self :: Faults => "faults" ,
207
- Self :: MaxRSS => "max-rss" ,
208
- Self :: TaskClock => "task-clock" ,
209
- Self :: WallTime => "wall-time" ,
210
- Self :: CpuClock => "cpu-clock" ,
214
+ Metric :: ContextSwitches => "context-switches" ,
215
+ Metric :: CpuClock => "cpu-clock" ,
216
+ Metric :: CpuClockUser => "cpu-clock:u" ,
217
+ Metric :: CyclesUser => "cycles:u" ,
218
+ Metric :: Faults => "faults" ,
219
+ Metric :: FaultsUser => "faults:u" ,
220
+ Metric :: InstructionsUser => "instructions:u" ,
221
+ Metric :: MaxRSS => "max-rss" ,
222
+ Metric :: TaskClock => "task-clock" ,
223
+ Metric :: TaskClockUser => "task-clock:u" ,
224
+ Metric :: WallTime => "wall-time" ,
211
225
}
212
226
}
213
227
@@ -232,8 +246,9 @@ impl Metric {
232
246
}
233
247
}
234
248
249
+ /// Currently, we conservatively consider everything except instructions to be noisy.
235
250
fn is_typically_noisy ( & self ) -> bool {
236
- !matches ! ( self , Self :: Instructions )
251
+ !matches ! ( self , Self :: InstructionsUser )
237
252
}
238
253
}
239
254
@@ -1484,6 +1499,24 @@ mod tests {
1484
1499
) ;
1485
1500
}
1486
1501
1502
+ #[ test]
1503
+ fn parse_metric_instructions ( ) {
1504
+ let metric: Metric = serde_json:: from_str ( r#""instructions:u""# ) . unwrap ( ) ;
1505
+ assert ! ( matches!( metric, Metric :: InstructionsUser ) ) ;
1506
+ }
1507
+
1508
+ #[ test]
1509
+ fn parse_metric_cycles ( ) {
1510
+ let metric: Metric = serde_json:: from_str ( r#""cycles:u""# ) . unwrap ( ) ;
1511
+ assert ! ( matches!( metric, Metric :: CyclesUser ) ) ;
1512
+ }
1513
+
1514
+ #[ test]
1515
+ fn parse_metric_max_rss ( ) {
1516
+ let metric: Metric = serde_json:: from_str ( r#""max-rss""# ) . unwrap ( ) ;
1517
+ assert ! ( matches!( metric, Metric :: MaxRSS ) ) ;
1518
+ }
1519
+
1487
1520
// (category, before, after)
1488
1521
fn check_table ( values : Vec < ( Category , f64 , f64 ) > , expected : & str ) {
1489
1522
let mut primary_comparisons = HashSet :: new ( ) ;
@@ -1499,7 +1532,7 @@ mod tests {
1499
1532
benchmark : index. to_string ( ) . as_str ( ) . into ( ) ,
1500
1533
profile : Profile :: Check ,
1501
1534
scenario : Scenario :: Empty ,
1502
- metric : Metric :: Instructions ,
1535
+ metric : Metric :: InstructionsUser ,
1503
1536
historical_data : None ,
1504
1537
results : ( before, after) ,
1505
1538
} ) ;
0 commit comments