AcidCorps Posted December 8, 2007 Share Posted December 8, 2007 I've been working on a script to get information about running processesI used PsaltyDS Function _ProcessListProperties as an exmaple but I'm having trouble with the CPU% part, it always returns 100 for [system Process] and 0 for everythign elseexpandcollapse popup#include <Array.au3> #include <Process.au3> $ProcList1 = ProcessList() Dim $ProcList[$ProcList1[0][0] + 1][8] Dim $a, $b, $c, $d, $e, $f, $g, $h $ProcList[0][0] = $ProcList1[0][0] $o_WMI = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2') $o_Procs = $o_WMI.ExecQuery ('select * from win32_process') For $o_Proc In $o_Procs For $i = 1 To $ProcList[0][0] - 1 If $o_Proc.ProcessID = $ProcList1[$i][1] Then $ProcList[$i][0] = $ProcList1[$i][0] ;Name $ProcList[$i][1] = $ProcList1[$i][1] ;PiD $ProcList[$i][3] = $o_Proc.ParentProcessId ;Parent PiD $ProcList[$i][2] = _ProcessGetName($ProcList[$i][3]) ;Parent Process Name $ProcList[$i][4] = $o_Proc.ExecutablePath ;Executable Path $ProcList[$i][5] = $o_Proc.WorkingSetSize ;Memory Used $ProcList[$i][6] = $o_Proc.PageFileUsage ;Page File Used EndIf Next Next $o_Refresh = ObjCreate('WbemScripting.SWbemRefresher') $c_Procs = $o_Refresh.AddEnum ($o_WMI, 'Win32_PerfFormattedData_PerfProc_Process' ).objectSet $o_Refresh.Refresh Local $i_Time = TimerInit() Do Sleep(10) Until TimerDiff($i_Time) > 100 $o_Refresh.Refresh For $o_Proc In $c_Procs For $i = 1 To $ProcList[0][0] - 1 If $ProcList[$i][1] = $o_Proc.IDProcess Then $ProcList[$i][7] = $o_Proc.PercentProcessorTime ;CPU Load ExitLoop EndIf Next Next _ArrayDisplay($ProcList) Link to comment Share on other sites More sharing options...
JustinReno Posted December 8, 2007 Share Posted December 8, 2007 It works fine for me, and System Process usually takes up 100% CPU. Link to comment Share on other sites More sharing options...
AcidCorps Posted December 8, 2007 Author Share Posted December 8, 2007 ok, thanks for the test then Link to comment Share on other sites More sharing options...
weaponx Posted December 8, 2007 Share Posted December 8, 2007 I have used it extensively and System Idle Process is typically at 100% unless you are running a game or benchmark like Prime95.See here: http://www.autoitscript.com/forum/index.ph...7&hl=graphx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now