summaryrefslogtreecommitdiff
path: root/src/vm/win32threadpool.cpp
diff options
context:
space:
mode:
authorVance Morrison <vancem@microsoft.com>2018-05-30 05:38:21 -0700
committerJan Kotas <jkotas@microsoft.com>2018-05-30 05:38:21 -0700
commit3148a6dd0a1999cbb987b12de2368a7c0b09077e (patch)
tree9f825f592d822a289cef59bb9b06f30455847bcc /src/vm/win32threadpool.cpp
parent4445c056a4a1fa23dc18674b3719d78c38435f06 (diff)
downloadcoreclr-3148a6dd0a1999cbb987b12de2368a7c0b09077e.tar.gz
coreclr-3148a6dd0a1999cbb987b12de2368a7c0b09077e.tar.bz2
coreclr-3148a6dd0a1999cbb987b12de2368a7c0b09077e.zip
Improve the labeling of .NET Threads. (#18193)
There was already some support for labeling threads using the Window SetThreadDescription API, however it was missing some important cases (like labeling the ThreadPool and GC server and Background threads). Fix this. Also make the naming consistant (they all start with .NET). These names show up in PerfView traces and can be used by debuggers or other profilers as well.
Diffstat (limited to 'src/vm/win32threadpool.cpp')
-rw-r--r--src/vm/win32threadpool.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vm/win32threadpool.cpp b/src/vm/win32threadpool.cpp
index ad7ac3a063..7f9953a0f9 100644
--- a/src/vm/win32threadpool.cpp
+++ b/src/vm/win32threadpool.cpp
@@ -1818,7 +1818,7 @@ Thread* ThreadpoolMgr::CreateUnimpersonatedThread(LPTHREAD_START_ROUTINE lpStart
bOK = pThread->CreateNewThread(0, // default stack size
lpStartAddress,
lpArgs, //arguments
- W(".NET Core ThreadPool"));
+ W(".NET ThreadPool Worker"));
}
else {
#ifndef FEATURE_PAL
@@ -1839,6 +1839,9 @@ Thread* ThreadpoolMgr::CreateUnimpersonatedThread(LPTHREAD_START_ROUTINE lpStart
lpThreadArgs, // arguments
CREATE_SUSPENDED,
&threadId);
+#ifndef FEATURE_PAL
+ SetThreadName(threadHandle, W(".NET ThreadPool Worker"));
+#endif // !FEATURE_PAL
if (threadHandle != NULL)
lpThreadArgs.SuppressRelease();
}
@@ -2414,7 +2417,7 @@ BOOL ThreadpoolMgr::CreateWaitThread()
}
threadCB->startEvent.CreateAutoEvent(FALSE);
- HANDLE threadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, WaitThreadStart, (LPVOID)threadCB, CREATE_SUSPENDED, &threadId);
+ HANDLE threadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, WaitThreadStart, (LPVOID)threadCB, W(".NET ThreadPool Wait"), CREATE_SUSPENDED, &threadId);
if (threadHandle == NULL)
{
@@ -3165,7 +3168,7 @@ BOOL ThreadpoolMgr::CreateGateThread()
{
LIMITED_METHOD_CONTRACT;
- HANDLE threadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, GateThreadStart, NULL);
+ HANDLE threadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, GateThreadStart, NULL, W(".NET ThreadPool Gate"));
if (threadHandle)
{
@@ -4490,9 +4493,10 @@ BOOL ThreadpoolMgr::CreateTimerQueueTimer(PHANDLE phNewTimer,
{
CreateTimerThreadParams params;
params.event.CreateAutoEvent(FALSE);
+
params.setupSucceeded = FALSE;
- HANDLE TimerThreadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, TimerThreadStart, &params);
+ HANDLE TimerThreadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, TimerThreadStart, &params, W(".NET Timer"));
if (TimerThreadHandle == NULL)
{