Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed Sep 3, 2007
1 parent 4dde308 commit c3f1b16
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 56 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- 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

* 0.6.6 - Unemployed - released 28/04/2007
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ contact me as well. :) Send an email to: Dag Wieers <dag@wieers.com>
+ 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
+ Write out user input to CSV

### Plugin improvements
+ Don't calculate counters twice when a plugin is loaded twice
Expand Down
67 changes: 23 additions & 44 deletions docs/dstat.1.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
dstat(1)
========
= dstat(1)
Dag Wieers <dag@wieers.com>
v0.6.4, December 2006


NAME
----
== NAME
dstat - versatile tool for generating system resource statistics


SYNOPSIS
--------
== SYNOPSIS
dstat [-afv] [options..] [delay [count]]


DESCRIPTION
-----------
== DESCRIPTION
Dstat is a versatile replacement for vmstat, iostat and ifstat. Dstat
overcomes some of the limitations and adds some extra features.

Expand All @@ -42,8 +38,7 @@ datastat to avoid a name conflict. See Debian bug #283709 for more
information.


OPTIONS
-------
== OPTIONS
-c, --cpu::
enable cpu stats

Expand Down Expand Up @@ -148,17 +143,15 @@ Possible external plugin stats can be listed using::
write CSV output to file


ARGUMENTS
---------
== ARGUMENTS
*delay* is the delay in seconds between each update

*count* is the number of updates to display before exiting

The default delay is 1 and count is unspecified (unlimited)


INTERMEDIATE UPDATES
--------------------
== INTERMEDIATE UPDATES
When invoking dstat with a *delay* greater than 1 and without the
*--noupdate* option, it will show intermediate updates, ie. the first
time a 1 sec average, the second update a 2 second average, etc. until
Expand All @@ -170,8 +163,7 @@ the last final update. The end result is that you get a 10 second
average on a new line, just like with vmstat.


USAGE
-----
== USAGE
Using dstat to relate disk-throughput with network-usage (eth0), total CPU-usage and system counters:
----
dstat -dnyc -N eth0 -C total -f 5
Expand All @@ -197,8 +189,7 @@ dstat -tcyif
----


BUGS
----
== BUGS
Since it's practically impossible to test dstat on every possible
permutation of kernel, python or distribution version, I need your
help and your feedback to fix the remaining problems. If you have
Expand All @@ -209,8 +200,7 @@ mailto:dag@wieers.com[]
Please see the TODO file for known bugs and future plans.


FILES
-----
== FILES
Paths that may contain external dstat_* plugins:

~/.dstat/
Expand All @@ -221,51 +211,40 @@ Paths that may contain external dstat_* plugins:
/usr/local/share/dstat/


SEE ALSO
--------
Performance tools
~~~~~~~~~~~~~~~~~
== SEE ALSO

=== Performance tools
ifstat(1), iftop(8), iostat(1), mpstat(1), netstat(1), nfsstat(1), nstat, vmstat(1), xosview(1)

Debugging tools
~~~~~~~~~~~~~~~
=== Debugging tools
htop, lslk(1), lsof(8), top(1)

Process tracing
~~~~~~~~~~~~~~~
=== Process tracing
ltrace(1), pmap(1), ps(1), pstack(1), strace(1)

Binary debugging
~~~~~~~~~~~~~~~~
=== Binary debugging
ldd(1), file(1), nm(1), objdump(1), readelf(1)

Memory usage tools
~~~~~~~~~~~~~~~~~~
=== Memory usage tools
free(1), memusage, memusagestat, slabtop(1)

Accounting tools
~~~~~~~~~~~~~~~~
=== Accounting tools
dump-acct, dump-utmp, sa(8)

Hardware debugging tools
~~~~~~~~~~~~~~~~~~~~~~~~
=== Hardware debugging tools
dmidecode, ifinfo(1), lsdev(1), lshal(1), lshw(1), lsmod(8), lspci(8), lsusb(8), smartctl(8), x86info(1)

Application debugging
~~~~~~~~~~~~~~~~~~~~~
=== Application debugging
mailstats(8), qshape(1)

Xorg related tools
~~~~~~~~~~~~~~~~~~
=== Xorg related tools
xdpyinfo(1), xrestop(1)

Other useful info
~~~~~~~~~~~~~~~~~
=== Other useful info
proc(5)


AUTHOR
------
== AUTHOR
Written by Dag Wieers mailto:dag@wieers.com[]

Homepage at http://dag.wieers.com/home-made/dstat/[]
Expand Down
7 changes: 5 additions & 2 deletions plugins/dstat_topbio.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def extract(self):
if len(l) != 2: continue
self.cn2[pid][l[0]] = int(l[1])

except ValueError or IOError:
except ValueError:
continue
except IOError:
continue

read_usage = (self.cn2[pid]['read_bytes:'] - self.cn1[pid]['read_bytes:']) * 1.0 / tick
Expand Down Expand Up @@ -81,7 +83,8 @@ def extract(self):
# 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)
for pid in self.cn2.keys():
self.cn1[pid].update(self.cn2[pid])

def show(self):
if self.val['usage'] == 0.0:
Expand Down
18 changes: 11 additions & 7 deletions plugins/dstat_topcpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,30 @@ def extract(self):

if len(l) < 15: continue

### Get commandline
m = string.split(open('/proc/%s/cmdline' % pid).read(), '\0')
if len(m) > 1:
cmd = os.path.basename(m[1])

### Reset previous value if it doesn't exist
if not self.cn1.has_key(pid):
self.cn1[pid] = 0

self.cn2[pid] = int(l[13]) + int(l[14])
usage = (self.cn2[pid] - self.cn1[pid]) * 1.0 / tick

except ValueError or IOError:
except ValueError:
continue
except IOError:
continue

### Get the process that spends the most jiffies
if usage >= self.val['usage']:
self.val['usage'] = usage
self.val['name'] = l[1][1:-1]
self.val['pid'] = pid
st = os.stat("/proc/%s" % pid)
self.val['cmd'] = cmd
# st = os.stat("/proc/%s" % pid)
# if st:
# pw = pwd.getpwuid(st.st_uid)
# if pw:
Expand All @@ -61,11 +69,7 @@ def extract(self):
else:
### If the name is a known interpreter, take the second argument from the cmdline
if self.val['name'] in ('bash', 'csh', 'ksh', 'perl', 'python', 'sh'):
### Using dopen() will cause too many open files
# 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['process'] = os.path.basename(l[1])
self.val['process'] = os.path.basename(cmd)
else:
self.val['process'] = self.val['name']

Expand Down
7 changes: 5 additions & 2 deletions plugins/dstat_topio.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def extract(self):
if len(l) != 2: continue
self.cn2[pid][l[0]] = int(l[1])

except ValueError or IOError:
except ValueError:
continue
except IOError:
continue

read_usage = (self.cn2[pid]['rchar:'] - self.cn1[pid]['rchar:']) * 1.0 / tick
Expand Down Expand Up @@ -83,7 +85,8 @@ def extract(self):
# 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)
for pid in self.cn2.keys():
self.cn1[pid].update(self.cn2[pid])

def show(self):
if self.val['usage'] == 0.0:
Expand Down
4 changes: 3 additions & 1 deletion plugins/dstat_topmem.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def extract(self):
if len(l) < 23: continue
usage = int(l[23]) * pagesize

except ValueError or IOError:
except ValueError:
continue
except IOError:
continue

### Get the process that uses the most memory
Expand Down

0 comments on commit c3f1b16

Please sign in to comment.