>.> wrote: > I got the interface name from win32util.browse() in Vista and XP. I > think XP is Giving me the wrong number because it differs from what > I'm reading in perfmon everytime and it seems to be counting down from > that number after every subsequent call. > ex: perfmon will give me a last of 0.0 and > win32pdhutil.GetPerformanceAttributes('Network Interface','Bytes > Received/sec','Intel[R] PRO_100 VE Network Connection - Packet > Scheduler Miniport') > > Will return something like 12107 and will go down every subsequent call.
Insert a call to win32pdh.CollectQueryData(hq) before you fetch the counter value. The counters are only fetched when you send a query, and that's done with CollectQueryData. For me, this produces exactly the same numbers as perfmon: import win32pdh import time intf = "NVIDIA nForce Networking Controller - Packet Scheduler Miniport" hq = win32pdh.OpenQuery() cp = win32pdh.MakeCounterPath( (None, 'Network Interface', intf, None, -1, 'Bytes Received/sec') ) hc = win32pdh.AddCounter( hq, cp ) for i in range(100): win32pdh.CollectQueryData( hq ) tp,val = win32pdh.GetFormattedCounterValue( hc, win32pdh.PDH_FMT_LONG ) print hex(tp),val time.sleep(1) -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32