forked from ballerina-platform/ballerina-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perf_test.sh
executable file
·26 lines (19 loc) · 759 Bytes
/
perf_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Number of times to run the command
num_runs=10
# Initialize sum variable
sum=0
# Run the command multiple times
for ((i=1; i<=$num_runs; i++)); do
output=$(./gradlew :language-server:language-server-core:test --tests "org.ballerinalang.langserver.codeaction.CodeActionPerformanceTest") # Replace "your_command_here" with your actual command
response_time=$(echo "$output" | grep -oP 'actualResponseTime: \K\d+')
if [[ -n $response_time ]]; then
sum=$((sum + response_time))
echo "Run $i - actualResponseTime: $response_time"
else
echo "Run $i - actualResponseTime not found in output"
fi
done
# Calculate the average
average=$((sum / num_runs))
echo "Average actualResponseTime: $average"