"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_disk_wait.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_disk_wait.py  (dstat-0.7.3):dstat_disk_wait.py  (dstat-0.7.4)
skipping to change at line 30 skipping to change at line 30
def discover(self, *objlist): def discover(self, *objlist):
ret = [] ret = []
for l in self.splitlines(): for l in self.splitlines():
if len(l) < 13: continue if len(l) < 13: continue
if l[3:] == ['0',] * 11: continue if l[3:] == ['0',] * 11: continue
name = l[2] name = l[2]
ret.append(name) ret.append(name)
for item in objlist: ret.append(item) for item in objlist: ret.append(item)
if not ret: if not ret:
raise Exception, "No suitable block devices found to monitor" raise Exception('No suitable block devices found to monitor')
return ret return ret
def vars(self): def vars(self):
ret = [] ret = []
if op.disklist: if op.disklist:
varlist = op.disklist varlist = op.disklist
else: else:
varlist = [] varlist = []
blockdevices = [os.path.basename(filename) for filename in glob.glob ('/sys/block/*')] blockdevices = [os.path.basename(filename) for filename in glob.glob ('/sys/block/*')]
for name in self.discover: for name in self.discover:
skipping to change at line 61 skipping to change at line 61
return self.vars return self.vars
def extract(self): def extract(self):
for l in self.splitlines(): for l in self.splitlines():
if len(l) < 13: continue if len(l) < 13: continue
if l[5] == '0' and l[9] == '0': continue if l[5] == '0' and l[9] == '0': continue
if l[3:] == ['0',] * 11: continue if l[3:] == ['0',] * 11: continue
name = l[2] name = l[2]
if name not in self.vars: continue if name not in self.vars: continue
self.set2[name] = dict( self.set2[name] = dict(
rd_ios = long(l[3]), rd_ios = int(l[3]),
wr_ios = long(l[7]), wr_ios = int(l[7]),
rd_ticks = long(l[6]), rd_ticks = int(l[6]),
wr_ticks = long(l[10]), wr_ticks = int(l[10]),
) )
for name in self.vars: for name in self.vars:
rd_tput = self.set2[name]['rd_ios'] - self.set1[name]['rd_ios'] rd_tput = self.set2[name]['rd_ios'] - self.set1[name]['rd_ios']
wr_tput = self.set2[name]['wr_ios'] - self.set1[name]['wr_ios'] wr_tput = self.set2[name]['wr_ios'] - self.set1[name]['wr_ios']
if rd_tput: if rd_tput:
rd_wait = ( self.set2[name]['rd_ticks'] - self.set1[name]['rd_ti cks'] ) * 1.0 / rd_tput rd_wait = ( self.set2[name]['rd_ticks'] - self.set1[name]['rd_ti cks'] ) * 1.0 / rd_tput
else: else:
rd_wait = 0 rd_wait = 0
if wr_tput: if wr_tput:
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added

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