From: Brendan Shanks bshanks@codeweavers.com
--- dlls/wined3d/cs.c | 1 + dlls/wined3d/directx.c | 2 ++ dlls/wined3d/swapchain.c | 2 ++ 3 files changed, 5 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 8ddcb95ddcc..8ee7e7fccc9 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -3354,6 +3354,7 @@ static DWORD WINAPI wined3d_cs_run(void *ctx) bool run = true;
TRACE("Started.\n"); + SetThreadDescription(GetCurrentThread(), L"wined3d_cs");
/* Copy the module handle to a local variable to avoid racing with the * thread freeing "cs" before the FreeLibraryAndExitThread() call. */ diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 6a27c15b0ba..8590bd4800a 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1069,6 +1069,8 @@ static DWORD CALLBACK notification_thread_func(void *stop_event) struct wined3d_video_memory_info info; HRESULT hr;
+ SetThreadDescription(GetCurrentThread(), L"wined3d_budget_change_notification"); + while (TRUE) { wined3d_mutex_lock(); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 9f2d41b757a..80e630fd41e 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -2194,6 +2194,8 @@ static DWORD WINAPI wined3d_set_window_state(void *ctx) struct wined3d_window_state *s = ctx; bool filter;
+ SetThreadDescription(GetCurrentThread(), L"wined3d_set_window_state"); + filter = wined3d_filter_messages(s->window, TRUE);
if (s->set_style)
On 9/26/22 16:24, Brendan Shanks wrote:
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 6a27c15b0ba..8590bd4800a 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1069,6 +1069,8 @@ static DWORD CALLBACK notification_thread_func(void *stop_event) struct wined3d_video_memory_info info; HRESULT hr;
- SetThreadDescription(GetCurrentThread(), L"wined3d_budget_change_notification");
while (TRUE) { wined3d_mutex_lock();
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 9f2d41b757a..80e630fd41e 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -2194,6 +2194,8 @@ static DWORD WINAPI wined3d_set_window_state(void *ctx) struct wined3d_window_state *s = ctx; bool filter;
SetThreadDescription(GetCurrentThread(), L"wined3d_set_window_state");
filter = wined3d_filter_messages(s->window, TRUE); if (s->set_style)
These are going to get cut off on Linux, which rather unfortunately has a hard limit of 15 characters. Should we try to make these shorter?
I didn't notice earlier, but the same applies to fa8e36fafa and 3f0166fa89.
On Mon Sep 26 21:42:31 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 9/26/22 16:24, Brendan Shanks wrote: > diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c > index 6a27c15b0ba..8590bd4800a 100644 > --- a/dlls/wined3d/directx.c > +++ b/dlls/wined3d/directx.c > @@ -1069,6 +1069,8 @@ static DWORD CALLBACK notification_thread_func(void *stop_event) > struct wined3d_video_memory_info info; > HRESULT hr; > > + SetThreadDescription(GetCurrentThread(), L"wined3d_budget_change_notification"); > + > while (TRUE) > { > wined3d_mutex_lock(); > diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c > index 9f2d41b757a..80e630fd41e 100644 > --- a/dlls/wined3d/swapchain.c > +++ b/dlls/wined3d/swapchain.c > @@ -2194,6 +2194,8 @@ static DWORD WINAPI wined3d_set_window_state(void *ctx) > struct wined3d_window_state *s = ctx; > bool filter; > > + SetThreadDescription(GetCurrentThread(), L"wined3d_set_window_state"); > + > filter = wined3d_filter_messages(s->window, TRUE); > > if (s->set_style) These are going to get cut off on Linux, which rather unfortunately has a hard limit of 15 characters. Should we try to make these shorter? I didn't notice earlier, but the same applies to fa8e36fafa and 3f0166fa89.
It is a very short limit on Linux, but the full names do show up in the `+threadname` debug channel and in `winedbg`.
I think the best we can do is try to ensure the 15 characters include at least `wine` and which DLL the thread comes from, and also that it's uniquely identifiable (for searching).
`wined3d_budget`, `wined3d_set_win`, or `wine_wininet_co` at least make it clear where to start looking. I'm not sure if we could really shorten those either, using CamelCase would help a bit but doesn't match the project style.
For fa8e36fafa though, `wine_threadpool` alone takes up the 15 chars, maybe I should have used `wine_tp` so there will be some unique part in the 15 chars.
Also since no Windows software is written with limited-length thread names in mind (since at least VC6), I suspect anyone looking at 15 character names will need to have a `+threadname` log or `winedbg` to cross-reference with anyway.
For example, here's a thread listing of a CEF executable: ``` 00000020 cefclient.exe 00000024 0 CrBrowserMain 00000108 0 BrokerEvent 0000010c 0 ThreadPoolServiceThread 00000110 0 ThreadPoolForegroundWorker 00000114 -2 ThreadPoolBackgroundWorker 00000118 0 ThreadPoolForegroundWorker 0000011c 0 Chrome_IOThread 00000120 0 MemoryInfra 00000124 0 wine_threadpool_worker 00000128 0 wine_threadpool_waitqueue 0000012c 0 ThreadPoolSingleThreadCOMSTASharedForeground0 00000130 0 ThreadPoolSingleThreadCOMSTASharedForegroundBlocking1 00000134 0 ThreadPoolForegroundWorker 00000138 1 Chrome_InProcGpuThread 0000013c 0 CompositorTileWorker1 00000140 0 Chrome_ChildIOThread 00000144 0 ThreadPoolForegroundWorker 00000148 0 0000014c 0 VideoCaptureThread 00000158 -2 ThreadPoolSingleThreadSharedBackgroundBlocking2 0000015c 0 ThreadPoolSingleThreadSharedForegroundBlocking3 00000160 -2 ThreadPoolBackgroundWorker 00000164 0 ThreadPoolSingleThreadForegroundBlocking4 00000170 0 wine_rpcrt4_server 00000174 0 ThreadPoolSingleThreadSharedForeground5 00000180 -2 ThreadPoolSingleThreadCOMSTABackgroundBlocking6 000001dc 0 wined3d_cs 0000023c 1 VizCompositorThread 00000240 0 ThreadPoolForegroundWorker 00000244 0 00000248 0 ThreadPoolForegroundWorker ```
On 9/26/22 17:24, Brendan Shanks (@bshanks) wrote:
These are going to get cut off on Linux, which rather unfortunately has a hard limit of 15 characters. Should we try to make these shorter? I didn't notice earlier, but the same applies to fa8e36fafa and 3f0166fa89.
It is a very short limit on Linux, but the full names do show up in the `+threadname` debug channel and in `winedbg`.
I think the best we can do is try to ensure the 15 characters include at least `wine` and which DLL the thread comes from, and also that it's uniquely identifiable (for searching).
`wined3d_budget`, `wined3d_set_win`, or `wine_wininet_co` at least make it clear where to start looking. I'm not sure if we could really shorten those either, using CamelCase would help a bit but doesn't match the project style.
For fa8e36fafa though, `wine_threadpool` alone takes up the 15 chars, maybe I should have used `wine_tp` so there will be some unique part in the 15 chars.
Also since no Windows software is written with limited-length thread names in mind (since at least VC6), I suspect anyone looking at 15 character names will need to have a `+threadname` log or `winedbg` to cross-reference with anyway.
Sure, makes sense. I do at least think it's a good idea to try to make the thread names unique and readable with host tools; I've found that to be very useful with multiple such tools (`top -H`, `pidstat -t` and gpuvis all come to mind).
Perhaps we could try to introduce support for longer task names in the Linux kernel? I guess it'd need a new API, though, since changing the limit would break ABI :-/
This merge request was approved by Zebediah Figura.
This merge request was approved by Jan Sikorski.