Hi,

I am trying to get processor performance stats using the pywin32pdh and
pywin32pdhutil modules. It works fine on Windows 2000 and Windows XP, but
not on Windows server 2003(SP1). I am using Python 2.4.3 and
pywin32-210.win32-py2.4.

Error:
---------------------------------------------------------------------------------
D:\>host_processor.py
% Privileged Time ->
Traceback (most recent call last):
  File "D:\host_processor.py", line 24, in ?
    print key, "->", win32pdhutil.GetPerformanceAttributes("Processor", key, ins
tance)
  File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 61, in Ge
tPerformanceAttributes
    type, val = win32pdh.GetFormattedCounterValue(hc, format)
pywintypes.error: (-1073738810, 'GetFormattedCounterValue', 'No error message is
 available')

D:\>
------------------------------------------------------------------------------

Source:
---------------------------------------------------------------------------
import win32pdh
import win32pdhutil

host_processor_counter_dict = {
                                "% DPC Time" : "",
                                "% Interrupt Time" : "",
                                "% Privileged Time" : "",
                                "% Processor Time" : "",
                                "% User Time" : "",
                                "APC Bypasses/sec" : "",
                                "DPC Bypasses/sec" : "",
                                "DPC Rate" : "",
                                "DPCs Queued/sec" : "",
                                "Interrupts/sec" : "",
                              }

win32pdh.EnumObjects(None, None, win32pdh.PERF_DETAIL_WIZARD)
unused, instances = win32pdh.EnumObjectItems(
                              None, None,'Processor',
win32pdh.PERF_DETAIL_WIZARD)

# Even if there is only one disk, a 'Total' instance is also provided
for instance in instances:
    for key in host_processor_counter_dict.keys():
        print key, "->",
win32pdhutil.GetPerformanceAttributes("Processor", key, instance)
-------------------------------------------------------------------------

Can someone please tell me if something platform specific needs to be
done here ?

Thanks & Regards
Ramaswamy
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to