@@ -58,6 +58,7 @@ def compare_command_logic(args):
5858 )
5959 )
6060 profilers_artifacts_matrix = []
61+ detected_regressions = []
6162 for test_name in test_names :
6263
6364 test_name = test_name .decode ()
@@ -99,25 +100,35 @@ def compare_command_logic(args):
99100 except redis .exceptions .ResponseError :
100101 pass
101102 percentage_change = "N/A"
103+ percentage_change = 0.0
102104 if baseline_v != "N/A" and comparison_v != "N/A" :
103105 if metric_mode == "higher-better" :
104- percentage_change = "{0:.2f} %" . format (
105- ( float (comparison_v ) / float (baseline_v ) - 1 ) * 100.0
106- )
106+ percentage_change = (
107+ float (comparison_v ) / float (baseline_v ) - 1
108+ ) * 100.0
107109 else :
108110 # lower-better
109- percentage_change = "{0:.2f} %" . format (
110- ( float (baseline_v ) / float (comparison_v ) - 1 ) * 100.0
111- )
111+ percentage_change = (
112+ float (baseline_v ) / float (comparison_v ) - 1
113+ ) * 100.0
112114 if baseline_v != "N/A" or comparison_v != "N/A" :
113- profilers_artifacts_matrix .append (
114- [
115- test_name ,
116- baseline_v ,
117- comparison_v ,
118- percentage_change ,
119- ]
120- )
115+ detected_regression = False
116+ if (
117+ percentage_change < 0.0
118+ and percentage_change < - args .regressions_percent_lower_limit
119+ ):
120+ detected_regression = True
121+ detected_regressions .append (test_name )
122+ if args .print_regressions_only is False or detected_regression :
123+ profilers_artifacts_matrix .append (
124+ [
125+ test_name ,
126+ baseline_v ,
127+ comparison_v ,
128+ percentage_change ,
129+ ]
130+ )
131+
121132 logging .info ("Printing differential analysis between branches" )
122133
123134 writer = MarkdownTableWriter (
@@ -133,3 +144,15 @@ def compare_command_logic(args):
133144 value_matrix = profilers_artifacts_matrix ,
134145 )
135146 writer .write_table ()
147+ total_regressions = len (detected_regressions )
148+ if total_regressions > 0 :
149+ logging .warning (
150+ "Detected a total of {} regressions. Printing BENCHMARK env var compatible list" .format (
151+ total_regressions
152+ )
153+ )
154+ logging .warning (
155+ "BENCHMARK={}" .format (
156+ "," .join (["{}.yml" .format (x ) for x in detected_regressions ])
157+ )
158+ )
0 commit comments