"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_innodb_buffer.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_innodb_buffer.py  (dstat-0.7.3):dstat_innodb_buffer.py  (dstat-0.7.4)
skipping to change at line 17 skipping to change at line 17
def __init__(self): def __init__(self):
self.name = 'innodb pool' self.name = 'innodb pool'
self.nick = ('crt', 'rea', 'wri') self.nick = ('crt', 'rea', 'wri')
self.vars = ('created', 'read', 'written') self.vars = ('created', 'read', 'written')
self.type = 'f' self.type = 'f'
self.width = 3 self.width = 3
self.scale = 1000 self.scale = 1000
def check(self): def check(self):
if not os.access('/usr/bin/mysql', os.X_OK): if not os.access('/usr/bin/mysql', os.X_OK):
raise Exception, 'Needs MySQL binary' raise Exception('Needs MySQL binary')
try: try:
self.stdin, self.stdout, self.stderr = dpopen('/usr/bin/mysql -n %s' % mysql_options) self.stdin, self.stdout, self.stderr = dpopen('/usr/bin/mysql -n %s' % mysql_options)
except IOError, e: except IOError as e:
raise Exception, 'Cannot interface with MySQL binary (%s)' % e raise Exception('Cannot interface with MySQL binary (%s)' % e)
def extract(self): def extract(self):
try: try:
self.stdin.write('show engine innodb status\G\n') self.stdin.write('show engine innodb status\G\n')
line = greppipe(self.stdout, 'Pages read ') line = greppipe(self.stdout, 'Pages read ')
if line: if line:
l = line.split() l = line.split()
self.set2['read'] = int(l[2].rstrip(',')) self.set2['read'] = int(l[2].rstrip(','))
self.set2['created'] = int(l[4].rstrip(',')) self.set2['created'] = int(l[4].rstrip(','))
self.set2['written'] = int(l[6]) self.set2['written'] = int(l[6])
for name in self.vars: for name in self.vars:
self.val[name] = (self.set2[name] - self.set1[name]) * 1.0 / ela psed self.val[name] = (self.set2[name] - self.set1[name]) * 1.0 / ela psed
if step == op.delay: if step == op.delay:
self.set1.update(self.set2) self.set1.update(self.set2)
except IOError, e: except IOError as e:
if op.debug > 1: print '%s: lost pipe to mysql, %s' % (self.filename if op.debug > 1: print('%s: lost pipe to mysql, %s' % (self.filename
, e) , e))
for name in self.vars: self.val[name] = -1 for name in self.vars: self.val[name] = -1
except Exception, e: except Exception as e:
if op.debug > 1: print '%s: exception: %s' % (self.filename, e) if op.debug > 1: print('%s: exception: %s' % (self.filename, e))
for name in self.vars: self.val[name] = -1 for name in self.vars: self.val[name] = -1
# vim:ts=4:sw=4:et # vim:ts=4:sw=4:et
 End of changes. 4 change blocks. 
8 lines changed or deleted 8 lines changed or added

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