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

fix(libsinsp): pass shared_ptr by reference #1973

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

therealbobo
Copy link
Contributor

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

As per #1965, this allows the compiler to inline and elide reference counting.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Copy link

Perf diff from master - unit tests

    10.63%     -1.95%  [.] sinsp_parser::reset
     3.51%     -1.78%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
     4.99%     +0.99%  [.] sinsp_evt::get_type
     1.42%     -0.71%  [.] 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> >::find
     1.79%     -0.65%  [.] libsinsp::events::is_unknown_event
     5.20%     -0.52%  [.] next
     1.25%     +0.51%  [.] 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.19%     -0.50%  [.] sinsp_evt::get_direction
     7.69%     +0.47%  [.] sinsp::next
     1.14%     +0.46%  [.] libsinsp::sinsp_suppress::process_event

Perf diff from master - scap file

    35.03%    -12.16%  [.] sinsp_evt_formatter::tostring_withformat
     4.38%     +7.49%  [.] sinsp_filter_check::tostring
    21.93%     -4.37%  [.] sinsp_filter_check::extract_nocache
     4.39%     +1.77%  [.] main
     4.31%     -0.14%  [.] rawstring_check::extract_single
     4.36%     -0.08%  [.] sinsp_thread_manager::find_thread
     4.39%     -0.08%  [.] 0x00000000000a7fe0
     4.38%     -0.08%  [.] sinsp_parser::event_cleanup
     4.39%     -0.07%  [.] sinsp_filter_check_thread::extract_single
     4.29%     -0.07%  [.] sinsp_utils::ts_to_string

Heap diff from master - unit tests

total runtime: -0.01s.
calls to allocation functions: 622 (-47846/s)
temporary memory allocations: 148 (-11384/s)
peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

total runtime: 0.02s.
calls to allocation functions: 0 (0/s)
temporary memory allocations: -7 (-333/s)
peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.00%. Comparing base (31d1adf) to head (95f0238).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1973      +/-   ##
==========================================
- Coverage   51.00%   51.00%   -0.01%     
==========================================
  Files         310      310              
  Lines       39570    39570              
  Branches    17487    17702     +215     
==========================================
- Hits        20183    20182       -1     
+ Misses      14350    14335      -15     
- Partials     5037     5053      +16     

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

Copy link
Contributor

@LucaGuerra LucaGuerra left a comment

Choose a reason for hiding this comment

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

I believe the functions around this use the same things so I can approve this for consistency but we may be misusing shared_ptrs here

@poiana
Copy link
Contributor

poiana commented Jul 23, 2024

LGTM label has been added.

Git tree hash: eb88585e0525d72d71782e47167bca744aa3973a

@LucaGuerra
Copy link
Contributor

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Jul 23, 2024
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 Jul 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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 1243787 into falcosecurity:master Jul 23, 2024
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