so far as I remember, I've never seen a real solution. The WMI process
times always use the cumulated time since the process has started. What
should, nearly, do the job is:
- take the accurate time from WMI
- take the process list without processing and preserve the collection
- take the accurate time from WMI a second time
- take the process list a second time
- calculate the difference in time
- build the sum for the overall process time of all processes
(This step must build the common set of the two process lists !!![Some
are new, some died]
- build the per cent value for each process
Sorry, I never found time to do it. It's no too complicated, but invokes a
lot of steps.....
Lange Roetterstrasse 7
(Remove the anti-spam-underscore to mail me!)
> set wmi = getobject("winmgmts:")
> wql = "select * from win32_processor " _
> & "where deviceid='cpu0'"
> set results = wmi.execquery(wql)
> for each cpu in results
> msgbox cpu.loadpercentage
> Michael Harris
> Please do not email questions - post them to the newsgroup instead.
> > I have seen this question asked a few times but never specifically
> > answered. How would you imitate the cpu % usage as in the NT task
> > manager (or the unix top command). I have output out all the fields for
> > processes in WMI and none of them talk about cpu %.
> > TIA
> > Michael Janos
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.