@@ -45,7 +45,7 @@ pub async fn handle_triage(
4545 let mut before = start. clone ( ) ;
4646
4747 let mut num_comparisons = 0 ;
48- let metric = Metric :: Instructions ;
48+ let metric = Metric :: InstructionsUser ;
4949 let benchmark_map = ctxt. get_benchmark_category_map ( ) . await ;
5050 loop {
5151 let comparison =
@@ -180,34 +180,48 @@ async fn populate_report(
180180 }
181181}
182182
183+ /// This enum contains all "known" metrics coming from rustc or profiling tools that we know
184+ /// (and care) about.
183185#[ derive( Copy , Clone , Debug , PartialEq , Serialize , Deserialize ) ]
184186pub 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 ,
187193 #[ serde( rename = "cycles:u" ) ]
188- Cycles ,
194+ CyclesUser ,
189195 #[ serde( rename = "faults" ) ]
190196 Faults ,
197+ #[ serde( rename = "faults:u" ) ]
198+ FaultsUser ,
199+ #[ serde( rename = "instructions:u" ) ]
200+ InstructionsUser ,
191201 #[ serde( rename = "max-rss" ) ]
192202 MaxRSS ,
193203 #[ serde( rename = "task-clock" ) ]
194204 TaskClock ,
205+ #[ serde( rename = "task-clock:u" ) ]
206+ TaskClockUser ,
195207 #[ serde( rename = "wall-time" ) ]
196208 WallTime ,
197- #[ serde( rename = "cpu-clock" ) ]
198- CpuClock ,
199209}
200210
201211impl Metric {
202- pub fn as_str ( & self ) -> & ' static str {
212+ pub fn as_str ( & self ) -> & str {
203213 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" ,
211225 }
212226 }
213227
@@ -232,8 +246,9 @@ impl Metric {
232246 }
233247 }
234248
249+ /// Currently, we conservatively consider everything except instructions to be noisy.
235250 fn is_typically_noisy ( & self ) -> bool {
236- !matches ! ( self , Self :: Instructions )
251+ !matches ! ( self , Self :: InstructionsUser )
237252 }
238253}
239254
@@ -1484,6 +1499,24 @@ mod tests {
14841499 ) ;
14851500 }
14861501
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+
14871520 // (category, before, after)
14881521 fn check_table ( values : Vec < ( Category , f64 , f64 ) > , expected : & str ) {
14891522 let mut primary_comparisons = HashSet :: new ( ) ;
@@ -1499,7 +1532,7 @@ mod tests {
14991532 benchmark : index. to_string ( ) . as_str ( ) . into ( ) ,
15001533 profile : Profile :: Check ,
15011534 scenario : Scenario :: Empty ,
1502- metric : Metric :: Instructions ,
1535+ metric : Metric :: InstructionsUser ,
15031536 historical_data : None ,
15041537 results : ( before, after) ,
15051538 } ) ;
0 commit comments