Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test benchmark #80

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions githooks/apps/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func mainRun() (exitCode int) {
if cm.IsBenchmark {
startTime := cm.GetStartTime()
defer func() {
log.InfoF("Runner execution time: '%v'.",
cm.GetDuration(startTime))
log.InfoF("Runner execution time: '%v' ms.",
float64(cm.GetDuration(startTime))/float64(time.Millisecond))
}()
}

Expand Down
2 changes: 1 addition & 1 deletion tests/exec-steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ echo "Tests dir: '$GH_TESTS'"

startT=$(date +%s)

for STEP in "$GH_TESTS"/step-*.sh; do
for STEP in "$GH_TESTS"/step-501.sh; do
STEP_NAME=$(basename "$STEP" | sed 's/.sh$//')
STEP_DESC=$(grep -m 1 -A 1 "Test:" "$STEP" | tail -1 | sed 's/#\s*//')

Expand Down
12 changes: 8 additions & 4 deletions tests/step-501.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ function runCommits() {
function calc() { awk "BEGIN{print $*}"; }

function average() {
local skip="$1"
local count=0
local total=0

local input
# Skip the first 3 runs, because it contains registration etc...
input=$(cat | grep "execution time:" | sed -E "s/.*'(.*)ms.*/\1/g" | sed -n '3d;p')
input=$(cat | grep "execution time:" | sed -E "s/.*'([0-9\.]+)'.*/\1/g")
# echo "$input"

# Skip the first `$skip` runs, because it contains registration etc...
[ -n "$skip" ] && input=$(echo "$input" | sed -n "1,$skip""d;p")

while IFS= read -r val; do
total=$(calc "$total" + "$val")
Expand All @@ -48,9 +52,9 @@ function average() {

time=$(calc "$total" / "$count")

echo "execution time: '$time""ms'"
echo "execution time: '$time' ms."
}

echo "Runtime average (no load): $(runCommits | average)"
echo "Runtime average (no load): $(runCommits | average 3)"

exit 250