Traciatim Posted October 31, 2007 Posted October 31, 2007 I'm looking for a way to find the memory usage of a process, is there a simple way to do this?
weaponx Posted October 31, 2007 Posted October 31, 2007 PSalty made a ProcessGetProperties() UDF:http://www.autoitscript.com/forum/index.ph...mp;#entry409276I also used it to graph cpu usage:http://www.autoitscript.com/forum/index.php?showtopic=55877
schilbiz Posted October 31, 2007 Posted October 31, 2007 This link may be useful as well... http://www.autoitscript.com/forum/lofivers...php?t53973.html
Sardith Posted October 31, 2007 Posted October 31, 2007 Global Const $PROCESS_QUERY_INFORMATION = 0x400 Global Const $PROCESS_VM_READ = 0x10 MsgBox(0,"",_ProcessGetMemoryUsage("iTunes.exe")) Func _ProcessGetMemoryUsage($sProcess) ;get process ID $nPID = ProcessExists($sProcess) If $nPID = 0 Then Return -1 ;get process handle, required for GetProcessMemoryInfo $aRet = DllCall("Kernel32.dll", "int", "OpenProcess", _ "dword", $PROCESS_QUERY_INFORMATION+$PROCESS_VM_READ, "dword", False, "dword", $nPID) If @error Or ($aRet[0] = 0) Then Return -1 $hProc = $aRet[0] ;create PPROCESS_MEMORY_COUNTERS to receive data, required for GetProcessMemoryInfo $structPROCESS_MEMORY_COUNTERS = DllStructCreate("dword; dword; uint peakmemsize; uint memsize; uint; uint; uint; uint; uint; uint") $nSize = DllStructGetSize($structPROCESS_MEMORY_COUNTERS) ;call GetProcessMemoryInfo $aRet = DllCall("Psapi.dll", "int", "GetProcessMemoryInfo", _ "hwnd", $hProc, "ptr", DllStructGetPtr($structPROCESS_MEMORY_COUNTERS), "dword", $nSize) ;close process handle DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", $hProc) ;return memory size in kb Return DllStructGetData($structPROCESS_MEMORY_COUNTERS, "memsize") / 1024 EndFunc [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
Traciatim Posted October 31, 2007 Author Posted October 31, 2007 Thanks for the awesome quick responses.
Azmin87 Posted November 5, 2018 Posted November 5, 2018 Sardith, The codes above given,the result in KB or MB?
user4157124 Posted November 5, 2018 Posted November 5, 2018 Kilobyte (in byte if you remove /1024 from return keyword). AUERLO (AutoIt error logger)
Nine Posted November 5, 2018 Posted November 5, 2018 very old thread ... 2007. there is a current process call that do it in bytes : ProcessGetStats ("process.exe") “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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