"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_top_cpu.py" between
dstat-0.7.3.tar.gz and dstat-0.7.4.tar.gz

About: dstat is a versatile resource statistic tool and a replacement for vmstat, iostat and ifstat (using Python).

dstat_top_cpu.py  (dstat-0.7.3):dstat_top_cpu.py  (dstat-0.7.4)
skipping to change at line 33 skipping to change at line 33
for pid in proc_pidlist(): for pid in proc_pidlist():
try: try:
### Using dopen() will cause too many open files ### Using dopen() will cause too many open files
l = proc_splitline('/proc/%s/stat' % pid) l = proc_splitline('/proc/%s/stat' % pid)
except IOError: except IOError:
continue continue
if len(l) < 15: continue if len(l) < 15: continue
### Reset previous value if it doesn't exist ### Reset previous value if it doesn't exist
if not self.pidset1.has_key(pid): if pid not in self.pidset1:
self.pidset1[pid] = 0 self.pidset1[pid] = 0
self.pidset2[pid] = long(l[13]) + long(l[14]) self.pidset2[pid] = int(l[13]) + int(l[14])
usage = (self.pidset2[pid] - self.pidset1[pid]) * 1.0 / elapsed / cp unr usage = (self.pidset2[pid] - self.pidset1[pid]) * 1.0 / elapsed / cp unr
### Is it a new topper ? ### Is it a new topper ?
if usage < self.val['max']: continue if usage < self.val['max']: continue
name = l[1][1:-1] name = l[1][1:-1]
self.val['max'] = usage self.val['max'] = usage
self.val['pid'] = pid self.val['pid'] = pid
self.val['name'] = getnamebypid(pid, name) self.val['name'] = getnamebypid(pid, name)
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)