"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_net_packets.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_net_packets.py  (dstat-0.7.3):dstat_net_packets.py  (dstat-0.7.4)
skipping to change at line 43 skipping to change at line 43
elif not op.full: elif not op.full:
varlist = ('total',) varlist = ('total',)
else: else:
varlist = self.discover varlist = self.discover
# if len(varlist) > 2: varlist = varlist[0:2] # if len(varlist) > 2: varlist = varlist[0:2]
varlist.sort() varlist.sort()
for name in varlist: for name in varlist:
if name in self.discover + ['total', 'lo']: if name in self.discover + ['total', 'lo']:
ret.append(name) ret.append(name)
if not ret: if not ret:
raise Exception, "No suitable network interfaces found to monitor" raise Exception('No suitable network interfaces found to monitor')
return ret return ret
def name(self): def name(self):
return ['pkt/'+name for name in self.vars] return ['pkt/'+name for name in self.vars]
def extract(self): def extract(self):
self.set2['total'] = [0, 0] self.set2['total'] = [0, 0]
for l in self.splitlines(replace=':'): for l in self.splitlines(replace=':'):
if len(l) < 17: continue if len(l) < 17: continue
if l[2] == '0' and l[10] == '0': continue if l[2] == '0' and l[10] == '0': continue
name = l[0] name = l[0]
if name in self.vars : if name in self.vars :
self.set2[name] = ( long(l[2]), long(l[10]) ) self.set2[name] = ( int(l[2]), int(l[10]) )
if not self.totalfilter.match(name): if not self.totalfilter.match(name):
self.set2['total'] = ( self.set2['total'][0] + long(l[2]), self. set2['total'][1] + long(l[10])) self.set2['total'] = ( self.set2['total'][0] + int(l[2]), self.s et2['total'][1] + int(l[10]))
if update: if update:
for name in self.set2.keys(): for name in self.set2:
self.val[name] = map(lambda x, y: (y - x) * 1.0 / elapsed, self. self.val[name] = list(map(lambda x, y: (y - x) * 1.0 / elapsed,
set1[name], self.set2[name]) self.set1[name], self.set2[name]))
if step == op.delay: if step == op.delay:
self.set1.update(self.set2) self.set1.update(self.set2)
 End of changes. 4 change blocks. 
6 lines changed or deleted 6 lines changed or added

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