Skip to content

Commit

Permalink
Fix SamplingProfiler name tracking on thread change
Browse files Browse the repository at this point in the history
Summary:
Record the name of the new thread when the sampling profiler is told
that the runtime has changed threads.

Reviewed By: lavenzg

Differential Revision: D69692667

fbshipit-source-id: ba972bab97a39a8489c24bb0d670438f763d81e9
  • Loading branch information
neildhar authored and facebook-github-bot committed Feb 19, 2025
1 parent 716f148 commit 2facf5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/VM/Profiler/SamplingProfilerPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ void SamplingProfiler::setRuntimeThread() {
std::lock_guard<std::mutex> lock(profiler->runtimeDataLock_);
profiler->currentThread_ = pthread_self();
threadID_ = oscompat::global_thread_id();
threadNames_[threadID_] = oscompat::thread_name();
}

} // namespace vm
Expand Down
1 change: 1 addition & 0 deletions lib/VM/Profiler/SamplingProfilerWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ void SamplingProfiler::setRuntimeThread() {
CloseHandle(profiler->currentThread_);
profiler->currentThread_ = openCurrentThread();
threadID_ = oscompat::global_thread_id();
threadNames_[threadID_] = oscompat::thread_name();
}

} // namespace vm
Expand Down

0 comments on commit 2facf5b

Please sign in to comment.