OLD | NEW |
(Empty) | |
| 1 [Motivation] |
| 2 This tool is designed to test the usage of the SetThreadDescription WinAPI in |
| 3 Chrome. In Chrome, the SetThreadDescription API has been enabled to set thread |
| 4 names. However, since there is no tool support to retrieve thread names set by |
| 5 GetThreadDescription, we will still rely on SetNameInternal function in |
| 6 platform_thread_win.cc to set thread names. Despite this, we need a tool to |
| 7 demo the SetThreadDescription API works, even without the debugger to be |
| 8 present. |
| 9 |
| 10 The problem setting can be referred to |
| 11 https://bugs.chromium.org/p/chromium/issues/detail?id=684203 |
| 12 |
| 13 This tool incorporates the GetThreadDescription API trying to get names of all |
| 14 threads in a process specified by its ID. If the thread names have been set by |
| 15 SetThreadDescription API call like in Chrome, all thread ID/name pairs are |
| 16 returned. |
| 17 |
| 18 [Requirement] |
| 19 Since SetThreadDescription/GetThreadDescription APIs are brought in Windows 10, |
| 20 version 1607, this tool can only be effective if running in this version or |
| 21 later ones. |
| 22 |
| 23 [How to use it] |
| 24 Please download the three files (.cc, .sln, .vcxproj) and compile the code in |
| 25 Visual Studio. Run "ShowThreadNames.exe" either from the build directory or |
| 26 from Visual Studio. No parameters are needed. This tool allows interaction |
| 27 with users. Once launched, it will show "Please enter the process Id, or |
| 28 "quit" to end the program :" on the terminal. Simply type in the ID of any |
| 29 Chrome process you are interested in, and you will get output like below: |
| 30 |
| 31 thread_ID thread_name |
| 32 12116 |
| 33 10292 |
| 34 6532 |
| 35 6928 |
| 36 2488 |
| 37 11304 |
| 38 2256 AudioThread |
| 39 9308 BrokerEvent |
| 40 5668 BrowserWatchdog |
| 41 4352 Chrome_CacheThread |
| 42 12268 Chrome_DBThread |
| 43 8616 Chrome_FileThread |
| 44 1072 Chrome_FileUserBlockingThread |
| 45 8280 Chrome_HistoryThread |
| 46 7472 Chrome_IOThread |
| 47 6336 Chrome_ProcessLauncherThread |
| 48 12212 CompositorTileWorker1/12212 |
| 49 3628 CrBrowserMain |
| 50 6472 DnsConfigService |
| 51 1980 IndexedDB |
| 52 10560 TaskSchedulerBackgroundBlockingWorker0 |
| 53 11464 TaskSchedulerBackgroundWorker0 |
| 54 3156 TaskSchedulerForegroundBlockingWorker5 |
| 55 7660 TaskSchedulerForegroundWorker0 |
| 56 8216 TaskSchedulerServiceThread |
| 57 11088 VideoCaptureThread |
| 58 |
| 59 The threads have been sorted by their names. Note that some threads have |
| 60 no names in this example. If checking them using Visual Studio debugger, it |
| 61 is found that they are ntdll.dll!WorkerThreads. |
OLD | NEW |