"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_vz_io.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_vz_io.py  (dstat-0.7.3):dstat_vz_io.py  (dstat-0.7.4)
skipping to change at line 30 skipping to change at line 30
# vfs_write_chars 23864660931174682 # vfs_write_chars 23864660931174682
# io_pbs 16 # io_pbs 16
class dstat_plugin(dstat): class dstat_plugin(dstat):
def __init__(self): def __init__(self):
self.nick = ['read', 'write', 'dirty', 'cancel', 'missed'] self.nick = ['read', 'write', 'dirty', 'cancel', 'missed']
self.cols = len(self.nick) self.cols = len(self.nick)
def check(self): def check(self):
if not os.path.exists('/proc/vz'): if not os.path.exists('/proc/vz'):
raise Exception, 'System does not have OpenVZ support' raise Exception('System does not have OpenVZ support')
elif not os.path.exists('/proc/bc'): elif not os.path.exists('/proc/bc'):
raise Exception, 'System does not have (new) OpenVZ beancounter supp ort' raise Exception('System does not have (new) OpenVZ beancounter suppo rt')
elif not glob.glob('/proc/bc/*/ioacct'): elif not glob.glob('/proc/bc/*/ioacct'):
raise Exception, 'System does not have any OpenVZ containers' raise Exception('System does not have any OpenVZ containers')
info(1, 'Module %s is still experimental.' % self.filename) info(1, 'Module %s is still experimental.' % self.filename)
def name(self): def name(self):
return ['ve/'+name for name in self.vars] return ['ve/'+name for name in self.vars]
def vars(self): def vars(self):
ret = [] ret = []
if not op.full: if not op.full:
varlist = ['total',] varlist = ['total',]
else: else:
skipping to change at line 57 skipping to change at line 57
return ret return ret
def extract(self): def extract(self):
for name in self.vars: for name in self.vars:
self.set2['total'] = {} self.set2['total'] = {}
for line in dopen('/proc/bc/%s/ioacct' % name).readlines(): for line in dopen('/proc/bc/%s/ioacct' % name).readlines():
l = line.split() l = line.split()
if len(l) != 2: continue if len(l) != 2: continue
if l[0] not in self.nick: continue if l[0] not in self.nick: continue
index = self.nick.index(l[0]) index = self.nick.index(l[0])
self.set2[name][index] = long(l[1]) self.set2[name][index] = int(l[1])
self.set2['total'][index] = self.set2['total'][index] + long(l[1 self.set2['total'][index] = self.set2['total'][index] + int(l[1]
]) )
# print name, self.val[name], self.set2[name][0], self.set2[name][1] # print(name, self.val[name], self.set2[name][0], self.set2[name][1])
# print name, self.val[name], self.set1[name][0], self.set1[name][1] # print(name, self.val[name], self.set1[name][0], self.set1[name][1])
self.val[name] = map(lambda x, y: (y - x) / elapsed, self.set1[name] , self.set2[name]) self.val[name] = list(map(lambda x, y: (y - x) / elapsed, self.set1[ name], self.set2[name]))
if step == op.delay: if step == op.delay:
self.set1.update(self.set2) self.set1.update(self.set2)
# vim:ts=4:sw=4:et # vim:ts=4:sw=4:et
 End of changes. 5 change blocks. 
9 lines changed or deleted 9 lines changed or added

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