Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/services/console/lib/procmem/analysis.py
blob: d2a247a68617f952ddcd5ada68fdb9e7e39da55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import proc, proc_smaps

class Analysis:
    
    pid = 0
    
    def __init__(self, pid):
        self.pid = pid
    
    def DirtyRSS(self):
        smaps =    proc_smaps.ProcSmaps(self.pid)
        dirty = []

        private = 0
        shared = 0
        
        for map in smaps.mappings:
            private += map.private_dirty
            shared  += map.shared_dirty

        dirty = {"private": int(private), "shared": int(shared)}

        return dirty
    
    def ApproxRealMemoryUsage(self):
        maps = proc_smaps.ProcMaps(self.pid)
        size = (maps.clean_size/1024)

        return size