On 24 Feb, 23:35, kj <no.em...@please.post> wrote: > Is there some standard module for getting info about the process's > memory usage, in a Linux/Unix system? > > (I want to avoid hacks that involve, e.g., scraping ps's output.) > > Thanks! > > ~K
http://code.google.com/p/psutil >>> import psutil >>> p = psutil.Process(7055) >>> p.cmdline ['/usr/bin/python'] >>> rss, vms = p.get_memory_info() >>> "Resident memory: %s KB" %(rss / 1024) 'Resident memory: 3768 KB' >>> "Virtual memory: %s KB" %(vms / 1024) 'Virtual memory: 6176 KB' >>> p.get_memory_percent() 0.8342 --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list