diff -up dstat-0.6.8/dstat.counts dstat-0.6.8/dstat
--- dstat-0.6.8/dstat.counts 2008-12-18 08:09:11.000000000 +0100
+++ dstat-0.6.8/dstat 2008-12-23 12:31:15.000000000 +0100
@@ -585,6 +585,7 @@ class dstat_cpu24(dstat):
class dstat_disk(dstat):
def __init__(self):
self.format = ('f', 5, 1024)
+ self.diskfilter = re.compile('(dm-[0-9]+|md[0-9]+|[hs]d[a-z]+[0-9]+)')
self.open('/proc/diskstats')
self.nick = ('read', 'writ')
self.discover = self.discover()
@@ -612,7 +613,7 @@ class dstat_disk(dstat):
else:
list = []
for name in self.discover:
- if not re.match('(md[0-9]+|dm-[0-9]+)', name):
+ if not self.diskfilter.match(name):
list.append(name)
# if len(list) > 2: list = list[0:2]
list.sort()
@@ -629,7 +630,7 @@ class dstat_disk(dstat):
if l[5] == '0' and l[9] == '0': continue
name = l[2]
if l[3:] == ['0',] * 11: continue
- if not re.match('(md[0-9]+|dm-[0-9]+)', name):
+ if not self.diskfilter.match(name):
self.cn2['total'] = ( self.cn2['total'][0] + long(l[5]), self.cn2['total'][1] + long(l[9]) )
if name in self.vars and name != 'total':
self.cn2[name] = ( self.cn2[name][0] + long(l[5]), self.cn2[name][1] + long(l[9]) )
@@ -649,6 +650,7 @@ class dstat_disk(dstat):
class dstat_disk24(dstat):
def __init__(self):
self.format = ('f', 5, 1024)
+ self.diskfilter = re.compile('(dm-[0-9]+|md[0-9]+|[hs]d[a-z]+[0-9]+)')
self.open('/proc/partitions')
self.nick = ('read', 'writ')
self.discover = self.discover()
@@ -677,7 +679,7 @@ class dstat_disk24(dstat):
else:
list = []
for name in self.discover:
- if not re.match('(md[0-9]+|dm-[0-9]+)', name):
+ if not self.diskfilter.match(name):
list.append(name)
# if len(list) > 2: list = list[0:2]
list.sort()
@@ -692,7 +694,7 @@ class dstat_disk24(dstat):
l = line.split()
if len(l) < 15 or l[0] == 'major' or int(l[1]) % 16 != 0: continue
name = l[3]
- if not re.match('(md[0-9]+|dm-[0-9]+)', name):
+ if not self.diskfilter.match(name):
self.cn2['total'] = ( self.cn2['total'][0] + long(l[6]), self.cn2['total'][1] + long(l[10]) )
if name in self.vars:
self.cn2[name] = ( self.cn2[name][0] + long(l[6]), self.cn2[name][1] + long(l[10]) )
@@ -713,9 +715,9 @@ class dstat_disk24(dstat):
class dstat_disk24old(dstat):
def __init__(self):
self.format = ('f', 5, 1024)
+ self.regexp = re.compile('^\((\d+),(\d+)\):\(\d+,\d+,(\d+),\d+,(\d+)\)$')
self.open('/proc/stat')
self.nick = ('read', 'writ')
- self.regexp = re.compile('^\((\d+),(\d+)\):\(\d+,\d+,(\d+),\d+,(\d+)\)$')
self.discover = self.discover()
self.vars = self.vars()
self.name = ['dsk/'+name for name in self.vars]
@@ -748,7 +750,7 @@ class dstat_disk24old(dstat):
else:
list = []
for name in self.discover:
- if not re.match('(md[0-9]+|dm-[0-9]+)', name):
+ if not self.diskfilter.match(name):
list.append(name)
# if len(list) > 2: list = list[0:2]
list.sort()
@@ -770,7 +772,7 @@ class dstat_disk24old(dstat):
l = m.groups()
if len(l) < 4: continue
name = dev(int(l[0]), int(l[1]))
- if not re.match('(md[0-9]+)', name):
+ if not self.diskfilter.match(name):
self.cn2['total'] = ( self.cn2['total'][0] + long(l[2]), self.cn2['total'][1] + long(l[3]) )
if name in self.vars and name != 'total':
self.cn2[name] = ( self.cn2[name][0] + long(l[2]), self.cn2[name][1] + long(l[3]) )