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