[python-win32] Process monitor

Moray B. Grieve mbg@apama.com
Mon, 29 Apr 2002 15:52:17 +0100


I want to write a python script that monitors a process CPU and memory =
usage, and am basing it on the win32pdhutil wrapper module. However, I =
have noticed that in this module the function GetPerformanceAttributes =
always returns zero for the counter "% Processor Time" even when I know =
a process is using a large amount of CPU (as seen from the windows task =
manager). This is also the same for the counters "% User Time" and "% =
Privileged Time" and is easily demonstrated when running =
ShowAllProcesses, which gives zero for all these three counters and for =
all running processes.

Has anyone noticed this before, or can help me as to how I can retrieve =
the CPU usage of a process?=20

With many thanks for any help,
Moray Grieve