Skip to content

Conversation

Dimi1010
Copy link
Collaborator

Split of #1838, since that one has been sitting for a while.

This part moves only the statistics worker to be entirely internal to the PcapLiveDevice translation unit.

Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.48%. Comparing base (96484fb) to head (0b08957).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
Pcap++/src/PcapLiveDevice.cpp 66.66% 9 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1966      +/-   ##
==========================================
- Coverage   83.51%   83.48%   -0.03%     
==========================================
  Files         311      311              
  Lines       54897    54881      -16     
  Branches    12213    12182      -31     
==========================================
- Hits        45845    45820      -25     
- Misses       7788     8207     +419     
+ Partials     1264      854     -410     
Flag Coverage Δ
alpine320 75.95% <52.17%> (-0.01%) ⬇️
fedora42 76.08% <54.16%> (-0.03%) ⬇️
macos-13 81.64% <69.23%> (-0.01%) ⬇️
macos-14 81.64% <69.23%> (-0.01%) ⬇️
macos-15 81.65% <69.23%> (-0.01%) ⬇️
mingw32 70.34% <41.66%> (+0.01%) ⬆️
mingw64 70.33% <41.66%> (+0.13%) ⬆️
npcap ?
rhel94 75.80% <52.17%> (-0.01%) ⬇️
ubuntu2004 60.24% <57.14%> (-0.04%) ⬇️
ubuntu2004-zstd 60.36% <57.14%> (+<0.01%) ⬆️
ubuntu2204 75.74% <52.17%> (-0.03%) ⬇️
ubuntu2204-icpx 60.73% <42.30%> (-0.03%) ⬇️
ubuntu2404 75.99% <52.17%> (-0.02%) ⬇️
ubuntu2404-arm64 75.60% <52.17%> (-0.03%) ⬇️
unittest 83.48% <66.66%> (-0.03%) ⬇️
windows-2022 85.48% <60.00%> (+0.12%) ⬆️
windows-2025 85.51% <64.28%> (+0.09%) ⬆️
winpcap 85.51% <64.28%> (-0.10%) ⬇️
xdp 53.57% <0.00%> (+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.

@Dimi1010 Dimi1010 marked this pull request as ready for review September 15, 2025 17:37
@Dimi1010 Dimi1010 requested a review from seladb as a code owner September 15, 2025 17:37
Copy link
Owner

@seladb seladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR reverts many of the changes done here: #1785, I'm curious why we're moving back and forth? 🤔

@Dimi1010
Copy link
Collaborator Author

Dimi1010 commented Sep 19, 2025

This PR reverts many of the changes done here: #1785, I'm curious why we're moving back and forth? 🤔

The first change was an attempt to separate the variables only needed for the thread procedures away from the rest of the device.

As I was reworking the capture thread variables, I figured that having said variables grouped as contexts and passed to a pure function procedure would be better for internal representation. That way, the level of indirection done by the polymorphic Worker class is removed while also keeping the encapsulation of the thread variables used only inside the procedure.

Since the workers are one-offs and won't be reused, it is a simpler solution that would only keep std::thread and std::atomic<bool> inside the device class.
Additionally, it would allow reuse of the stop flag, as the same flag can be passed to multiple procedures. In the worker scenario, each worker created its own stop flag.

@Dimi1010 Dimi1010 merged commit 0a6241a into seladb:dev Sep 21, 2025
43 checks passed
@Dimi1010 Dimi1010 deleted the refactor/internal-statistics-worker branch September 21, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants