[svn] r5647 - in trunk/tools/dstat: . docs plugins
packagers at lists.rpmforge.net
packagers at lists.rpmforge.net
Sun Jul 29 15:47:37 CEST 2007
Author: dag
Date: 2007-07-29 15:47:36 +0200 (Sun, 29 Jul 2007)
New Revision: 5647
Modified:
trunk/tools/dstat/ChangeLog
trunk/tools/dstat/docs/dstat.1.txt
trunk/tools/dstat/plugins/dstat_topcpu.py
trunk/tools/dstat/plugins/dstat_topmem.py
Log:
Fixes to dstat_topcpu, dstat_topmem and man page.
Modified: trunk/tools/dstat/ChangeLog
===================================================================
--- trunk/tools/dstat/ChangeLog 2007-07-28 15:48:19 UTC (rev 5646)
+++ trunk/tools/dstat/ChangeLog 2007-07-29 13:47:36 UTC (rev 5647)
@@ -8,6 +8,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.
* 0.6.6 - Unemployed - released 28/04/2007
- Removed SwapCached from the Cached counter (Dbt 418326, Peter Rabbitson)
Modified: trunk/tools/dstat/docs/dstat.1.txt
===================================================================
--- trunk/tools/dstat/docs/dstat.1.txt 2007-07-28 15:48:19 UTC (rev 5646)
+++ trunk/tools/dstat/docs/dstat.1.txt 2007-07-29 13:47:36 UTC (rev 5647)
@@ -83,7 +83,7 @@
-s, --swap::
enable swap stats
--S swal1,total::
+-S swap1,total::
include swap1 and total
-t, --time::
@@ -174,7 +174,7 @@
-----
Using dstat to relate disk-throughput with network-usage (eth0), total CPU-usage and system counters:
----
-dstat -dnyc -n eth0 -C total -f 5
+dstat -dnyc -N eth0 -C total -f 5
----
Checking dstat's behaviour and the system's impact on dstat:
@@ -182,12 +182,21 @@
dstat -taf --debug
----
-Using the external clock and app plugins together with normal system resources:
+Using the time plugin together with cpu, net, disk, system, load, proc and topcpu plugins:
----
-dstat -M clock,app -cndylp
+dstat -tcndylp -M topcpu
----
+this is identical to
+----
+dstat -M time,cpu,net,disk,sys,load,proc,topcpu
+----
+Using dstat to relate cpu stats with interrupts per device:
+----
+dstat -tcyif
+----
+
BUGS
----
Since it's practically impossible to test dstat on every possible
Modified: trunk/tools/dstat/plugins/dstat_topcpu.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_topcpu.py 2007-07-28 15:48:19 UTC (rev 5646)
+++ trunk/tools/dstat/plugins/dstat_topcpu.py 2007-07-29 13:47:36 UTC (rev 5647)
@@ -27,7 +27,10 @@
### Using dopen() will cause too many open files
# l = string.split(dopen('/proc/%s/stat' % pid).read())
- l = string.split(open('/proc/%s/stat' % pid).read())
+ try:
+ l = string.split(open('/proc/%s/stat' % pid).read())
+ except:
+ continue
if len(l) < 15: continue
self.cn2[pid] = int(l[13]) + int(l[14])
@@ -78,8 +81,7 @@
if self.val['usage'] == 0.0:
return '%-*s' % (self.format[1], '')
else:
- return '%s%-*s%s' % (ansi['default'], self.format[1]-3, self.val['process'], cprint(self.val['usage'], ('p', 3, 34)))
-#ansi['yellow'], round(self.val['usage']))
+ return '%s%-*s%s' % (ansi['default'], self.format[1]-3, self.val['process'][0:self.format[1]-3], cprint(self.val['usage'], ('p', 3, 34)))
def showcsv(self):
return '%s / %d%%' % (self.val['name'], self.val['usage'])
Modified: trunk/tools/dstat/plugins/dstat_topmem.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_topmem.py 2007-07-28 15:48:19 UTC (rev 5646)
+++ trunk/tools/dstat/plugins/dstat_topmem.py 2007-07-29 13:47:36 UTC (rev 5647)
@@ -25,7 +25,11 @@
### Using dopen() will cause too many open files
# l = string.split(dopen('/proc/%s/stat' % pid).read())
- l = string.split(open('/proc/%s/stat' % pid).read())
+ try:
+ l = string.split(open('/proc/%s/stat' % pid).read())
+ except:
+ continue
+
if len(l) < 23: continue
usage = int(l[23]) * pagesize
@@ -59,7 +63,7 @@
# self.val['process'] = '%*s %-*s' % (5, self.val['pid'], self.format[1]-6, self.val['name'])
def show(self):
- return '%s%-*s%s' % (ansi['default'], self.format[1]-4, self.val['process'], cprint(self.val['usage'], ('f', 4, 1024)))
+ return '%s%-*s%s' % (ansi['default'], self.format[1]-4, self.val['process'][0:self.format[1]-4], cprint(self.val['usage'], ('f', 4, 1024)))
def showcsv(self):
return '%s / %d%%' % (self.val['name'], self.val['usage'])
More information about the svn-commits
mailing list