Skip to content

wip: new(libsinsp): prepare built in tables for multithreading support#2804

Draft
gnosek wants to merge 74 commits intofalcosecurity:masterfrom
gnosek:table-cleanup
Draft

wip: new(libsinsp): prepare built in tables for multithreading support#2804
gnosek wants to merge 74 commits intofalcosecurity:masterfrom
gnosek:table-cleanup

Conversation

@gnosek
Copy link
Contributor

@gnosek gnosek commented Jan 21, 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-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 not intended to be merged, just to show where we're going with #2802. It should get shorter over time as we merge the individual PRs (that should be easier to review than this whole series).

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Contributor

poiana commented Jan 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnosek

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

@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Perf diff from master - unit tests

     7.34%    +22.12%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__weak_count<(__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
    14.15%    -10.22%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_get_use_count() const
    17.33%     -5.98%  [.] 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)
     5.86%     +4.23%  [.] thread_group_info::get_first_thread() const
     8.91%     -2.80%  [.] sinsp_threadinfo::get_fd_table()
     4.02%     +0.74%  [.] sinsp_thread_manager::create_thread_dependencies(std::shared_ptr<sinsp_threadinfo> const&)
    11.15%     +0.24%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_lock_nothrow()
     0.37%     -0.22%  [.] void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
    13.62%     -0.21%  [.] sinsp_threadinfo::get_main_thread()
    11.20%     -0.10%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()

Heap diff from master - unit tests

peak heap memory consumption: 14.48M
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 366.46K
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.0157         +0.0156           239           242           239           242
BM_sinsp_split_median                                          +0.0167         +0.0161           238           242           238           242
BM_sinsp_split_stddev                                          +0.4732         +0.4600             2             2             2             2
BM_sinsp_split_cv                                              +0.4505         +0.4376             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0417         -0.0418            72            69            72            69
BM_sinsp_concatenate_paths_relative_path_median                -0.0369         -0.0373            72            69            72            69
BM_sinsp_concatenate_paths_relative_path_stddev                -0.6826         -0.6820             1             0             1             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.6688         -0.6681             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0426         +0.0429            40            41            40            41
BM_sinsp_concatenate_paths_empty_path_median                   +0.0611         +0.0611            39            42            39            42
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.8101         +0.8161             1             1             1             1
BM_sinsp_concatenate_paths_empty_path_cv                       +0.7362         +0.7415             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0002         -0.0000            68            68            68            68
BM_sinsp_concatenate_paths_absolute_path_median                +0.0034         +0.0035            68            69            68            69
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.0720         -0.0839             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.0718         -0.0839             0             0             0             0

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 85.83062% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.46%. Comparing base (7250ae9) to head (a564872).

Files with missing lines Patch % Lines
userspace/libsinsp/state/table_adapters.h 67.24% 19 Missing ⚠️
userspace/libsinsp/state/dynamic_struct.h 91.40% 11 Missing ⚠️
userspace/libsinsp/state/static_struct.cpp 37.50% 10 Missing ⚠️
userspace/libsinsp/state/extensible_struct.h 66.66% 7 Missing ⚠️
userspace/libsinsp/state/type_info.h 56.25% 7 Missing ⚠️
userspace/libsinsp/fdinfo.cpp 62.50% 6 Missing ⚠️
userspace/libsinsp/threadinfo.cpp 53.84% 6 Missing ⚠️
userspace/libsinsp/sinsp_filtercheck_thread.cpp 33.33% 4 Missing ⚠️
userspace/libsinsp/plugin.h 57.14% 3 Missing ⚠️
userspace/libsinsp/plugin_table_api.cpp 40.00% 3 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2804      +/-   ##
==========================================
- Coverage   74.53%   74.46%   -0.07%     
==========================================
  Files         292      296       +4     
  Lines       29987    29907      -80     
  Branches     4660     4651       -9     
==========================================
- Hits        22350    22271      -79     
+ Misses       7637     7636       -1     
Flag Coverage Δ
libsinsp 74.46% <85.83%> (-0.07%) ⬇️

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.

@gnosek
Copy link
Contributor Author

gnosek commented Jan 21, 2026

Of course I can't repro the ASAN/UBSAN failures locally 🙃

@gnosek gnosek force-pushed the table-cleanup branch 3 times, most recently from ca84af1 to 236016e Compare January 21, 2026 16:32
@gnosek gnosek force-pushed the table-cleanup branch 2 times, most recently from e2977fb to 20cba10 Compare January 30, 2026 15:39
This does introduce some code duplication but we'll clean it up later.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
This does introduce some code duplication but we'll clean it up later.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
gnosek added 27 commits January 30, 2026 16:43
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
…r class

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@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.

2 participants