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

chore: add CMakePresets.json file #1986

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

Andreagit97
Copy link
Member

@Andreagit97 Andreagit97 commented Aug 1, 2024

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area build

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

These days I'm building scap drivers tests over several machines and every time I need to type an infinite cmake to configure them (getting it wrong every time). If you are like me this CMakePresets.json file should help you. Configure drivers test should be as simple as:

cmake --presets scap-drivers

Then to build different targets you should enter the directory created for you by the preset and run the make command`

cd build-scap-drivers
make drivers_test
make scap-open
make libscap_test
...

Here I provide just 2 presets that I often use while developing, i hope this could be useful to other folks who build libs every day

Which issue(s) this PR fixes:

Special notes for your reviewer:

You can read more on presets usage here https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html

Does this PR introduce a user-facing change?:

NONE

@Andreagit97
Copy link
Member Author

I upstreamed these 2 presets because I think they could be widely used, if not, I will keep them locally inside my CMakeUserPresets.json with no issues!

@Andreagit97 Andreagit97 added this to the 0.18.0 milestone Aug 1, 2024
Copy link

github-actions bot commented Aug 1, 2024

Perf diff from master - unit tests

     1.63%     +1.26%  [.] scap_event_decode_params
     4.32%     +1.17%  [.] sinsp_evt::load_params
     8.11%     +1.05%  [.] sinsp::next
     3.30%     -0.84%  [.] sinsp_thread_manager::get_thread_ref
     9.19%     +0.71%  [.] sinsp_parser::reset
     5.35%     -0.60%  [.] sinsp_parser::process_event
     0.65%     +0.51%  [.] sinsp_utils::find_longest_matching_evt_param
     1.27%     -0.41%  [.] libsinsp::events::is_unknown_event
     1.69%     +0.41%  [.] std::_Hashtable<long, std::pair<long const, std::shared_ptr<sinsp_threadinfo> >, std::allocator<std::pair<long const, std::shared_ptr<sinsp_threadinfo> > >, std::__detail::_Select1st, std::equal_to<long>, std::hash<long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node
     1.32%     -0.41%  [.] sinsp_evt::get_ts

Perf diff from master - scap file

     5.58%     +7.41%  [.] sinsp_filter_check_event::extract_single
     2.84%     +5.16%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     8.52%     -3.52%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>
     7.46%     -2.86%  [.] sinsp_filter_check_container::extract_single
     6.00%     -1.99%  [.] scap_event_decode_params
     2.85%     +1.86%  [.] rawstring_check::extract_single
     5.70%     +1.81%  [.] sinsp_filter_check::tostring
     2.47%     +1.60%  [.] sinsp_split[abi:cxx11]
    12.70%     -0.68%  [.] sinsp_evt_formatter::tostring_withformat
    12.40%     -0.65%  [.] next

Heap diff from master - unit tests

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

@Andreagit97
Copy link
Member Author

Now I don't have enough bandwidth but at a certain point we could also use these presets in our CI to avoid duplicates of CMake commands

Moreover, there are also build presets that a certain point we could add

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.98%. Comparing base (3ce0a2d) to head (2e857f3).
Report is 46 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1986    +/-   ##
========================================
  Coverage   50.98%   50.98%            
========================================
  Files         310      310            
  Lines       39612    39612            
  Branches    17793    17509   -284     
========================================
+ Hits        20197    20198     +1     
- Misses      14350    14356     +6     
+ Partials     5065     5058     -7     

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

@incertum
Copy link
Contributor

incertum commented Aug 8, 2024

I believe this is useful. Could other presets be useful? Or merge those first?

Copy link
Contributor

@incertum incertum left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Aug 8, 2024

LGTM label has been added.

Git tree hash: f3cde5cb90b88663b71cb2286a7f04603aff25c0

@Andreagit97
Copy link
Member Author

I believe this is useful. Could other presets be useful? Or merge those first?

I've no other presets to add ATM :/ I think we can add them incrementally if we find something that could be useful

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Aug 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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,incertum]

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 7207f61 into falcosecurity:master Aug 27, 2024
45 of 46 checks passed
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