[python-win32] Simple questions aboutwin32pdhutil.GetPerformanceAttributes

Mark Hammond mhammond at skippinet.com.au
Thu Apr 27 00:37:27 CEST 2006


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 :)

Cheers,

Mark
  -----Original Message-----
  From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org]On Behalf Of Tino Dai
  Sent: Thursday, 27 April 2006 8:25 AM
  To: Python-win32 at python.org
  Subject: [python-win32] Simple questions
aboutwin32pdhutil.GetPerformanceAttributes


  Hi there,

        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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060427/a8f17b4d/attachment.html 


More information about the Python-win32 mailing list