[python-win32] win32pdhutil failing on counters with a "/"

Jeffrey Melloy jmelloy at gmail.com
Wed Mar 30 19:49:24 CEST 2011


My script to parse perfmon data is working correctly, however, when I
have a counter name with "/" in it, it seems to throw an error in
GetFormattedData.

Has anyone seen this before?

import win32pdhutil

machine = "\\\\seaweb001p"
object = "Memory"

counters, instances = win32pdh.EnumObjectItems(None, machine, object, 500)

if instances == []:
    instances = [None]

for cnt in counters:
    for inst in instances:
        try:
            x = win32pdhutil.GetPerformanceAttributes(object = object,
counter = cnt, instance = inst, machine=machine,
format=win32pdh.PDH_FMT_DOUBLE)
            print cnt, inst, x
        except Exception, e:
                print cnt, inst, e


Page Faults/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Available Bytes None 1669623808.0
Committed Bytes None 2364002304.0
Commit Limit None 8408195072.0
Write Copies/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Transition Faults/sec None (-1073738810, 'GetFormattedCounterValue',
'The data is not valid.')
Cache Faults/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Demand Zero Faults/sec None (-1073738810, 'GetFormattedCounterValue',
'The data is not valid.')
Pages/sec None (-1073738810, 'GetFormattedCounterValue', 'The data is
not valid.')
Pages Input/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Page Reads/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Pages Output/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Pool Paged Bytes None 81498112.0
Pool Nonpaged Bytes None 55918592.0
Page Writes/sec None (-1073738810, 'GetFormattedCounterValue', 'The
data is not valid.')
Pool Paged Allocs None 184892.0
Pool Nonpaged Allocs None 197360.0
Free System Page Table Entries None 75581.0
Cache Bytes None 134574080.0
Cache Bytes Peak None 201498624.0
Pool Paged Resident Bytes None 80728064.0
System Code Total Bytes None 1404928.0
System Code Resident Bytes None 229376.0
System Driver Total Bytes None 2408448.0
System Driver Resident Bytes None 2473984.0
System Cache Resident Bytes None 51142656.0
% Committed Bytes In Use None 28.1006458552
Available KBytes None 1632276.0
Available MBytes None 1594.0
Transition Pages RePurposed/sec None (-1073738810,
'GetFormattedCounterValue', 'The data is not valid.')


More information about the python-win32 mailing list