for an automated test framework I need to monitor the working set of a 64 bit process that I started. Somehow I can't find a solution that allows to monitor more than 4GB data. I tried WMI and psutil, but both are stuck in 32bit borders. I do something like this:
import wmi
import psutil
import subprocess
def measure_memory( process ):
mem = psutil.Process( process.pid ).get_memory_info().rss
return "%.2f M" % (float(mem)/1024./1024.)
def measure_memory_wmi( process ):
w = wmi.WMI('.')
result = w.query("SELECT WorkingSet FROM Win32_PerfRawData_PerfProc_Process WHERE IDProcess="+str(process.pid))
subset = result[0]
return "%.2f M" % (float(subset.WorkingSet)/1024./1024.)
process = subprocess.Popen( [path_to_program, '-option'] )
print measure_memory( process )
print measure_memory_wmi( process )
this delivers:
-0.00 M
4096.00 M
while the process explorer delivers
6.806.976 K
is there another way to get the real data?
Thanks!