libs icon indicating copy to clipboard operation
libs copied to clipboard

update(sinsp/ifinfo): add new public addr_to_string methods

Open incertum opened this issue 1 year ago • 4 comments

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:

Expose proper / public ip4 and ip6 ip addr to string conversion methods, see https://github.com/falcosecurity/falco/pull/3253/files#r1651554317 @sgaist and @FedeDP

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

incertum avatar Jun 27 '24 23:06 incertum

/milestone 0.18.0

incertum avatar Jun 27 '24 23:06 incertum

Perf diff from master - unit tests

     4.41%     +1.89%  [.] sinsp_thread_manager::find_thread
     7.65%     -1.21%  [.] sinsp::next
     4.25%     -1.09%  [.] sinsp_evt::load_params
     0.11%     +0.96%  [.] scap_event_has_large_payload
     1.62%     -0.92%  [.] sinsp_parser::event_cleanup
     3.45%     +0.91%  [.] sinsp_parser::process_event
     4.18%     -0.88%  [.] sinsp_thread_manager::get_thread_ref
    10.07%     +0.85%  [.] sinsp_parser::reset
     1.40%     +0.70%  [.] 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.40%     -0.53%  [.] sinsp_evt::get_ts

Perf diff from master - scap file

    12.52%     -5.75%  [.] sinsp_thread_manager::get_thread_ref
    19.52%     -4.87%  [.] sinsp_filter_check::extract_nocache
     6.43%     +4.87%  [.] sinsp_evt_formatter::tostring_withformat
     3.19%     +4.31%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     3.27%     +2.98%  [.] sinsp_filter_check_event::extract_single
     9.71%     -2.45%  [.] sinsp_filter_check::apply_transformers
     6.56%     -2.23%  [.] 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
     3.28%     +1.35%  [.] sinsp_filter_check::rawval_to_string
     9.78%     +0.95%  [.] sinsp_filter_check::tostring
     3.27%     +0.44%  [.] sinsp_evt::get_param_as_str

Heap diff from master - unit tests

total runtime: 0.04s.
calls to allocation functions: -695 (-18783/s)
temporary memory allocations: -207 (-5594/s)
peak heap memory consumption: -800B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

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

github-actions[bot] avatar Jun 27 '24 23:06 github-actions[bot]

LGTM label has been added.

Git tree hash: 9d34509b6ae4e23e09063a129bbf5b7d16b6cd3d

poiana avatar Jul 01 '24 07:07 poiana

Rebased as the CI never triggered. What is needed to finish this PR? Thanks!

incertum avatar Jul 18 '24 21:07 incertum

Perf diff from master - unit tests

     6.63%     +1.04%  [.] sinsp::next
     5.41%     -0.87%  [.] next
     1.44%     -0.57%  [.] 0x00000000000e83b0
     0.84%     +0.55%  [.] sinsp_evt::get_ts
     0.37%     +0.54%  [.] scap_event_has_large_payload
     4.70%     +0.52%  [.] sinsp_evt::get_type
     0.83%     -0.52%  [.] sinsp_fdtable::find_ref
     1.10%     -0.51%  [.] sinsp_evt::get_direction
     1.92%     -0.49%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     0.73%     +0.45%  [.] 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

Perf diff from master - scap file

    15.12%     -9.53%  [.] sinsp_evt_formatter::tostring_withformat
     8.58%     -4.47%  [.] sinsp_filter_check_thread::extract_single
     8.23%     -4.23%  [.] 0x00000000000a77e0
     4.32%     +3.39%  [.] 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
     6.45%     -2.83%  [.] sinsp_filter_check::tostring
     4.30%     +2.62%  [.] sinsp_thread_manager::find_thread
     2.10%     +2.22%  [.] sinsp_thread_manager::get_thread_ref
     6.37%     +1.37%  [.] gzfile_read
     6.42%     +1.33%  [.] sinsp_filter_check::extract_nocache
     4.22%     -1.23%  [.] sinsp_filter_check::get_transformed_field_info

Heap diff from master - unit tests

total runtime: 0.05s.
calls to allocation functions: -808 (-15843/s)
temporary memory allocations: -310 (-6078/s)
peak heap memory consumption: -800B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

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

github-actions[bot] avatar Jul 18 '24 21:07 github-actions[bot]

LGTM label has been added.

Git tree hash: 24cf9dca4f5c1b057ac1ce60cecace9850a63d74

poiana avatar Jul 19 '24 08:07 poiana

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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~~ [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 avatar Jul 19 '24 08:07 poiana

Would there be feedback from the second reviewer? Thanks.

incertum avatar Aug 08 '24 06:08 incertum