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

cleanup(sinsp): create new methods to handle syscall return values #2139

Merged
merged 9 commits into from
Nov 8, 2024

Conversation

Andreagit97
Copy link
Member

@Andreagit97 Andreagit97 commented Oct 30, 2024

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area libscap

/area libsinsp

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

create new methods to handle syscall return values.

This should allow us to easily handle return types on 32 bits and 64 bits in the future

I suggest to review it commit by commit

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 83.09859% with 12 lines in your changes missing coverage. Please review.

Project coverage is 74.77%. Comparing base (aeea096) to head (55f8625).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/event.h 66.66% 5 Missing ⚠️
userspace/libsinsp/parsers.cpp 93.02% 3 Missing ⚠️
userspace/libsinsp/sinsp_filtercheck_event.cpp 72.72% 3 Missing ⚠️
userspace/libsinsp/sinsp_debug/sinsp_debug.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2139      +/-   ##
==========================================
- Coverage   74.79%   74.77%   -0.03%     
==========================================
  Files         254      254              
  Lines       33510    33505       -5     
  Branches     5739     5714      -25     
==========================================
- Hits        25065    25053      -12     
+ Misses       8426     8421       -5     
- Partials       19       31      +12     
Flag Coverage Δ
libsinsp 74.77% <83.09%> (-0.03%) ⬇️

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.

Copy link

github-actions bot commented Nov 7, 2024

Perf diff from master - unit tests

     5.08%     +1.37%  [.] sinsp_evt::get_type
     5.41%     -1.35%  [.] next
     8.35%     -1.19%  [.] sinsp::next
     0.59%     +1.11%  [.] libsinsp::sinsp_suppress::process_event
     3.80%     -0.64%  [.] sinsp_evt::load_params
     0.59%     +0.48%  [.] std::vector<sinsp_evt_param, std::allocator<sinsp_evt_param> >::emplace_back<sinsp_evt*, unsigned int&, char const*, unsigned long&>
     1.50%     -0.41%  [.] libsinsp::events::is_unknown_event
     1.55%     +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.29%     +0.40%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     0.85%     -0.40%  [.] sinsp_evt::get_direction

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

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                         Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                            +0.0007         +0.0007           140           140           140           140
BM_sinsp_split_median                                          -0.0023         -0.0023           140           140           140           140
BM_sinsp_split_stddev                                          +0.1690         +0.1689             1             1             1             1
BM_sinsp_split_cv                                              +0.1682         +0.1681             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0040         +0.0040            57            57            57            57
BM_sinsp_concatenate_paths_relative_path_median                -0.0110         -0.0110            57            56            57            56
BM_sinsp_concatenate_paths_relative_path_stddev                +4.6043         +4.6036             0             1             0             1
BM_sinsp_concatenate_paths_relative_path_cv                    +4.5820         +4.5814             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0441         +0.0441            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0443         +0.0444            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.4693         -0.4720             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.4917         -0.4943             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0063         +0.0063            55            56            55            56
BM_sinsp_concatenate_paths_absolute_path_median                +0.0047         +0.0047            55            56            55            56
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.7129         +0.7140             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.7022         +0.7033             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0172         +0.0172           383           390           383           390
BM_sinsp_split_container_image_median                          +0.0144         +0.0144           384           389           384           389
BM_sinsp_split_container_image_stddev                          -0.3388         -0.3385             4             2             4             2
BM_sinsp_split_container_image_cv                              -0.3500         -0.3497             0             0             0             0

Comment on lines 683 to 685
bool has_return_value();

int64_t get_syscall_return_value();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we inline them?

Copy link
Member Author

@Andreagit97 Andreagit97 Nov 8, 2024

Choose a reason for hiding this comment

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

can we do it in a follow-up? I've already other PRs on top of this, if it is an issue i can do it know

Copy link
Member Author

Choose a reason for hiding this comment

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

oh i see that i need a rebase, so ok!

Copy link
Member Author

Choose a reason for hiding this comment

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

in order to inline them I add to create a new helper method is_syscall_event, since we are inlining it we cannot call a not inline method from another cpp file

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 Nov 8, 2024

LGTM label has been added.

Git tree hash: 31cc6865cc2f07c877e2fa7636dbfd3e0c535bb5

@poiana
Copy link
Contributor

poiana commented Nov 8, 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 0e177db into falcosecurity:master Nov 8, 2024
48 of 49 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