hallo ich brauche eine funktion die mir zb für die explorer exe sagt wie viel ram sie verbraucht kennt ihr eine?
wie viel ram verbraucht ein prozess
-
- [ offen ]
- Sithlord95
- Geschlossen
- Erledigt
-
-
Global $hPsAPI = DllOpen("Psapi.dll")
Global $hKernel = DllOpen("Kernel32.dll")
Global $Prozessname, $PMemInfo, $Text$Prozessname = "explorer.exe"
$PMemInfo = _GetProcessMemInfo($Prozessname)$Text = $Prozessname & @CRLF & @CRLF & _
"PeakWorkingSetSize: " & $PMemInfo[0] & ' kb' & @CRLF & _
"WorkingSetSize: " & $PMemInfo[1] & ' kb' & @CRLF & _
"QuotaPeakPagedPoolUsage: " & $PMemInfo[2] & ' kb' & @CRLF & _
"QuotaPagedPoolUsage: " & $PMemInfo[3] & ' kb' & @CRLF & _
"QuotaPeakNonPagedPoolUsage: " & $PMemInfo[4] & ' kb' & @CRLF & _
"QuotaNonPagedPoolUsage: " & $PMemInfo[5] & ' kb' & @CRLF & _
"PagefileUsage: " & $PMemInfo[6] & ' kb' & @CRLF & _
"PeakPagefileUsage: " & $PMemInfo[7] & ' kb' & @CRLF & _
"PrivateUsage: " & $PMemInfo[8] & ' kb'MsgBox(0,"", $Text)
Func _GetProcessMemInfo($PID)
Local $PROCESS_MEMORY_COUNTERS_EX, $hProcess
Local $aReturn[9]
If IsString($PID) Then $PID = ProcessExists($PID)
If $PID < 1 Then Return SetError(1,1,$aReturn)
$hProcess = DllCall($hKernel,"int", "OpenProcess","dword",0x0400 + 0x0010,"int",0,"dword",$PID)
If @error Or Not $hProcess[0] Then Return SetError(2,2,$aReturn)
$PROCESS_MEMORY_COUNTERS_EX = DllStructCreate("dword; dword; uint; uint; uint; uint; uint; uint; uint; uint; uint")
DllCall($hPsAPI, "int", "GetProcessMemoryInfo", "hwnd", $hProcess[0], "ptr", DllStructGetPtr($PROCESS_MEMORY_COUNTERS_EX), "dword", DllStructGetSize($PROCESS_MEMORY_COUNTERS_EX))
DllCall($hKernel, "int", "CloseHandle", "hwnd", $hProcess[0])
For $i = 0 To 8
$aReturn[$i] = DllStructGetData($PROCESS_MEMORY_COUNTERS_EX, $i + 2) / 1024
Next
Return $aReturn
EndFunc -
weißt du genau welches von den dinger dem verbrauch wie beim windows task manager entspricht?
-
Bei mir stimmt es so überein, also nach der Hilfe ist das WorkingSetSize
$stats = ProcessGetStats("ApiViewer2004.exe")
$Mem = $stats[0]/1024 ; Taskmanager gibt in Kilobyte an
MsgBox(0, '', $Mem)