Skip to content

Commit 2facf5b

Browse files
neildharfacebook-github-bot
authored andcommitted
Fix SamplingProfiler name tracking on thread change
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
1 parent 716f148 commit 2facf5b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/VM/Profiler/SamplingProfilerPosix.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ void SamplingProfiler::setRuntimeThread() {
482482
std::lock_guard<std::mutex> lock(profiler->runtimeDataLock_);
483483
profiler->currentThread_ = pthread_self();
484484
threadID_ = oscompat::global_thread_id();
485+
threadNames_[threadID_] = oscompat::thread_name();
485486
}
486487

487488
} // namespace vm

lib/VM/Profiler/SamplingProfilerWindows.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ void SamplingProfiler::setRuntimeThread() {
223223
CloseHandle(profiler->currentThread_);
224224
profiler->currentThread_ = openCurrentThread();
225225
threadID_ = oscompat::global_thread_id();
226+
threadNames_[threadID_] = oscompat::thread_name();
226227
}
227228

228229
} // namespace vm

0 commit comments

Comments
 (0)