Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I get the current usage of CPU for each thread in a specific application? Is it possible to get that information from somewhere or using some tool?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

For a quick answer use SysInternal's Process Explorer. Double click on a process to open the details dialogue. the threads tab gives a sortable list of all threads including context switch delta and CPU time.

share|improve this answer
    
I was using Process Explorer before, but did not see the CPU column in there because it was too narrow and only the sorting arrow was visible as the heading of the column. –  dabest1 Aug 21 '09 at 17:32

Perfmon (Performance Monitor) should give you the details you want.

The following assumes Windows 2000, XP or Server 2003. I haven't checked but I think the performance monitor is a bit different in Vista, Windows 7 & Server 2008.

To run the Performance Monitor, go to Start > Control Panel > Administrative Tools > Performance

To add a graph for each thread of an application, right-click on the graph and choose Properties. You might want to remove any of the defaults that it comes with to give you a cleaner graph.

Click the "Add..." button and make sure "Use Local Computer Counters" is checked (unless you want to monitor a different server, in which case, go ahead and choose that option).

Under "Performance Object" choose "Thread"

Select the counter "% Processor Time", and then select all of the threads you wish to monitor (control+click to select multiple). Click "Add" and then "Close".

Back in the properties, you can customise the graph however you wish, by assigning colours, patterns, etc. Click OK.

You might need to start the graphing, if you do, then clicking the red STOP sign so that it's not enabled will start the graph.

share|improve this answer
    
+1'd, except for the WMI comment at the start, since it doesn't have much to do with the rest of the post. What was mentioned works pretty similary for Vista and 2008 too. Finally, you can also start Perfmon by running perfmon.msc –  DougN Aug 21 '09 at 15:50
    
Ugh, sorry, I mixed up my terms. I meant to say perfmon. I'll fix it up now. –  Mark Henderson Aug 21 '09 at 23:05

Process Monitor (sysinternals)

I would think that ProcessMonitor by Sysinternals (recently purchased by Microsoft) would probably work.

Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. It combines the features of two legacy Sysinternals utilities, Filemon and Regmon, and adds an extensive list of enhancements including rich and non-destructive filtering, comprehensive event properties such session IDs and user names, reliable process information, full thread stacks with integrated symbol support for each operation, simultaneous logging to a file, and much more. Its uniquely powerful features will make Process Monitor a core utility in your system troubleshooting and malware hunting toolkit.

Here is the link:

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

share|improve this answer
    
Thanks for your suggestion. Your answer is correct, but what helped me find CPU usage per thread in Process Explorer was the answer that I selected by Richard. –  dabest1 Aug 21 '09 at 17:27

you could use the inbuilt windows performance monitor, just type perfmon at the start, run. once on perfmon, click the plus sign, select process, you choose your process, then select what you want to see. back to basics!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.