Permalink
Browse files

Fixed python 2.6 string exception issue (Dbt 585219)

  • Loading branch information...
1 parent bde5ad6 commit f225f06b831645fb8f6bb5e48a18016abf41d2de @dagwieers committed Jun 9, 2010
Showing with 21 additions and 23 deletions.
  1. +3 −2 ChangeLog
  2. +0 −1 TODO
  3. +12 −11 docs/counter-rollovers.txt
  4. +1 −1 dstat
  5. +2 −2 plugins/dstat_power.py
  6. +3 −6 plugins/dstat_top_int.py
View
@@ -1,4 +1,4 @@
-* 0.7.1svn - ... - release 23/02/2010
+* 0.7.1svn - ... - release 01/06/2010
- Added external dstat_disk_tps plugin to show transactions per second
- Added support for filtering /dev/vdaX devices (KVM virtio)
- Added external dstat_squid plugin to show squid counters (Jason Friedland)
@@ -16,7 +16,8 @@
- Added external dstat_top_io_adv plugin to show advanced top block I/O usage
- Allow specifying separator for splitline() and splitlines() functions
- Make top-plugins free memory for processes that no longer exist
-- Added external dstat_top_int plugin to show most frequent interrupt (name)
+- Added external dstat_top_int plugin to show most frequent interrupt by name
+- Fixed python 2.6 string exception issue (Dbt 585219)
* 0.7.1 - Just the three of us - release 22/02/2010
- Fix external plugins on python 2.2 and older (eg. RHEL3)
View
@@ -60,7 +60,6 @@ contact me as well. :) Send an email to: Dag Wieers <dag@wieers.com>
+ Add LVM stats
+ Allow to have multiple '1st expensive ... app' and '2nd expensive ... app'
+ Add 'most iowaiting app' plugin
-+ Add 'most busy interrupt' plugin
+ Add systemtap/perf integration
### Plugin issues
@@ -17,27 +17,28 @@ Since /proc is updated every second, this becomes almost impossible to catch.
== How does this impact Dstat ?
Currently Dstat has a problem if you specify delays that are too big. I.e.
using 60 or 120 seconds delay in Dstat will make Dstat check these counters
-only once per minute or every two minutes. In the case the value is reset,
-it might be lower than the previous value (which causes negative values) or
-worse, the value is actually higher (which will go unnoticed and you get
-bogus information and Dstat won't know).
+only once per minute or every two minutes.
+In case a counter rolls over, it may be lower than the previous value, or
+worse, the value may actually be higher. In the first case we compensate
+because we now a rollover (at least one) happened, but if in the interval more
+than one rollover happened, you're screwed. If however the rollover causes
+a higher value than the previous in that interval, you're screwed too :-)
+
+In both situations that you're screwed, we cannot help you either because we
+don't know. So we cannot compensate or even notify the user of the problem.
This is very problematic, and it's important you are aware of this.
== What are the solutions ?
The only fix for Dstat is to check more often than the specified delay.
-Unfortunately, this requires a re-design (or an ugly hack).
+Unfortunately, this requires a re-design (or an ugly hack). But if rollovers
+happen more than once (or values are larger than the max value) we cannot fix
+this.
There are plans to use 64bit counters on Linux and/or changing the output from
using bytes to kbytes. None of this is sure. (add pointers to threads)
-To work-around this problem, you could always use a delay of 1 second, and
-re-calculate averages in Excel. This will work fine as long as you also
-re-calculate the negative values (by adding 2^32 to them).
-
-If the rollovers happen only sporadically, you can just ignore those values.
-
== What can I do ?
Since this is Open Source, you are free to fix this and send me the fix. Or
View
@@ -2077,7 +2077,7 @@ def getcpunr():
if line[0:3] == 'cpu':
cpunr = cpunr + 1
if cpunr < 0:
- raise "Problem finding number of CPUs in system."
+ raise Exception, "Problem finding number of CPUs in system."
return cpunr
def blockdevices():
@@ -4,8 +4,8 @@ class dstat_plugin(dstat):
"""
Power usage information from ACPI.
- Displays the power usage in mwh of your system's battery using ACPI
- information. This information is only available when the battery is
+ Displays the power usage in watt per hour of your system's battery using
+ ACPI information. This information is only available when the battery is
being used (or being charged).
"""
@@ -8,7 +8,7 @@ class dstat_plugin(dstat):
"""
def __init__(self):
self.name = 'most frequent'
- self.vars = ('interrupts',)
+ self.vars = ('interrupt',)
self.type = 's'
self.width = 20
self.scale = 0
@@ -22,7 +22,7 @@ def names(self):
l = line.split()
if len(l) <= cpunr: continue
l1 = l[0].split(':')[0]
- ### Cleanup possible names
+ ### Cleanup possible names from /proc/interrupts
l2 = ' '.join(l[cpunr+2:])
l2 = l2.replace('_hcd:', '/')
l2 = re.sub('@pci[:\d+\.]+', '', l2)
@@ -39,7 +39,7 @@ def extract(self):
for i in range(len(self.intset2)):
total = (self.intset2[i] - self.intset1[i]) * 1.0 / elapsed
- ### Get the process that spends the most jiffies
+ ### Put the highest value in self.val
if total > self.val['total']:
if str(i+1) in self.names.keys():
self.val['name'] = self.names[str(i+1)]
@@ -53,9 +53,6 @@ def extract(self):
if self.val['total'] != 0.0:
self.output = '%-15s%s' % (self.val['name'], cprint(self.val['total'], 'd', 5, 1000))
- ### Debug (show PID)
-# self.output = '%*s %-*s%s %s' % (5, self.val['pid'], self.width-17, self.val['name'][0:self.width-17], cprint(self.val['read_usage'], 'd', 5, 1024), cprint(self.val['write_usage'], 'd', 5, 1024))
-
def showcsv(self):
return '%s / %f' % (self.val['name'], self.val['total'])

0 comments on commit f225f06

Please sign in to comment.