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

feat(sinsp-example): Add throughput profiling #2285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nathan-b
Copy link
Contributor

@nathan-b nathan-b commented Feb 18, 2025

/kind feature
/area libsinsp

This PR introduces a new mode into sinsp-example which will allow the profiling of event processing throughput.

I believe this change will be useful to libs developers, as it provides a simple way to benchmark performance-related changes. A goal of this change is to be as non-intrusive as possible while still providing valuable running information on the performance of the system.

Sample output

While running

Events: 80336 Events/ms: 80.336 CPU: 8%  

At the end of the run

Retrieved events: 3943497
Time spent: 35955ms
Events/ms: 109.679
Max throughput observed: 472.409 events / ms
Average CPU usage: 11%
NONE

Signed-off-by: Nathan Baker [email protected]

@poiana
Copy link
Contributor

poiana commented Feb 18, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nathan-b
Once this PR has been reviewed and has the lgtm label, please assign gnosek for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 requested review from FedeDP and hbrueckner February 18, 2025 22:07
@poiana poiana added the size/L label Feb 18, 2025
Copy link

Perf diff from master - unit tests

     8.23%     +0.80%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
     2.73%     +0.59%  [.] gzfile_read
     7.28%     -0.50%  [.] sinsp::next
     1.40%     +0.36%  [.] sinsp_parser::process_event
     5.03%     -0.32%  [.] sinsp_evt::get_type
     2.11%     +0.25%  [.] sinsp_evt::load_params
     1.06%     -0.24%  [.] scap_event_decode_params
     0.87%     +0.23%  [.] sinsp::fetch_next_event
     0.85%     -0.23%  [.] sinsp_evt::get_syscall_return_value
     0.58%     -0.22%  [.] scap_next

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: 0B
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.0178         +0.0177           150           153           150           153
BM_sinsp_split_median                                          +0.0210         +0.0210           151           154           151           154
BM_sinsp_split_stddev                                          +1.8841         +1.8821             1             3             1             3
BM_sinsp_split_cv                                              +1.8336         +1.8319             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.1535         -0.1535            63            53            63            53
BM_sinsp_concatenate_paths_relative_path_median                -0.1675         -0.1676            63            52            63            52
BM_sinsp_concatenate_paths_relative_path_stddev                +1.4571         +1.4585             1             2             1             2
BM_sinsp_concatenate_paths_relative_path_cv                    +1.9026         +1.9045             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0406         +0.0405            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0338         +0.0337            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +5.1754         +5.2091             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +4.9344         +4.9673             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0625         -0.0626            62            58            62            58
BM_sinsp_concatenate_paths_absolute_path_median                -0.0669         -0.0670            62            58            62            58
BM_sinsp_concatenate_paths_absolute_path_stddev                +1.3881         +1.3889             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +1.5473         +1.5484             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0392         +0.0391           395           410           395           410
BM_sinsp_split_container_image_median                          +0.0368         +0.0367           396           410           396           410
BM_sinsp_split_container_image_stddev                          -0.6379         -0.6381             4             1             4             1
BM_sinsp_split_container_image_cv                              -0.6515         -0.6517             0             0             0             0

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.

Project coverage is 75.23%. Comparing base (0d94d2b) to head (119b737).

Files with missing lines Patch % Lines
userspace/libsinsp/examples/test.cpp 0.00% 30 Missing ⚠️
userspace/libsinsp/examples/cpu_usage.cpp 0.00% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2285      +/-   ##
==========================================
- Coverage   75.32%   75.23%   -0.10%     
==========================================
  Files         280      281       +1     
  Lines       34556    34600      +44     
  Branches     5902     5915      +13     
==========================================
  Hits        26031    26031              
- Misses       8525     8569      +44     
Flag Coverage Δ
libsinsp 75.23% <0.00%> (-0.10%) ⬇️

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.

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