2006-11-16 13:09:07 +01:00
|
|
|
import proc, proc_smaps
|
|
|
|
|
|
|
|
class Analysis:
|
2006-12-04 20:12:24 +01:00
|
|
|
|
|
|
|
pid = 0
|
|
|
|
|
|
|
|
def __init__(self, pid):
|
|
|
|
self.pid = pid
|
|
|
|
|
|
|
|
def DirtyRSS(self):
|
|
|
|
smaps = proc_smaps.ProcSmaps(self.pid)
|
|
|
|
dirty = []
|
2006-11-16 13:09:07 +01:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
private = 0
|
|
|
|
shared = 0
|
|
|
|
|
|
|
|
for map in smaps.mappings:
|
|
|
|
private += map.private_dirty
|
|
|
|
shared += map.shared_dirty
|
2006-11-16 13:09:07 +01:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
dirty = {"private": int(private), "shared": int(shared)}
|
2006-11-16 13:09:07 +01:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
return dirty
|
|
|
|
|
|
|
|
def ApproxRealMemoryUsage(self):
|
|
|
|
maps = proc_smaps.ProcMaps(self.pid)
|
|
|
|
size = (maps.clean_size/1024)
|
2006-11-16 13:09:07 +01:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
return size
|
|
|
|
|