[python-win32] win32pdh problem on Windows Server 2003

Tim Roberts timr at probo.com
Tue Oct 31 18:48:35 CET 2006


S.Ramaswamy wrote:

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

Windows error messages are better handled in hex.  -1073738810 is
C0000BC6, and a quick Google on that shows it is basically "performance
counter not found".

You can use "perfmon" to explore what counters are really present. 
Perhaps the "privileged time" counter was renamed in 2003.  In your
particular case:

>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" : "",
>                              }
>  
>

My XPSP2 system does not contain "APC Bypasses/sec" and "DPC Bypasses/sec".

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list