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

Add benchmarking CI that generates graphs on updates to master #530

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

jprider63
Copy link
Collaborator

This PR adds a CI workflow that generates performance graphs on every update to master. It stores the data as json in the gh-pages branch and renders the graphs on a Github Page. Here's an example of what this looks like with dummy data.

This currently runs cn on all the (successful) .c files in the test suite. Eventually, we probably want to make a proper benchmark suite using something like Core_bench.

Before this is merged, someone with permission needs to create a branch called gh-pages with empty contents. You can do this by grabbing the branch gh-pages-init from our fork and pushing to gh-pages in this repository.

Implements part of rems-project/cn-tutorial/issues/54.

Copy link
Contributor

@dc-mak dc-mak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we envision this being updated and getting more complicated, then it would be worth considering a Python or OCaml script, but this is quite useful to have sooner than later so I'm willing to merge now and get the highlighted changes later.

Also consider using https://www.shellcheck.net/

tests/run-ci-benchmarks.sh Outdated Show resolved Hide resolved
tests/run-ci-benchmarks.sh Outdated Show resolved Hide resolved
tests/run-ci-benchmarks.sh Outdated Show resolved Hide resolved
Comment on lines 13 to 16
COUNT=0
for TEST in ${SUCC}; do
let COUNT=${COUNT}+1
done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LEN=${#SUCC[@]}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent a while attempting to get this to work without success. I don't think it's a proper array although I don't know bash that well.

I'm inclined to leave the script as is for now and switch to a proper benchmarking system later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine (the issue is that there needs to be an extra pair of parens on the rhs of the defining TESTS).

tests/run-ci-benchmarks.sh Outdated Show resolved Hide resolved
INDEX=0
echo $SUCC
echo $COUNT
for TEST in ${SUCC}; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can iterate through the keys: http://stackoverflow.com/questions/3112687/ddg#3113285 so INDEX is unnecessary.

Comment on lines +28 to +46
# If we're last, don't print a trailing comma.
if [[ ${INDEX} -eq ${COUNT}-1 ]]; then
# Hack to output JSON.
cat << EOF >> ${JSON_FILE}
{
"name": "${TEST}",
"unit": "Seconds",
"value": ${TIME}
}
EOF
else
cat << EOF >> ${JSON_FILE}
{
"name": "${TEST}",
"unit": "Seconds",
"value": ${TIME}
},
EOF
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps printf and a variable for the last comma would reduce code duplication here.

tests/run-ci-benchmarks.sh Outdated Show resolved Hide resolved
tests/run-ci-benchmarks.sh Outdated Show resolved Hide resolved
@dc-mak dc-mak merged commit b35c309 into rems-project:master Aug 27, 2024
2 checks passed
@jprider63
Copy link
Collaborator Author

Something is still broken with the failing tests. I'm working on debugging it.

@jprider63
Copy link
Collaborator Author

@dc-mak Are you able to reopen this or should I create a new PR? I just pushed 3a1c0bb to this branch, which should fix the issue. I'm currently running it on our fork here so we'll see if that passes.

@jprider63
Copy link
Collaborator Author

FYI it passed on our fork.

@dc-mak
Copy link
Contributor

dc-mak commented Aug 28, 2024

I'm not able to do anything on this PR, so a new one will be needed.
For future PRs, please mark as draft until ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants