-
Notifications
You must be signed in to change notification settings - Fork 165
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
new(ci): added perf CI job around scap file read. #1924
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,52 +30,78 @@ jobs: | |
mkdir -p build | ||
cd build && cmake -DUSE_BUNDLED_DEPS=False ../ | ||
make unit-test-libsinsp -j4 | ||
make sinsp-example -j4 | ||
|
||
- name: Run Perf | ||
- name: Run Perf - unit tests | ||
shell: bash | ||
run: | | ||
cd build | ||
sudo perf record --call-graph dwarf -o perf.data -q libsinsp/test/unit-test-libsinsp | ||
sudo perf record --call-graph dwarf -o perf_tests.data -q libsinsp/test/unit-test-libsinsp | ||
|
||
- name: Run Perf - scap file | ||
shell: bash | ||
run: | | ||
cd build | ||
wget https://download.falco.org/fixtures/trace-files/traces-positive.zip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Download |
||
unzip traces-positive.zip | ||
sudo perf record --call-graph dwarf -o perf_scap.data -q ./libsinsp/examples/sinsp-example -s traces-positive/falco-event-generator.scap | ||
|
||
- name: Archive master perf report | ||
if: github.event_name == 'push' | ||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | ||
with: | ||
name: perf_report | ||
retention-days: 30 # 30 days because this is the artifact on master; we need to retain it to be able to properly diff it | ||
path: build/perf.data | ||
path: build/perf_*.data | ||
if-no-files-found: error | ||
|
||
- name: Download latest master report | ||
if: github.event_name == 'pull_request' | ||
uses: dawidd6/action-download-artifact@v6 | ||
with: | ||
workflow: ci.yml | ||
workflow: perf.yml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same fix made in last commit of #1910 |
||
branch: master | ||
event: push | ||
name: perf_report | ||
|
||
- name: Diff from master | ||
- name: Diff from master - unit tests | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
sudo perf diff perf.data build/perf.data -d unit-test-libsinsp -b -o 0 --percentage relative -q &> perf_diff.txt | ||
sudo perf diff perf_tests.data build/perf_tests.data -d unit-test-libsinsp -b -o 1 --percentage relative -q &> perf_tests_diff.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switched to |
||
|
||
- name: Diff from master - scap file | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
sudo perf diff perf_scap.data build/perf_scap.data -d sinsp-example -b -o 1 --percentage relative -q &> perf_scap_diff.txt | ||
|
||
- name: Archive perf diff | ||
if: github.event_name == 'pull_request' | ||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | ||
with: | ||
name: perf_diff | ||
path: perf_diff.txt | ||
path: perf_*_diff.txt | ||
if-no-files-found: error | ||
|
||
# Check will fail if there is any function slowed down >2% | ||
# But we will always comment with the perf diff from master | ||
- name: Check > 2% threshold | ||
- name: Check > 2% threshold - unit tests | ||
if: github.event_name == 'pull_request' | ||
id: compare | ||
id: compare_tests | ||
run: | | ||
echo "comment_file=perf_diff.txt" >> $GITHUB_OUTPUT | ||
awk '{if (substr($2,RSTART+RLENGTH)+0 > 2) print }' perf_diff.txt &> perf_diff_above_thresh.txt | ||
echo "diff=perf_tests_diff.txt" >> $GITHUB_OUTPUT | ||
awk '{if (substr($2,RSTART+RLENGTH)+0 > 2) print }' perf_tests_diff.txt &> perf_diff_above_thresh.txt | ||
if [ -s perf_diff_above_thresh.txt ]; then | ||
exit 1 | ||
fi | ||
|
||
# Check will fail if there is any function slowed down >2% | ||
# But we will always comment with the perf diff from master | ||
- name: Check > 2% threshold - scap file | ||
if: github.event_name == 'pull_request' | ||
id: compare_scap | ||
run: | | ||
echo "diff=perf_scap_diff.txt" >> $GITHUB_OUTPUT | ||
awk '{if (substr($2,RSTART+RLENGTH)+0 > 2) print }' perf_scap_diff.txt &> perf_diff_above_thresh.txt | ||
if [ -s perf_diff_above_thresh.txt ]; then | ||
exit 1 | ||
fi | ||
|
@@ -86,9 +112,14 @@ jobs: | |
mkdir -p ./pr | ||
echo ${{ github.event.number }} > ./pr/NR | ||
touch ./pr/COMMENT | ||
echo "# Perf diff from master" >> ./pr/COMMENT | ||
echo "# Perf diff from master - unit tests" >> ./pr/COMMENT | ||
echo "\`\`\`" >> ./pr/COMMENT | ||
head -n10 "${{ steps.compare_tests.outputs.diff }}" >> ./pr/COMMENT | ||
echo "\`\`\`" >> ./pr/COMMENT | ||
echo "" >> ./pr/COMMENT | ||
echo "# Perf diff from master - scap file" >> ./pr/COMMENT | ||
echo "\`\`\`" >> ./pr/COMMENT | ||
cat "${{ steps.compare.outputs.comment_file }}" >> ./pr/COMMENT | ||
head -n10 "${{ steps.compare_scap.outputs.diff }}" >> ./pr/COMMENT | ||
echo "\`\`\`" >> ./pr/COMMENT | ||
echo Uploading PR info... | ||
cat ./pr/COMMENT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build sinsp-example too