Reputation: 1064
On some machines, my .Net application is idling at ~10% CPU usage. My first inclination is that one of my background worker threads is executing some instructions that I'm not aware of, but I don't know how to isolate CPU usage by thread (Task Manager simply tells me that my process uses x number of threads [usually around 30], not which threads are hogging CPU).
I know that programmatically I can iterate through the threads as mentioned in this post but I don't know if that will give me the information I need. Is there a profiler (commercial or otherwise) that will allow me analyze CPU usage per thread?
Upvotes: 5
Views: 570
Reputation: 707
Try Perfview from Microsoft: http://www.microsoft.com/en-us/download/details.aspx?id=28567
You can use system ETW events to figure out lots of low CPU utilization issues.
Upvotes: 2
Reputation: 29528
How about attaching a debugger and hitting the "break" button. Then just see if any of the threads are running in your code?
Upvotes: 1
Reputation: 8511
I would recommend JetTrace dotTrace Performance. It will tell you where your code is spending most of its time, as well as the thread. (It is commercial but comes with a free 10 day trial.)
Upvotes: 4
Reputation: 40736
I second NominSim's answer and would recommend Red Gate's ANTS Performance Profiler. Helped me a lot in the past.
They do have a 14-days free trial version.
Upvotes: 0