[svn] r6207 - in trunk/tools/dstat: . plugins

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Sun Mar 9 04:25:12 CET 2008


Author: dag
Date: 2008-03-09 03:25:08 +0000 (Sun, 09 Mar 2008)
New Revision: 6207

Modified:
   trunk/tools/dstat/ChangeLog
   trunk/tools/dstat/TODO
   trunk/tools/dstat/dstat
   trunk/tools/dstat/plugins/dstat_topbio.py
   trunk/tools/dstat/plugins/dstat_topio.py
Log:
Added improved tick patch (Kelly Long)

Modified: trunk/tools/dstat/ChangeLog
===================================================================
--- trunk/tools/dstat/ChangeLog	2008-03-09 00:37:26 UTC (rev 6206)
+++ trunk/tools/dstat/ChangeLog	2008-03-09 03:25:08 UTC (rev 6207)
@@ -1,3 +1,7 @@
+* 0.6.7svn - ... - release 09/03/2008
+- Added improved tick patch (Kelly Long)
+- Show milliseconds in dstat_time when using --debug cfr. dstat_epoch
+
 * 0.6.7 - Cambridge overdue - released 26/02/2008
 - Only rewrite xterm title when XTERM_SHELL is set to bash
 - Added more Dbt (Debian bug tracker) ids in the ChangeLog and TODO
@@ -8,9 +12,9 @@
 - Fixed a problem with asciidoc DocBook output (Dbt 427214, Michael Ablassmeier)
 - Report when python-curses is missing and colors don't work (eg. on OpenSUSE)
 - Improve --version output wrt. terminal and color support
-- Fixed a few inaccuracies in the man page. (John Goggan)
-- Fixed opening vanished files in /proc in dstat_topcpu.
-- Fixed formatting bug in dstat_topcpu.
+- Fixed a few inaccuracies in the man page (John Goggan)
+- Fixed opening vanished files in /proc in dstat_topcpu
+- Fixed formatting bug in dstat_topcpu
 - Added external dstat_mysql_* and dstat_innodb_* plugins
 - Added greppipe() and matchpipe() to improve performance on pipe-handling
 - Added external dstat_topio and dstat_topbio plugins

Modified: trunk/tools/dstat/TODO
===================================================================
--- trunk/tools/dstat/TODO	2008-03-09 00:37:26 UTC (rev 6206)
+++ trunk/tools/dstat/TODO	2008-03-09 03:25:08 UTC (rev 6207)
@@ -57,7 +57,7 @@
 + Python 1.5 prints 'L' for long, crashes when int()
 + Implement better (?) protection against counter rollovers (see mail from Sebastien Prud'homme)
 + Plugins currently have to be written in python 1.5 to work for dstat15 (lowest common denominator)
-+ When stdout is suspend (Ctrl-S) you get: IOError: [Errno 4] Interrupted system call (Dbt 309953, Marc Lehmann, supastuff at freenode)
++ Because output is unbiffered, when stdout is suspendes (Ctrl-S) you get: IOError: [Errno 4] Interrupted system call (Dbt 309953, Marc Lehmann, supastuff at freenode)
 
 ### Plugin issues
 + plugins that use /proc/pid are reasonably slow
@@ -72,12 +72,12 @@
 + Create modules that can contain samples of different units
 
    CPU: (see mpstat)
-	sys, usr, idl, iow, hiq, siq (percentage)
-      	intr/sec (int)
-	
+    sys, usr, idl, iow, hiq, siq (percentage)
+        intr/sec (int)
+
    IO: (see iostat -x)
-	tps (int)
-	blk_read/sec, blk_wrtn/sec (kB/sec)
+    tps (int)
+    blk_read/sec, blk_wrtn/sec (kB/sec)
 
 + Design proper object model and namespace for _all_ possible stats
 + Create a seperate curses-based tool, much like nmon (dstat stays line-based)

Modified: trunk/tools/dstat/dstat
===================================================================
--- trunk/tools/dstat/dstat	2008-03-09 00:37:26 UTC (rev 6206)
+++ trunk/tools/dstat/dstat	2008-03-09 03:25:08 UTC (rev 6207)
@@ -1276,13 +1276,16 @@
     def __init__(self):
         self.name = 'time'
         self.format = ('s', 14, 0)
+        if op.debug:
+            self.format = ('s', 18, 0)
         self.nick = ('date/time',)
         self.vars = ('time',)
         self.init(self.vars, 1)
 
     def extract(self):
-        ### FIXME: Add milliseconds when using --debug (see dstat_epoch)
         self.val['time'] = time.strftime('%d-%m %H:%M:%S', time.localtime())
+        if op.debug:
+            self.val['time'] = time.strftime('%d-%m %H:%M:%S', time.localtime()) + ".%d" % (time.time() * 1000 % 1000 )
 
     def show(self):
         if step == op.delay:
@@ -1954,7 +1957,7 @@
                 if newwidth <= cols or ( vislist == totlist[:-1] and newwidth < cols ):
                     vislist.append(o)
                     curwidth = newwidth
-    
+
             ### Check when to display the header
             if op.header and rows >= 6:
                 if oldvislist != vislist:
@@ -1980,6 +1983,13 @@
             ansi['default'] = ansi['gray']
         line = ansi['default']
 
+        ### Recalculate the time spend
+        ticknow = time.time()
+        if loop != 0:
+            tick = ticknow - tickbefore
+        if step == op.delay:
+            tickbefore = ticknow
+
         ### Calculate all objects (visible, invisible)
         oline = ''
         for o in totlist:
@@ -1988,7 +1998,6 @@
                 line = line + o.show() + o.showend(totlist, vislist)
             if op.output and step == op.delay:
                 oline = oline + o.showcsv() + o.showcsvend(totlist, vislist)
-
         ### Print stats
         sys.stdout.write(line + ansi['default'])
         if op.output and step == op.delay:
@@ -2029,7 +2038,6 @@
 
         loop = (update + op.delay - 1) / op.delay
         step = ((update - 1) % op.delay) + 1
-        tick = step
 
     signal.signal(signal.SIGALRM, signal.SIG_IGN)
 

Modified: trunk/tools/dstat/plugins/dstat_topbio.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_topbio.py	2008-03-09 00:37:26 UTC (rev 6206)
+++ trunk/tools/dstat/plugins/dstat_topbio.py	2008-03-09 03:25:08 UTC (rev 6207)
@@ -17,7 +17,7 @@
 
     def check(self):
         if not os.access('/proc/self/io', os.R_OK):
-            raise Exception, 'Kernel has no I/O accounting, use at least 2.6.20.'
+            raise Exception, 'Kernel has no I/O accounting, use at least 2.6.20'
         return True
 
     def extract(self):

Modified: trunk/tools/dstat/plugins/dstat_topio.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_topio.py	2008-03-09 00:37:26 UTC (rev 6206)
+++ trunk/tools/dstat/plugins/dstat_topio.py	2008-03-09 03:25:08 UTC (rev 6207)
@@ -17,7 +17,7 @@
 
     def check(self):
         if not os.access('/proc/self/io', os.R_OK):
-            raise Exception, 'Kernel has no I/O accounting, use at least 2.6.20.'
+            raise Exception, 'Kernel has no I/O accounting, use at least 2.6.20'
         return True
 
     def extract(self):




More information about the commits mailing list