Skip to content

wip: feat: multi-thread#2847

Open
ekoops wants to merge 16 commits intomasterfrom
ekoops/multi-thread
Open

wip: feat: multi-thread#2847
ekoops wants to merge 16 commits intomasterfrom
ekoops/multi-thread

Conversation

@ekoops
Copy link
Copy Markdown
Contributor

@ekoops ekoops commented Feb 19, 2026

What type of PR is this?

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

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind test

/kind feature

/kind sync

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-modern-bpf

/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:

Initial attempt for multi-thread support.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Copy Markdown
Contributor

poiana commented Feb 19, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ekoops

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 requested a review from hbrueckner February 19, 2026 13:09
@poiana poiana added the kind/test PRs increasing the test coverage without fixing any failing test label Feb 19, 2026
@poiana poiana requested a review from terror96 February 19, 2026 13:09
@github-actions
Copy link
Copy Markdown

Please double check driver/API_VERSION file. See versioning.

/hold

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 19, 2026

Perf diff from master - unit tests

    24.48%    -13.97%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_lock_nothrow()
     3.91%    +10.30%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_get_use_count() const
     5.09%     +3.87%  [.] sinsp_threadinfo::update_main_fdtable()
    11.61%     -3.62%  [.] sinsp_threadinfo::get_fd_table()
    12.62%     +3.18%  [.] std::__shared_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__weak_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     6.09%     +0.80%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__weak_count<(__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     9.63%     -0.78%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
     5.53%     -0.73%  [.] thread_group_info::get_first_thread() const
    10.93%     +0.57%  [.] sinsp_threadinfo::get_main_thread()
     4.18%     -0.24%  [.] sinsp_thread_manager::create_thread_dependencies(std::shared_ptr<sinsp_threadinfo> const&)

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -923B
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.0270         -0.0271           247           241           247           241
BM_sinsp_split_median                                          -0.0290         -0.0293           247           240           247           240
BM_sinsp_split_stddev                                          +1.4289         +1.4438             1             3             1             3
BM_sinsp_split_cv                                              +1.4962         +1.5118             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0180         -0.0181            70            69            70            69
BM_sinsp_concatenate_paths_relative_path_median                -0.0203         -0.0204            70            68            70            68
BM_sinsp_concatenate_paths_relative_path_stddev                +0.0695         +0.0690             1             1             1             1
BM_sinsp_concatenate_paths_relative_path_cv                    +0.0891         +0.0887             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0536         -0.0538            42            40            42            40
BM_sinsp_concatenate_paths_empty_path_median                   -0.0560         -0.0560            42            40            42            40
BM_sinsp_concatenate_paths_empty_path_stddev                   +7.5263         +7.5934             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +8.0092         +8.0821             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0139         -0.0140            70            69            70            69
BM_sinsp_concatenate_paths_absolute_path_median                -0.0108         -0.0109            70            69            70            69
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.0110         +0.0425             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.0252         +0.0573             0             0             0             0

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 47.64957% with 245 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.70%. Comparing base (5f77a9f) to head (0fb5c9f).

Files with missing lines Patch % Lines
userspace/libsinsp/examples/test.cpp 0.00% 191 Missing ⚠️
userspace/libsinsp/sinsp.cpp 71.42% 26 Missing ⚠️
userspace/libsinsp/parsers.cpp 82.78% 21 Missing ⚠️
userspace/libsinsp/examples/perftest.cpp 0.00% 2 Missing ⚠️
userspace/libsinsp/sinsp.h 66.66% 2 Missing ⚠️
userspace/libsinsp/sinsp_buffer.h 92.00% 2 Missing ⚠️
userspace/libsinsp/parsers.h 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2847      +/-   ##
==========================================
- Coverage   74.96%   74.70%   -0.27%     
==========================================
  Files         296      298       +2     
  Lines       31472    31625     +153     
  Branches     4977     5026      +49     
==========================================
+ Hits        23594    23625      +31     
- Misses       7878     8000     +122     
Flag Coverage Δ
libsinsp 74.70% <47.64%> (-0.27%) ⬇️

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.

@irozzo-1A irozzo-1A force-pushed the ekoops/multi-thread branch 6 times, most recently from a5a9e97 to f012841 Compare February 20, 2026 09:30
@ekoops ekoops force-pushed the ekoops/multi-thread branch 9 times, most recently from 44bd717 to c6f6d4c Compare March 19, 2026 09:50
@ekoops ekoops force-pushed the ekoops/multi-thread branch 2 times, most recently from 79332df to 2cb8232 Compare March 20, 2026 13:07
@ekoops ekoops force-pushed the ekoops/multi-thread branch 2 times, most recently from d99382b to a4acc62 Compare March 31, 2026 09:12
ekoops and others added 16 commits April 1, 2026 19:22
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
guard scap_modern_bpf_engine with HAS_ENGINE_MODERN_BPF, fix atomic_fetch_add
to use address of counter, add missing return for is_multiple_workers_mode_enabled

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Add missing terminating quotes to buffers-num option description string literals

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
/home/runner/work/libs/libs/userspace/libsinsp/parsers.h:39:1: error: 'sinsp_parser_shared_params' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags]
   39 | struct sinsp_parser_shared_params {
      | ^
/home/runner/work/libs/libs/userspace/libsinsp/sinsp.h:96:1: note: did you mean struct here?
   96 | class sinsp_parser_shared_params;
      | ^~~~~
      | struct
/home/runner/work/libs/libs/userspace/libsinsp/sinsp_buffer.h:27:1: note: did you mean struct here?
   27 | class sinsp_parser_shared_params;
      | ^~~~~
      | struct
1 error generated

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
open_common() called init() before allocating m_buffers. init() runs
consume_initialstate_events() when is_capture(), which uses
m_buffers.at(SINSP_INVALID_BUFFER_HANDLE). With an empty m_buffers this
threw std::out_of_range when opening a savefile (e.g. in plugin_dump test).

Move the m_buffers allocation block to before init() so the default buffer
exists when consume_initialstate_events() runs.

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Force reset of last_access_time in remove_inactive_threads method of
sinsp_with_test_input.

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Signed-off-by: irozzo-1A <iacopo@sysdig.com>
error:  "C atomics require C11 or later"

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Signed-off-by: irozzo-1A <iacopo@sysdig.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants