Use TBB arena index for profiler recording#236
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the Profiler thread-selection logic to better align profiling recording with Intel TBB task arenas by recording only on the arena coordinator/external thread (slot 0), rather than relying on the process “main thread” ID.
Changes:
- Replaced main-thread-id gating with
tbb::this_task_arena::current_thread_index()-based gating. - Added an early
profiler().reset()in the profiler unit test to ensure a clean state per test run. - Removed now-unneeded
<thread>/std::thread::idstate from the profiler interface/implementation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/src/tests/utils/test_profiler.cpp | Resets the global profiler at the start of the test. |
| src/ipc/utils/profiler.hpp | Updates profiler API/docs and removes main-thread-id tracking. |
| src/ipc/utils/profiler.cpp | Implements TBB arena index-based recording-thread selection and updates recording guards. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #236 +/- ##
=======================================
Coverage 95.75% 95.75%
=======================================
Files 163 163
Lines 16650 16650
Branches 919 920 +1
=======================================
Hits 15943 15943
Misses 707 707
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Agent-Logs-Url: https://github.com/ipc-sim/ipc-toolkit/sessions/ee560464-e410-4bd3-9196-31881216dee4 Co-authored-by: zfergus <8219522+zfergus@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Description
This pull request refactors the
Profilerclass to improve thread handling and profiling accuracy when using Intel TBB arenas. The main change is to only record profiling data on the coordinator thread within a TBB arena, or always in serial code, instead of relying on the main thread's ID. This simplifies the logic and makes profiling more accurate in parallel environments.Type of change