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: simplify some extract logic in sinsp_filtercheck_fd.cpp #2137

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

Andreagit97
Copy link
Member

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area libsinsp

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

This PR cleans up some extraction logic. extract_from_null_fd was a too complex method for no reason.

I suggest reviewing it commit by commit.

This like other PRs I will open in the future should simplify this initiative #2068

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Use directly `extract_fdname_from_creator`, see next commits for a
further cleanup

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Copy link

Perf diff from master - unit tests

     5.18%     -1.24%  [.] sinsp_parser::process_event
     6.51%     +0.92%  [.] sinsp::next
     1.50%     -0.70%  [.] libsinsp::sinsp_suppress::process_event
     1.71%     -0.64%  [.] sinsp_parser::parse_context_switch
    10.10%     -0.60%  [.] sinsp_parser::reset
     2.08%     +0.48%  [.] scap_event_decode_params
     0.53%     +0.44%  [.] sinsp_evt::get_ts
     0.43%     +0.43%  [.] sinsp_threadinfo::sinsp_threadinfo
     0.32%     +0.40%  [.] sinsp_container_info::sinsp_container_info
     2.03%     -0.40%  [.] 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

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.0312         +0.0312           147           152           147           152
BM_sinsp_split_median                                          +0.0344         +0.0344           147           152           147           152
BM_sinsp_split_stddev                                          -0.3322         -0.3326             2             1             2             1
BM_sinsp_split_cv                                              -0.3524         -0.3527             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0115         +0.0115            57            57            57            57
BM_sinsp_concatenate_paths_relative_path_median                +0.0047         +0.0047            57            57            57            57
BM_sinsp_concatenate_paths_relative_path_stddev                +3.7902         +3.8037             0             1             0             1
BM_sinsp_concatenate_paths_relative_path_cv                    +3.7357         +3.7490             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0449         -0.0449            25            24            25            24
BM_sinsp_concatenate_paths_empty_path_median                   -0.0422         -0.0422            25            24            25            24
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.7969         -0.7968             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.7873         -0.7872             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0141         +0.0141            56            57            56            57
BM_sinsp_concatenate_paths_absolute_path_median                +0.0129         +0.0129            56            57            56            57
BM_sinsp_concatenate_paths_absolute_path_stddev                +2.4904         +2.4884             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +2.4418         +2.4398             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0119         -0.0119           396           391           396           391
BM_sinsp_split_container_image_median                          -0.0134         -0.0134           396           391           396           391
BM_sinsp_split_container_image_stddev                          +0.4117         +0.4095             1             2             1             2
BM_sinsp_split_container_image_cv                              +0.4287         +0.4264             0             0             0             0

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 31.11111% with 31 lines in your changes missing coverage. Please review.

Project coverage is 74.55%. Comparing base (0ec8bac) to head (2c5dad8).
Report is 33 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/event.h 0.00% 25 Missing ⚠️
userspace/libsinsp/sinsp_filtercheck_fd.cpp 70.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2137      +/-   ##
==========================================
+ Coverage   74.46%   74.55%   +0.09%     
==========================================
  Files         254      254              
  Lines       33333    33293      -40     
  Branches     5721     5715       -6     
==========================================
+ Hits        24820    24822       +2     
+ Misses       8490     8450      -40     
+ Partials       23       21       -2     
Flag Coverage Δ
libsinsp 74.55% <31.11%> (+0.09%) ⬆️

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.

@poiana poiana added the lgtm label Nov 8, 2024
@poiana
Copy link
Contributor

poiana commented Nov 8, 2024

LGTM label has been added.

Git tree hash: 3248a2cd3ecc8cd8b20d2932f93984a5b320eec0

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

[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 10d5968 into falcosecurity:master Nov 8, 2024
47 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