Obtendo uma estatística de CPU por thread

10

Como obtenho o uso atual da CPU para cada thread em um aplicativo específico? É possível obter essas informações de algum lugar ou usando alguma ferramenta?

dabest1
fonte

Respostas:

8

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.

Richard
fonte
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
7

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.

Mark Henderson
fonte
+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
Ugh, sorry, I mixed up my terms. I meant to say perfmon. I'll fix it up now.
Mark Henderson
1

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

KPWINC
fonte
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
0

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!

Nasa
fonte