Please
see the comments in win32pdhutil.GetPerformanceAttributes - they explain that
many attributes, particularly the processor ones, require 2 samples to give
reasonable results.
The
comment says:
# NOTE: Many counters require 2 samples to give accurate
results,
# including "% Processor Time" (as by definition, at any instant, a
# thread's CPU usage is either 0 or 100). To read counters like this,
# you should copy this function, but keep the counter open, and call
# CollectQueryData() each time you need to know.
# See http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262938
# and http://msdn.microsoft.com/library/en-us/dnperfmo/html/perfmonpt2.asp
# My older explanation for this was that the "AddCounter" process forced
# the CPU to 100%, but the above makes more sense :)
# including "% Processor Time" (as by definition, at any instant, a
# thread's CPU usage is either 0 or 100). To read counters like this,
# you should copy this function, but keep the counter open, and call
# CollectQueryData() each time you need to know.
# See http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262938
# and http://msdn.microsoft.com/library/en-us/dnperfmo/html/perfmonpt2.asp
# My older explanation for this was that the "AddCounter" process forced
# the CPU to 100%, but the above makes more sense :)
Cheers,
Mark
-----Original Message-----Hi there,
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Tino Dai
Sent: Thursday, 27 April 2006 8:25 AM
To: Python-win32@python.org
Subject: [python-win32] Simple questions aboutwin32pdhutil.GetPerformanceAttributes
Is there a list of performance stats that one can get back from GetPerformanceAttribute. In the Python Programming in Win32, there is an example with Memory and Available bytes, but none of the processor stats seem to work. Thanks!
-Tino
_______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32