Jump to content

Recommended Posts

Posted

Ok looked through it and could get proccess info and such and mem usage but no CPU usage funcs

I need to check how much CPU usage a certain proccess is using

I'm not a noob I know it will spike but I will have a timer on it so if its at like 60+ for more then 20 secs it will kill process

Thnx in ahead

Posted

Ok looked through it and could get proccess info and such and mem usage but no CPU usage funcs

I need to check how much CPU usage a certain proccess is using

I'm not a noob I know it will spike but I will have a timer on it so if its at like 60+ for more then 20 secs it will kill process

Thnx in ahead

Posted

tlokz

Example:

$strComputer = "."
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")

While 1
    $StartTime = _GetProcTime("mplayerc.exe")
    Sleep(1000)
    $EndTime = _GetProcTime("mplayerc.exe")
    $total = Int(($EndTime - $StartTime) / 100000)
    ToolTip("mplayerc.exe used " & $total & "%", 10, 10, "CPU Usage")
WEnd

ToolTip("")

Func _GetProcTime($sProcName)
    If Not ProcessExists($sProcName) Then Return SetError(1, 0, 0)
    
    Local $colProcesses, $objProcess, $sngProcessTime
    
    $colProcesses = $objWMIService.ExecQuery("Select * from Win32_Process Where name = '" & $sProcName & "'")
    
    For $objProcess in $colProcesses
        $sngProcessTime = ($objProcess.KernelModeTime + $objProcess.UserModeTime)
    Next
    
    Return $sngProcessTime
EndFunc
Posted

yup. i notice too. when i run a game and using script i created using AutoIt, the game client freeze a few seconds when certain action taken. maybe because of the game is eating too much memory. ;)

Posted

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...