"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_lustre.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_lustre.py  (dstat-0.7.3):dstat_lustre.py  (dstat-0.7.4)
# Author: Brock Palen <brockp@mlds-networks.com>, Kilian Vavalotti <kilian@stanf ord.edu> # Author: Brock Palen <brockp@mlds-networks.com>, Kilian Vavalotti <kilian@stanf ord.edu>
class dstat_plugin(dstat): class dstat_plugin(dstat):
def __init__(self): def __init__(self):
self.nick = ('read', 'write') self.nick = ('read', 'write')
self.cols = 2
def check(self): def check(self):
if not os.path.exists('/proc/fs/lustre/llite'): if not os.path.exists('/proc/fs/lustre/llite'):
raise Exception, 'Lustre filesystem not found' raise Exception('Lustre filesystem not found')
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 [mount for mount in os.listdir('/proc/fs/lustre/llite')] return [mount for mount in os.listdir('/proc/fs/lustre/llite')]
def vars(self): def vars(self):
return [mount for mount in os.listdir('/proc/fs/lustre/llite')] return [mount for mount in os.listdir('/proc/fs/lustre/llite')]
def extract(self): def extract(self):
for name in self.vars: for name in self.vars:
for l in open(os.path.join('/proc/fs/lustre/llite', name, 'stats')). for line in dopen(os.path.join('/proc/fs/lustre/llite', name, 'stats
splitlines(): ')).readlines():
l = line.split()
if len(l) < 6: continue if len(l) < 6: continue
if l[0] == 'read_bytes': if l[0] == 'read_bytes':
read = long(l[6]) read = int(l[6])
elif l[0] == 'write_bytes': elif l[0] == 'write_bytes':
write = long(l[6]) write = int(l[6])
self.set2[name] = (read, write) self.set2[name] = (read, write)
self.val[name] = map(lambda x, y: (y - x) * 1.0 / elapsed, self.set1 [name], self.set2[name]) self.val[name] = list(map(lambda x, y: (y - x) * 1.0 / 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 # vim:ts=4:sw=4
 End of changes. 6 change blocks. 
6 lines changed or deleted 8 lines changed or added

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