Skip to content

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Apr 24, 2025

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:

This PR is part of a series #2343.
It removes sinsp_thread_manager dependency on sinsp fields by selectively providing each single dependency the component.
Moreover, it removes sinsp::get_thread_manager_dyn_fields() and sinsp::get_fdtable_dyn_fields() public APIs.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

feat(userspace/libsinsp)!: isolate `sinsp_thread_manager` from `sinsp`

@poiana poiana requested review from hbrueckner and Molter73 April 24, 2025 08:28
@ekoops ekoops force-pushed the ekoops/isolate-thread-mgr branch from 88917b9 to 9567929 Compare April 24, 2025 08:29
@ekoops ekoops changed the title feat(userspace/libsinsp)!: isolate sinsp_thread_manager from sinsp wip: feat(userspace/libsinsp)!: isolate sinsp_thread_manager from sinsp Apr 24, 2025
@ekoops
Copy link
Contributor Author

ekoops commented Apr 24, 2025

This PR requires a rebase on top of https://github.com/falcosecurity/libs/pull/2373, so I put it on hold until the latter is approved.

@ekoops ekoops force-pushed the ekoops/isolate-thread-mgr branch from 9567929 to 3ab2c3c Compare April 24, 2025 10:37
@ekoops ekoops changed the title wip: feat(userspace/libsinsp)!: isolate sinsp_thread_manager from sinsp feat(userspace/libsinsp)!: isolate sinsp_thread_manager from sinsp Apr 24, 2025
Remove `sinsp_thread_manager` dependency on `sinsp` fields by
selectively providing each single dependency the component.

BREAKING CHANGE: update `sinsp_thread_manager` constructor, and
remove `sinsp::get_thread_manager_dyn_fields()` and
`sinsp::get_fdtable_dyn_fields()` public APIs

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
@ekoops ekoops force-pushed the ekoops/isolate-thread-mgr branch from 3ab2c3c to 70e1d0a Compare April 24, 2025 10:38
Copy link

codecov bot commented Apr 24, 2025

Codecov Report

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

Project coverage is 77.03%. Comparing base (ca91cb1) to head (70e1d0a).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/thread_manager.h 0.00% 8 Missing ⚠️
userspace/libsinsp/thread_manager.cpp 84.21% 3 Missing ⚠️
userspace/libsinsp/sinsp.cpp 94.44% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2371   +/-   ##
=======================================
  Coverage   77.02%   77.03%           
=======================================
  Files         229      230    +1     
  Lines       30316    30348   +32     
  Branches     4657     4659    +2     
=======================================
+ Hits        23352    23378   +26     
- Misses       6964     6970    +6     
Flag Coverage Δ
libsinsp 77.03% <87.09%> (+<0.01%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Perf diff from master - unit tests

     6.69%     -0.69%  [.] sinsp_parser::reset
     2.53%     +0.59%  [.] gzfile_read
     2.49%     -0.59%  [.] sinsp_evt::load_params
     4.08%     +0.40%  [.] sinsp_thread_manager::find_thread
     1.31%     -0.35%  [.] scap_event_decode_params
     5.16%     +0.24%  [.] sinsp_evt::get_type
     0.32%     +0.22%  [.] sinsp_parser::parse_context_switch
     1.40%     -0.22%  [.] next
     1.06%     +0.21%  [.] std::_Hashtable<unsigned long, std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> >, std::allocator<std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned 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.70%     -0.20%  [.] next_event_from_file

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -64B
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.0021         -0.0021           150           149           150           149
BM_sinsp_split_median                                          -0.0016         -0.0016           149           149           149           149
BM_sinsp_split_stddev                                          -0.1552         -0.1545             2             1             2             1
BM_sinsp_split_cv                                              -0.1534         -0.1527             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0468         -0.0468            59            57            59            57
BM_sinsp_concatenate_paths_relative_path_median                -0.0535         -0.0535            59            56            59            56
BM_sinsp_concatenate_paths_relative_path_stddev                -0.4398         -0.4401             1             1             1             1
BM_sinsp_concatenate_paths_relative_path_cv                    -0.4123         -0.4126             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0364         +0.0364            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0431         +0.0431            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.6213         -0.6209             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.6346         -0.6342             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0984         -0.0984            63            57            63            57
BM_sinsp_concatenate_paths_absolute_path_median                -0.0835         -0.0835            62            56            62            56
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.8266         -0.8267             2             0             2             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.8077         -0.8078             0             0             0             0

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 Apr 29, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ekoops, 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
Copy link
Contributor

poiana commented Apr 29, 2025

LGTM label has been added.

Git tree hash: 23ff7865c398d68be2884ceb05102bc984e3023a

@FedeDP
Copy link
Contributor

FedeDP commented Apr 29, 2025

/milestone 0.21.0

@poiana poiana added this to the 0.21.0 milestone Apr 29, 2025
@github-project-automation github-project-automation bot moved this from Todo to In progress in Falco Roadmap Apr 29, 2025
@poiana poiana merged commit 5fdd853 into falcosecurity:master Apr 29, 2025
65 of 66 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Falco Roadmap Apr 29, 2025
@ekoops ekoops deleted the ekoops/isolate-thread-mgr branch April 29, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants