Get CPU usage of a single process in Windows

T

Tor Erik

Hi,

This should be possible as Taskmanager tracks CPU usage for every
process... Anyone know how this can be done?

regards
 
T

Tim Golden

Tor said:
Hi,

This should be possible as Taskmanager tracks CPU usage for every
process... Anyone know how this can be done?

WMI can probably do the trick. If you can find something on Google
for wmi cpu usage (or something similar) then translation to Python's
usually quite easy. I'm fairly sure I've got an example somewhere, but
I can't lay my hands on it at the mo.

TJG
 
T

Tim Roberts

Tor Erik said:
This should be possible as Taskmanager tracks CPU usage for every
process... Anyone know how this can be done?

I answered this in the python-win32 mailing list. Task manager and perfmon
do this by using the performance counter APIs. Python-Win32 includes an
interface for that (import win32pdh), but I've never used it.
 
G

Gerrit Muller

Tim Golden wrote:
WMI can probably do the trick. If you can find something on Google
for wmi cpu usage (or something similar) then translation to Python's
usually quite easy. I'm fairly sure I've got an example somewhere, but
I can't lay my hands on it at the mo.

TJG
Tim Golden's general documentation/examples about WMI are at:
<http://tgolden.sc.sabren.com/python/wmi.html>.

If you have a working example of CPU usage could you post the result? I
would be interested.

kind regards, Gerrit Muller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top