Skip to content

Commit

Permalink
Fix SamplingProfiler name tracking on thread change
Browse files Browse the repository at this point in the history
Summary:
Original Author: [email protected]
Original Git: 2facf5b
Original Reviewed By: lavenzg
Original Revision: D69692667

Record the name of the new thread when the sampling profiler is told
that the runtime has changed threads.

Reviewed By: neildhar

Differential Revision: D69941438

fbshipit-source-id: 5fa9802fa51e8eb30a857ec8092d5313fa688b98
  • Loading branch information
dannysu authored and facebook-github-bot committed Feb 21, 2025
1 parent fd0d741 commit 739f229
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 @@ -485,6 +485,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 739f229

Please sign in to comment.