VerySleepy / verysleepy

Very Sleepy, a sampling CPU profiler for Windows
http://www.codersnotes.com/sleepy
GNU General Public License v2.0
1.07k stars 105 forks source link

Show thread name on threads list, if available. #60

Closed graemekelly closed 6 years ago

graemekelly commented 6 years ago

Find if GetThreadDescription() is available in Kernel32.dll (it's available from the Win10 Creators update onwards). If it is, add another column "Thread Name" to the list of threads shown when selecting which thread(s) to profile. If this function is unavailable, don't show this extra column at all. If it is available, we rely on the application being profiled to have called SetThreadDescription(), but if it has not, we just show "-" instead.

graemekelly commented 6 years ago

We used that older way to set a thread name before the new API in our code but as far as I could figure out, it was only available inside the debugger. I had a quick search there but can't see any way that we could add code to read it. Otherwise I would be happy to add something in for this too.

CyberShadow commented 6 years ago

it was only available inside the debugger

Yes, that's right. Theoretically, Very Sleepy could capture it if the program would set it while it was being profiled. There is some code for "debugging", for the purpose of profiling new threads as they are created, however it is not currently finished, so it would take some work to get it that far.

CyberShadow commented 6 years ago

Thank you for submitting this improvement.