sugar-toolkit-gtk3/services/console/lib/procmem/analysis.py

32 lines
771 B
Python
Raw Normal View History

2006-11-16 13:09:07 +01:00
import proc, proc_smaps
class Analysis:
pid = 0
def __init__(self, pid):
self.pid = pid
def SMaps(self):
smaps = proc_smaps.ProcSmaps(self.pid)
private_dirty = 0
shared_dirty = 0
referenced = 0
2006-11-16 13:09:07 +01:00
for map in smaps.mappings:
private_dirty += map.private_dirty
shared_dirty += map.shared_dirty
referenced += map.referenced
2006-11-16 13:09:07 +01:00
smaps = {"private_dirty": int(private_dirty), \
"shared_dirty": int(shared_dirty),\
"referenced": int(referenced)}
2006-11-16 13:09:07 +01:00
return smaps
def ApproxRealMemoryUsage(self):
maps = proc_smaps.ProcMaps(self.pid)
size = (maps.clean_size/1024)
2006-11-16 13:09:07 +01:00
return size