[pywin32-checkins] pywin32/win32/Lib win32pdhutil.py,1.6,1.7
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-06 13:03:46
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28090/win32/Lib Modified Files: win32pdhutil.py Log Message: Add some comments about "% Processor Time", as many people get confused why it always returns 98% :) (Well, I,m still confused/amazed that it always managed to return exactly 98% in my tests, but I don't think the sample size was enough to be significant! :) Index: win32pdhutil.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32pdhutil.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win32pdhutil.py 1 Sep 2003 08:09:50 -0000 1.6 --- win32pdhutil.py 6 Oct 2003 13:03:41 -0000 1.7 *************** *** 42,45 **** --- 42,50 ---- def GetPerformanceAttributes(object, counter, instance = None, inum=-1, format = win32pdh.PDH_FMT_LONG, machine=None): + # NOTE: If you attempt to use this function to get "% Processor Time", + # it will not work as you expect - the problem is that by creating a + # new query each time, we force the CPU to 100%. If you pull this + # function apart, and only do the inner "CollectQueryData" each time + # you need to know, it will give the correct results. path = win32pdh.MakeCounterPath( (machine,object,instance, None, inum,counter) ) hq = win32pdh.OpenQuery() |