@@ -22,12 +22,12 @@ compare_stat_p90() {
22
22
local current_value=" $2 "
23
23
local stat_name=" $3 "
24
24
25
- # Calculate 110 % of the past value
25
+ # Calculate 115 % of the past value
26
26
local threshold=$( calculate_threshold " $past_value " )
27
27
28
28
# Compare the current value with the threshold
29
- if (( $(awk 'BEGIN {print ("'" $current_value "'" > "'" $threshold "'")}' ) )) ; then
30
- echo " ERROR: $stat_name - Current P90 value ($current_value ) exceeds the 110 % threshold ($threshold ) of the past P90 value ($past_value )"
29
+ if (( $(echo " $current_value > $current_value " | bc - l ) )) ; then
30
+ echo " ERROR: $stat_name - Current P90 value ($current_value ) exceeds the 115 % threshold ($current_value ) of the past P90 value ($past_value )"
31
31
return 1
32
32
fi
33
33
@@ -36,7 +36,18 @@ compare_stat_p90() {
36
36
37
37
calculate_threshold () {
38
38
local past_value=" $1 "
39
- awk -v past=" $past_value " ' BEGIN { print past * 1.1 }'
39
+ awk -v past=" $past_value " ' BEGIN { print past * 1.15 }'
40
+ }
41
+
42
+ calculate_p90_after_skip () {
43
+ local times_array=" $1 "
44
+ local num_entries=$( echo " $times_array " | jq ' length' )
45
+ local times=$( echo " $times_array " | jq -r ' .[1:] | .[]' )
46
+ local sorted_times=$( echo " $times " | tr ' \n' ' ' | xargs -n1 | sort -g)
47
+ local index=$(( num_entries * 90 / 100 ))
48
+
49
+ local p90=$( echo " $sorted_times " | sed -n " ${index} p" )
50
+ echo " $p90 "
40
51
}
41
52
42
53
# Loop through each object in past.json and compare P90 values with current.json for all statistics
@@ -52,8 +63,10 @@ compare_p90_values() {
52
63
for test_name in $test_names ; do
53
64
echo " Checking for regression in '$test_name '"
54
65
for stat_name in " fullRunStats" " pullStats" " lazyTaskStats" " localTaskStats" ; do
55
- local past_p90=$( echo " $past_json " | jq -r --arg test " $test_name " ' .benchmarkTests[] | select(.testName == $test) | .' " $stat_name " ' .pct90' )
56
- local current_p90=$( echo " $current_json " | jq -r --arg test " $test_name " ' .benchmarkTests[] | select(.testName == $test) | .' " $stat_name " ' .pct90' )
66
+ local past_p90_array=$( echo " $past_json " | jq -r --arg test " $test_name " ' .benchmarkTests[] | select(.testName == $test) | .' " $stat_name " ' .BenchmarkTimes' )
67
+ local past_p90=$( calculate_p90_after_skip " $past_p90_array " )
68
+ local current_p90_array=$( echo " $current_json " | jq -r --arg test " $test_name " ' .benchmarkTests[] | select(.testName == $test) | .' " $stat_name " ' .BenchmarkTimes' )
69
+ local current_p90=$( calculate_p90_after_skip " $current_p90_array " )
57
70
58
71
# Call the compare_stat_p90 function
59
72
compare_stat_p90 " $past_p90 " " $current_p90 " " $stat_name " || regression_detected=1
@@ -64,8 +77,6 @@ compare_p90_values() {
64
77
return $regression_detected
65
78
}
66
79
67
- # ... (remaining code)
68
-
69
80
# Call compare_p90_values and store the exit code in a variable
70
81
compare_p90_values " $past_data " " $current_data "
71
82
exit_code=$?
0 commit comments