dstat_top_oom.py (dstat-0.7.3) | : | dstat_top_oom.py (dstat-0.7.4) | ||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
class dstat_plugin(dstat): | class dstat_plugin(dstat): | |||
def __init__(self): | def __init__(self): | |||
self.name = 'out of memory' | self.name = 'out of memory' | |||
self.vars = ('kill score',) | self.vars = ('kill score',) | |||
self.type = 's' | self.type = 's' | |||
self.width = 18 | self.width = 18 | |||
self.scale = 0 | self.scale = 0 | |||
def check(self): | def check(self): | |||
if not os.access('/proc/self/oom_score', os.R_OK): | if not os.access('/proc/self/oom_score', os.R_OK): | |||
raise Exception, 'Kernel does not support /proc/pid/oom_score, use a t least 2.6.11.' | raise Exception('Kernel does not support /proc/pid/oom_score, use at least 2.6.11.') | |||
def extract(self): | def extract(self): | |||
self.output = '' | self.output = '' | |||
self.val['max'] = 0.0 | self.val['max'] = 0.0 | |||
for pid in proc_pidlist(): | for pid in proc_pidlist(): | |||
try: | try: | |||
### Extract name | ### Extract name | |||
name = proc_splitline('/proc/%s/stat' % pid)[1][1:-1] | name = proc_splitline('/proc/%s/stat' % pid)[1][1:-1] | |||
### Using dopen() will cause too many open files | ### Using dopen() will cause too many open files | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |