@@ -10,7 +10,7 @@ use crate::selector::{self, Tag};
10
10
11
11
use collector:: category:: Category ;
12
12
use collector:: Bound ;
13
- use serde:: Serialize ;
13
+ use serde:: { Deserialize , Serialize } ;
14
14
15
15
use std:: cmp:: Ordering ;
16
16
use std:: collections:: { HashMap , HashSet } ;
@@ -45,11 +45,11 @@ pub async fn handle_triage(
45
45
let mut before = start. clone ( ) ;
46
46
47
47
let mut num_comparisons = 0 ;
48
- let stat = "instructions:u" . to_owned ( ) ;
48
+ let stat = Stat :: Instructions ;
49
49
let benchmark_map = ctxt. get_benchmark_category_map ( ) . await ;
50
50
loop {
51
51
let comparison =
52
- match compare_given_commits ( before, next. clone ( ) , stat. clone ( ) , ctxt, & master_commits)
52
+ match compare_given_commits ( before, next. clone ( ) , stat, ctxt, & master_commits)
53
53
. await
54
54
. map_err ( |e| format ! ( "error comparing commits: {}" , e) ) ?
55
55
{
@@ -172,14 +172,46 @@ async fn populate_report(
172
172
( None , None ) => return ,
173
173
} ;
174
174
175
- let include_in_triage = deserves_attention ( & primary, & secondary) ;
175
+ let include_in_triage = deserves_attention_icount ( & primary, & secondary) ;
176
176
177
177
if include_in_triage {
178
178
let entry = report. entry ( direction) . or_default ( ) ;
179
179
entry. push ( write_triage_summary ( comparison, & primary, & secondary) . await ) ;
180
180
}
181
181
}
182
182
183
+ #[ derive( Copy , Clone , Debug , PartialEq , Serialize , Deserialize ) ]
184
+ pub enum Stat {
185
+ #[ serde( rename = "instructions:u" ) ]
186
+ Instructions ,
187
+ #[ serde( rename = "cycles:u" ) ]
188
+ Cycles ,
189
+ #[ serde( rename = "faults" ) ]
190
+ Faults ,
191
+ #[ serde( rename = "max-rss" ) ]
192
+ MaxRSS ,
193
+ #[ serde( rename = "task-clock" ) ]
194
+ TaskClock ,
195
+ #[ serde( rename = "wall-time" ) ]
196
+ WallTime ,
197
+ #[ serde( rename = "cpu-clock" ) ]
198
+ CpuClock ,
199
+ }
200
+
201
+ impl Stat {
202
+ pub fn as_str ( & self ) -> & ' static str {
203
+ 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" ,
211
+ }
212
+ }
213
+ }
214
+
183
215
/// A summary of a given comparison
184
216
///
185
217
/// This summary only includes changes that are significant and relevant (as determined by a change's magnitude).
@@ -367,7 +399,7 @@ impl ArtifactComparisonSummary {
367
399
///
368
400
/// For example, this can be used to determine if artifact comparisons with regressions should be labeled with the
369
401
/// `perf-regression` GitHub label or should be shown in the perf triage report.
370
- pub ( crate ) fn deserves_attention (
402
+ pub ( crate ) fn deserves_attention_icount (
371
403
primary : & ArtifactComparisonSummary ,
372
404
secondary : & ArtifactComparisonSummary ,
373
405
) -> bool {
@@ -384,6 +416,21 @@ pub(crate) fn deserves_attention(
384
416
}
385
417
}
386
418
419
+ pub ( crate ) fn deserves_attention_maxrss (
420
+ primary : & ArtifactComparisonSummary ,
421
+ secondary : & ArtifactComparisonSummary ,
422
+ ) -> bool {
423
+ let primary_big_changes = primary
424
+ . improvements ( )
425
+ . filter ( |comparison| comparison. magnitude ( ) >= Magnitude :: Large )
426
+ . count ( ) ;
427
+ let secondary_big_changes = secondary
428
+ . improvements ( )
429
+ . filter ( |comparison| comparison. magnitude ( ) >= Magnitude :: Large )
430
+ . count ( ) ;
431
+ primary_big_changes >= 10 || secondary_big_changes >= 20
432
+ }
433
+
387
434
async fn write_triage_summary (
388
435
comparison : & ArtifactComparison ,
389
436
primary : & ArtifactComparisonSummary ,
@@ -554,7 +601,7 @@ pub fn write_summary_table_footer(result: &mut String) {
554
601
pub async fn compare (
555
602
start : Bound ,
556
603
end : Bound ,
557
- stat : String ,
604
+ stat : Stat ,
558
605
ctxt : & SiteCtxt ,
559
606
) -> Result < Option < ArtifactComparison > , BoxedError > {
560
607
let master_commits = & ctxt. get_master_commits ( ) . commits ;
@@ -566,7 +613,7 @@ pub async fn compare(
566
613
async fn compare_given_commits (
567
614
start : Bound ,
568
615
end : Bound ,
569
- stat : String ,
616
+ stat : Stat ,
570
617
ctxt : & SiteCtxt ,
571
618
master_commits : & [ collector:: MasterCommit ] ,
572
619
) -> Result < Option < ArtifactComparison > , BoxedError > {
@@ -585,7 +632,7 @@ async fn compare_given_commits(
585
632
. set :: < String > ( Tag :: Benchmark , selector:: Selector :: All )
586
633
. set :: < String > ( Tag :: Scenario , selector:: Selector :: All )
587
634
. set :: < String > ( Tag :: Profile , selector:: Selector :: All )
588
- . set ( Tag :: Metric , selector:: Selector :: One ( stat. clone ( ) ) ) ;
635
+ . set ( Tag :: Metric , selector:: Selector :: One ( stat. as_str ( ) ) ) ;
589
636
590
637
// `responses` contains series iterators. The first element in the iterator is the data
591
638
// for `a` and the second is the data for `b`
@@ -832,7 +879,7 @@ impl HistoricalDataMap {
832
879
ctxt : & SiteCtxt ,
833
880
from : ArtifactId ,
834
881
master_commits : & [ collector:: MasterCommit ] ,
835
- stat : String ,
882
+ stat : Stat ,
836
883
) -> Result < Self , BoxedError > {
837
884
let mut historical_data = HashMap :: new ( ) ;
838
885
@@ -854,7 +901,7 @@ impl HistoricalDataMap {
854
901
. set :: < String > ( Tag :: Benchmark , selector:: Selector :: All )
855
902
. set :: < String > ( Tag :: Scenario , selector:: Selector :: All )
856
903
. set :: < String > ( Tag :: Profile , selector:: Selector :: All )
857
- . set ( Tag :: Metric , selector:: Selector :: One ( stat) ) ;
904
+ . set ( Tag :: Metric , selector:: Selector :: One ( stat. as_str ( ) ) ) ;
858
905
859
906
let mut previous_commit_series = ctxt
860
907
. statistic_series ( query, previous_commits. clone ( ) )
0 commit comments