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

Ensure thread pool has at least 2 threads when profiling is enabled #5735

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

Conversation

o7si
Copy link

@o7si o7si commented Nov 16, 2024

When the PROFILING feature is enabled, the profiler relies on the thread pool for its operations. If the thread pool is configured with only 1 thread, it can lead to resource contention, preventing the Calculator's Process function from being scheduled.

This commit ensures that the thread pool size is set to at least 2 threads when profiling is available, avoiding potential scheduling issues.

Relevant code change:

  • Added a check to guarantee num_threads is at least 2 under MEDIAPIPE_PROFILER_AVAILABLE.

Fixes potential issues with single-threaded configurations under profiling.

When the PROFILING feature is enabled, the profiler relies on the thread pool
for its operations. If the thread pool is configured with only 1 thread, it
can lead to resource contention, preventing the Calculator's Process function
from being scheduled.

This commit ensures that the thread pool size is set to at least 2 threads
when profiling is available, avoiding potential scheduling issues.

Relevant code change:
  - Added a check to guarantee `num_threads` is at least 2 under
    `MEDIAPIPE_PROFILER_AVAILABLE`.

Fixes potential issues with single-threaded configurations under profiling.
Copy link

google-cla bot commented Nov 16, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant