Skip to content

Use TBB arena index for profiler recording#236

Merged
zfergus merged 3 commits into
mainfrom
profiler/check-tbb-thread-id
May 18, 2026
Merged

Use TBB arena index for profiler recording#236
zfergus merged 3 commits into
mainfrom
profiler/check-tbb-thread-id

Conversation

@zfergus
Copy link
Copy Markdown
Member

@zfergus zfergus commented May 18, 2026

Description

This pull request refactors the Profiler class 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

  • Bug fix (non-breaking change which fixes an issue)

Copilot AI review requested due to automatic review settings May 18, 2026 21:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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::id state 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.

Comment thread src/ipc/utils/profiler.cpp
Comment thread tests/src/tests/utils/test_profiler.cpp
Comment thread src/ipc/utils/profiler.hpp Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.75%. Comparing base (7f89556) to head (befb7cd).

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           
Flag Coverage Δ
unittests 95.75% <ø> (ø)

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.

Copilot AI and others added 2 commits May 18, 2026 21:31
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@zfergus zfergus merged commit bca8846 into main May 18, 2026
21 checks passed
@zfergus zfergus deleted the profiler/check-tbb-thread-id branch May 18, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants