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

new(ci,benchmarks): added more benchmarks and make use of them in perf CI #2023

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Aug 27, 2024

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area CI

Does this PR require a change in the driver versions?

What this PR does / why we need it:

Adds some more benchmarks (around sinsp concatenate_paths and split_container_image utils).
Moreover, it adds support for benchmark results in our perf CI.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@FedeDP
Copy link
Contributor Author

FedeDP commented Aug 27, 2024

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Aug 27, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The updated action now builds and runs benchmarks too. Then store the resulting json in its outputs.

@@ -37,6 +37,7 @@ jobs:
${{ steps.perf.outputs.perf_scap }}
${{ steps.perf.outputs.heaptrack_tests }}
${{ steps.perf.outputs.heaptrack_scap }}
${{ steps.perf.outputs.gbench_json }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pages CI will now upload also master gbench json too.

@@ -43,6 +43,25 @@ jobs:
run: |
sudo heaptrack_print heaptrack_scap.data.zst -d ${{ steps.perf.outputs.heaptrack_scap }} &> heaptrack_scap_diff.txt

- name: Diff from master - gbench
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The algorithm is as follows:

  • load all benchmarks present in master json
  • for each of them, take the master real_time value
  • for each of them, take the PR's head real_time value
  • if PR's head does not have the benchmark, skip it
  • compute the diff between head and master
  • compute the diff in percentage between head and master

Copy link
Member

Choose a reason for hiding this comment

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

Have you ever considered to use the compare.py tool https:/google/benchmark/blob/main/docs/tools.md#comparepy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Neat! I'll give it a look and eventually implement it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented, thanks!

@@ -75,6 +94,10 @@ jobs:
echo "\`\`\`" >> ./pr/COMMENT
tail -n3 "heaptrack_scap_diff.txt" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
echo "# Benchmarks diff from master" >> ./pr/COMMENT
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the PERF comment, echo the full benchmark diffs.

@@ -135,3 +158,14 @@ jobs:
if [ -s heaptrack_scap_diff_above_thresh.txt ]; then
exit 2
fi

# Check will fail if there any google benchmark is slowed more than 5%
- name: Check >= 5% slowdown on google benchmarks
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For every benchmark in our diff, check if diff in percentage is above 5% and eventually trigger a failure.

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.20%. Comparing base (c7d7530) to head (c78d9a6).
Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2023   +/-   ##
=======================================
  Coverage   74.20%   74.20%           
=======================================
  Files         253      253           
  Lines       30832    30832           
  Branches     5411     5393   -18     
=======================================
  Hits        22880    22880           
+ Misses       7952     7941   -11     
- Partials        0       11   +11     
Flag Coverage Δ
libsinsp 74.20% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FedeDP
Copy link
Contributor Author

FedeDP commented Aug 27, 2024

Note: perf CI will fail because master report has no gbench_data.json file of course, since it will be firstly pushed when this PR is merged.

EDIT: indeed:

jq: error: Could not open file gbench_data.json: No such file or directory

leogr
leogr previously approved these changes Aug 27, 2024
… value.

Instead, rely on the user running the benchmark to eventually provide `--benchmark_repetitions` CLI arg.
Provide `--benchmark_repetitions` CLI arg for perf CI.

Signed-off-by: Federico Di Pierro <[email protected]>

Co-authored-by: Andrea Terzolo <[email protected]>
@FedeDP
Copy link
Contributor Author

FedeDP commented Aug 27, 2024

This is now ready.

Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

Thank you!
/approve

@poiana
Copy link
Contributor

poiana commented Aug 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 827eef3 into master Aug 27, 2024
42 of 46 checks passed
@poiana poiana deleted the new/benchmarks branch August 27, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants