Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates

  • Loading branch information...
commit 9d16d5a26cabc89d4f6c0cbde7c4a0255d1f4a02 1 parent 57b2b90
@dagwieers authored
View
3  ChangeLog
@@ -1,6 +1,9 @@
* 0.6.6svn - ... - released 28/04/2007
- Only rewrite xterm title when XTERM_SHELL is set to bash
- Added more Dbt (Debian bug tracker) ids in the ChangeLog and TODO
+- Renamed external dstat_app plugin to dstat_topapp
+- Added external dstat_topmem plugin
+- Improved dstat_topapp CSV output
* 0.6.6 - Unemployed - released 28/04/2007
- Removed SwapCached from the Cached counter (Dbt 418326, Peter Rabbitson)
View
7 TODO
@@ -20,6 +20,11 @@ contact me as well. :) Send an email to: Dag Wieers <dag@wieers.com>
### Export/Graph
+ Interface with rrdtool (python-rrd ?)
+ Allow for different types of export modules (only CSV now)
++ Allow to write out to syslog (or remote syslog)
++ Allow to write unbuffered to disk
+
+### Plugin improvements
++ Don't calculate counters twice when a plugin is loaded twice
### Extending statistics (help welcome!)
+ Add slab plugin (see /proc/slabinfo and slabtop)
@@ -35,6 +40,8 @@ contact me as well. :) Send an email to: Dag Wieers <dag@wieers.com>
+ Allow for SNMP counters to be added
+ Add LVM stats
+ Add number of (active) X sessions and X clients
++ Add a 'most expensive mem app' and 'most expensive io app'
++ Allow to have multiple '1st expensive ... app' and '2nd expensive ... app'
### Documentation (help welcome!)
+ Create document on general system performance tuning
View
53 dstat
@@ -12,11 +12,11 @@
### You should have received a copy of the GNU Library General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-### Copyright 2004, 2005 Dag Wieers <dag@wieers.com>
+### Copyright 2004-2007 Dag Wieers <dag@wieers.com>
from __future__ import generators
-VERSION = '0.6.6'
+VERSION = '0.6.6svn'
def inspath(path):
if os.path.isdir(path) and path not in sys.path:
@@ -1812,31 +1812,42 @@ def main():
try:
import imp
file, pathname, description = imp.find_module('dstat_'+mod)
-# exec compile(readfile(pathname), pathname, 'exec')
- execfile(pathname)
+ ### Try loading python plugin
+ if description[0] == '.py':
+# exec compile(readfile(pathname), pathname, 'exec')
+ execfile(pathname)
+ exec 'o = dstat_%s()' % mod
+ ### Try loading C plugin
+ elif description[0] == '.so':
+ exec 'import dstat_%s' % mod
+ exec 'o = dstat_%s.new()' % mod
+# exec 'o = dstat_%s.init(dstat)' % mod
+# print dir(o)
+# print o.__module__
+# print o.name
+ else:
+ info(1, 'Module is of unknown type.')
except Exception, e:
info(1, 'Module %s failed to load. (%s)' % (mod, e))
-# tb = sys.exc_info()[2]
+# tb = sys.exc_info()[2]
continue
- try:
-# exec compile('o = dstat_%s()' % mod, '<string>', 'single')
- exec 'o = dstat_%s()' % mod
-
### Remove defect stat objects and calculate line length
if not o.check():
raise Exception, 'Unknown problem, please report'
+# except Exception, e:
+# if mod == mods[-1]:
+# info(1, 'Module %s has problems. (%s)' % (mod, e))
+# if op.debug:
+# raise
+# continue
+ else:
+ exec 'o = dstat_%s()' % mod
+# print o.__module__
- linewidth = linewidth + o.statwidth() + 1
- totlist.append(o)
- break
-
- except Exception, e:
- if mod == mods[-1]:
- info(1, 'Module %s has problems. (%s)' % (mod, e))
- if op.debug:
- raise
- continue
+ linewidth = linewidth + o.statwidth() + 1
+ totlist.append(o)
+ break
if not totlist:
die(8, 'None of the stats you selected are available.')
@@ -1929,9 +1940,9 @@ def main():
tt = tt + (t2 - t1) * 1000.0
if loop == 0: tt = tt * step
if op.debug == 1:
- sys.stdout.write('%6.2fms' % (tt / step))
+ sys.stdout.write('%s%6.2fms%s' % (ansi['darkblue'], tt / step, ansi['default']))
elif op.debug > 1:
- sys.stdout.write('%6.2f [%d:%d:%d]' % (tt / step, loop, step, update))
+ sys.stdout.write('%s%6.2f %s%d:%d:%d%s' % (ansi['darkblue'], tt / step, ansi['gray'], loop, step, update, ansi['default']))
### If intermediate results, update increases with 1 sec (=interval)
update = update + interval
View
5 dstat.spec
@@ -9,7 +9,7 @@
Summary: Versatile resource statistics tool
Name: dstat
-Version: 0.6.6
+Version: 0.6.6svn
Release: 1
License: GPL
Group: System Environment/Base
@@ -60,6 +60,9 @@ confusion, less mistakes.
%{_datadir}/dstat/
%changelog
+* Sun Jun 24 2007 Dag Wieers <dag@wieers.com> - 0.6.6svn-1
+- Updated to release 0.6.6svn.
+
* Sat Apr 28 2007 Dag Wieers <dag@wieers.com> - 0.6.6-1
- Updated to release 0.6.6.
View
2  dstat15
@@ -16,7 +16,7 @@
#from __future__ import generators
-VERSION = '0.6.6'
+VERSION = '0.6.6svn'
def inspath(path):
if os.path.isdir(path) and path not in sys.path:
View
27 plugins/dstat_app.py → plugins/dstat_topapp.py
@@ -6,17 +6,17 @@
global string
import string
-class dstat_app(dstat):
+class dstat_topapp(dstat):
def __init__(self):
self.name = 'most expensive'
- self.format = ('s', 18, 0)
- self.nick = ('process',)
+ self.format = ('s', 18, 34)
+ self.nick = ('cpu process',)
self.vars = self.nick
self.pid = str(os.getpid())
self.cn1 = {}; self.cn2 = {}; self.val = {}
def extract(self):
- max = 0.0
+ self.val['usage'] = 0.0
for pid in os.listdir('/proc/'):
try: int(pid)
except: continue
@@ -33,12 +33,12 @@ def extract(self):
usage = (self.cn2[pid] - self.cn1[pid]) * 1.0 / tick
### Get the process that spends the most jiffies
- if usage > max:
- max = usage
+ if usage > self.val['usage']:
+ self.val['usage'] = usage
self.val['name'] = l[1][1:-1]
self.val['pid'] = pid
- if max == 0.0:
+ if self.val['usage'] == 0.0:
self.val['process'] = ''
else:
### If the name is a known interpreter, take the second argument from the cmdline
@@ -47,7 +47,9 @@ def extract(self):
# l = string.split(dopen('/proc/%s/cmdline' % self.val['pid']).read(), '\0')
l = string.split(open('/proc/%s/cmdline' % self.val['pid']).read(), '\0')
if len(l) > 2:
- self.val['name'] = os.path.basename(l[1])
+ self.val['process'] = os.path.basename(l[1])
+ else:
+ self.val['process'] = self.val['name']
# l = l.reverse()
# for x in l:
@@ -56,13 +58,16 @@ def extract(self):
# self.val['name'] = os.path.basename(x)
# break
- ### Show yellow usage
- self.val['process'] = '%-*s%s%3d' % (self.format[1]-3, self.val['name'], ansi['yellow'], round(max))
-
### Debug (show PID)
# self.val['process'] = '%*s %-*s' % (5, self.val['pid'], self.format[1]-6, self.val['name'])
if step == op.delay:
self.cn1.update(self.cn2)
+ def show(self):
+ return '%s%-*s%s%3d' % (ansi['default'], self.format[1]-3, self.val['process'], ansi['yellow'], round(self.val['usage']))
+
+ def showcsv(self):
+ return '%s / %d%%' % (self.val['name'], self.val['usage'])
+
# vim:ts=4:sw=4:et
Please sign in to comment.
Something went wrong with that request. Please try again.