Update of /cvsroot/pywin32/pywin32/win32/Lib
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12667
Modified Files:
win32pdhutil.py
Log Message:
Accept multiple counters in CallBack for BrowseCounters
Index: win32pdhutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32pdhutil.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** win32pdhutil.py 14 Nov 2008 00:22:25 -0000 1.13
--- win32pdhutil.py 18 May 2010 15:57:41 -0000 1.14
***************
*** 136,152 ****
# NOTE: This BrowseCallback doesn't seem to work on Vista for markh.
# XXX - look at why!?
! def BrowseCallBackDemo(counter):
! machine, object, instance, parentInstance, index, counterName = \
! win32pdh.ParseCounterPath(counter)
! result = GetPerformanceAttributes(object, counterName, instance, index,
! win32pdh.PDH_FMT_DOUBLE, machine)
! print "Value of '%s' is" % counter, result
! print "Added '%s' on object '%s' (machine %s), instance %s(%d)-parent of %s" \
! % (counterName, object, machine, instance, index, parentInstance)
def browse(callback = BrowseCallBackDemo, title="Python Browser",
level=win32pdh.PERF_DETAIL_WIZARD):
! win32pdh.BrowseCounters(None,0, callback, level, title)
if __name__=='__main__':
--- 136,157 ----
# NOTE: This BrowseCallback doesn't seem to work on Vista for markh.
# XXX - look at why!?
! # Some counters on Vista require elevation, and callback would previously
! # clear exceptions without printing them.
! def BrowseCallBackDemo(counters):
! ## BrowseCounters can now return multiple counter paths
! for counter in counters:
! machine, object, instance, parentInstance, index, counterName = \
! win32pdh.ParseCounterPath(counter)
! result = GetPerformanceAttributes(object, counterName, instance, index,
! win32pdh.PDH_FMT_DOUBLE, machine)
! print "Value of '%s' is" % counter, result
! print "Added '%s' on object '%s' (machine %s), instance %s(%d)-parent of %s" \
! % (counterName, object, machine, instance, index, parentInstance)
! return 0
def browse(callback = BrowseCallBackDemo, title="Python Browser",
level=win32pdh.PERF_DETAIL_WIZARD):
! win32pdh.BrowseCounters(None,0, callback, level, title, ReturnMultiple=True)
if __name__=='__main__':
|