查看进程占用的内存
2017-04-06 本文已影响17人
流浪骑士
def print_memory():
import psutil
chromes = [p for p in psutil.process_iter() if p.name() == 'chrome.exe']
memories = [c.memory_full_info()[1] / 1024 / 1024 for c in chromes]
max_index = memories.index(max(memories))
print "%s : %s" % (str(chromes[max_index].pid), memories[max_index])
print_memory()