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): added an initial perf-related CI. #1918

Merged
merged 1 commit into from
Jun 20, 2024
Merged

new(ci): added an initial perf-related CI. #1918

merged 1 commit into from
Jun 20, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Jun 18, 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:

Split from #1910. Added a CI around perf tool.
For now, we only run libsinsp unit tests with perf. In the future we might want to add:

  • a run of sinsp-example against some scap files
  • tests with valgrind massif tool

Also, the new perf-libs-linux-amd64 check needs to be added to required status checks once we find a good enough threshold.

The CI will fail because it expects master CI to upload perf reports.
I will rebase #1910 once this is merged and expect the PR comment to be created.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

new(ci): added an initial perf-related CI.

@FedeDP
Copy link
Contributor Author

FedeDP commented Jun 18, 2024

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Jun 18, 2024
@poiana poiana added the size/L label Jun 18, 2024
@FedeDP
Copy link
Contributor Author

FedeDP commented Jun 18, 2024

/cc @jasondellaluce @leogr

@poiana poiana requested review from jasondellaluce and leogr June 18, 2024 12:26

jobs:
perf-libs-linux-amd64:
runs-on: [ "self-hosted", "linux", "X64" ]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use our own cncf node because:

  • we need full hw access for perf counters
  • we need hw to stay stable to be able to properly diff perf datas

cd build
sudo perf record --call-graph dwarf -o perf.data -q libsinsp/test/unit-test-libsinsp

- name: Archive master perf report
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On master, archive the perf data.

path: build/perf.data
if-no-files-found: error

- name: Download latest master report
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On PR, download latest master data and diff our just built perf.data with the master one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice


# 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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Threshold is set to >2%; we can later refine it.
A PR comment with full perf diff will always be added; useful for now for testing, but i think it is worth keeping it.

exit 1
fi

- name: Save PR info
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Last 2 steps are needed to be able to trigger create-comment workflow with all needed data.

jobs:
upload:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course this needs to run only when triggered from a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fi

- name: Save PR info
if: always() && github.event_name == 'pull_request'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if compare step above did fail, ie exit 1 was called because we are above threshold.

@incertum
Copy link
Contributor

@LucaGuerra could you review this? Thanks!

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.

/approve

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
Copy link
Member

Choose a reason for hiding this comment

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

probably 30 days is a little bit too much, usually, we merge at least a PR every day 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep but i was thinking about august :D

@poiana
Copy link
Contributor

poiana commented Jun 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [Andreagit97,FedeDP,leogr]

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 3c1264c into master Jun 20, 2024
39 of 41 checks passed
@poiana poiana deleted the new/perf_ci branch June 20, 2024 07:29
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.

5 participants