Chromium Code Reviews| 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 present . | |
|
brucedawson
2017/02/23 01:57:26
One character too long... There are a few others t
chengx
2017/02/23 03:26:03
Done.
| |
| 8 | |
| 9 The problem setting can be referred to | |
| 10 https://bugs.chromium.org/p/chromium/issues/detail?id=684203 | |
| 11 | |
| 12 This tool incorporates the GetThreadDescription API trying to get names of all | |
| 13 threads in a process specified by its ID. If the thread names have been set by | |
| 14 SetThreadDescription API call like in Chrome, all thread ID/name pairs are | |
| 15 returned. | |
| 16 | |
| 17 [Requirement] | |
| 18 Since SetThreadDescription/GetThreadDescription APIs are brought in Windows 10, | |
| 19 version 1607, this tool can only be effective if running in this version or | |
| 20 later ones. | |
| 21 | |
| 22 [Complie the code] | |
|
brucedawson
2017/02/23 01:57:26
Typo
chengx
2017/02/23 03:26:03
Done.
| |
| 23 When compiling the code after downloading the files (.cc, .sln, .vcxproj). You | |
| 24 may get compile error like "Cannot convert argument 1 from const wchar_t to | |
| 25 LPCSTR". If this happens, right click project "ShowThreadNames", go to | |
| 26 "Properties", then go to "General". In panel "Project Defaults", change to "Use | |
| 27 Unicode Character Set" in "Character Set" section. | |
|
brucedawson
2017/02/23 01:57:26
This should be stored in the project file so this
chengx
2017/02/23 03:26:03
Done.
| |
| 28 | |
| 29 [How to use it] | |
| 30 Run "ShowThreadNames.exe" either from the build direcotory or from Visual Studio . | |
|
brucedawson
2017/02/23 01:57:26
directory
chengx
2017/02/23 03:26:03
Done.
| |
| 31 No parameters are needed. This tool allows interaction with users. Once launched , | |
| 32 it will show "Please enter the process Id, or "quit" to end the program :" on th e | |
| 33 terminal. Simply type in the ID of any Chrome process you are interested in, and | |
| 34 you will get output like below: | |
| 35 | |
| 36 thread_ID thread_name | |
| 37 12116 | |
| 38 10292 | |
| 39 6532 | |
| 40 6928 | |
| 41 2488 | |
| 42 11304 | |
| 43 2256 AudioThread | |
| 44 9308 BrokerEvent | |
| 45 5668 BrowserWatchdog | |
| 46 4352 Chrome_CacheThread | |
| 47 12268 Chrome_DBThread | |
| 48 8616 Chrome_FileThread | |
| 49 1072 Chrome_FileUserBlockingThread | |
| 50 8280 Chrome_HistoryThread | |
| 51 7472 Chrome_IOThread | |
| 52 6336 Chrome_ProcessLauncherThread | |
| 53 12212 CompositorTileWorker1/12212 | |
| 54 3628 CrBrowserMain | |
| 55 6472 DnsConfigService | |
| 56 1980 IndexedDB | |
| 57 10560 TaskSchedulerBackgroundBlockingWorker0 | |
| 58 11464 TaskSchedulerBackgroundWorker0 | |
| 59 3156 TaskSchedulerForegroundBlockingWorker5 | |
| 60 7660 TaskSchedulerForegroundWorker0 | |
| 61 8216 TaskSchedulerServiceThread | |
| 62 11088 VideoCaptureThread | |
| 63 | |
| 64 The threads have been sorted by their names. Note that some threads have | |
| 65 no names. If double checking them using Visual Studio debugger, it is | |
| 66 found that they are ntdll.dll thread in this example. | |
| OLD | NEW |