Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I identify the thread in application that takes 100% CPU usage in PerfMon?

enter image description here

enter image description here

Trying to fine-tune/optimize my C# application. Been running PerfMon and I consistently get a spike of 100% on some operations. I can get the thread instance number from PerfMon but from Visual Studio 2015's thread window when debugging, how do I know which thread is the corresponding one?

Or am I going about it the wrong way? I want to find out the identity of the thread that's spiking in CPU usage from time to time. Thanks in advance SO!

like image 756
f0rfun Avatar asked Nov 16 '25 01:11

f0rfun


1 Answers

For this I would use Process Explorer. The process properties (double click on a process to open) has a threads tab. This can be sorted by CPU or cycles, and has a button to snapshot the thread stack.

It will also make use of debug symbols to resolve the content of that stack.

This makes it much easier to identify what code a thread is running.

Another option would be PerfView from the Windows Debugging Tools: which gives even more data (but has a steeper learning curve).

like image 156
Richard Avatar answered Nov 17 '25 18:11

Richard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!