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