summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorPhilip Knirsch <pknirsch@hamburg.stuttgart.redhat.com>2009-02-23 18:03:35 +0100
committerPhilip Knirsch <pknirsch@hamburg.stuttgart.redhat.com>2009-02-23 18:03:35 +0100
commit80093be74fbed8d4459938e19ff00920a41a9712 (patch)
treec73b82af32e34b7a74bdfd4ca96c4ff3f6cd2465 /contrib
parentc02f25afb09ff1f38484a8b69c4dcc85ed2378c7 (diff)
downloadtuned-80093be74fbed8d4459938e19ff00920a41a9712.tar.gz
tuned-80093be74fbed8d4459938e19ff00920a41a9712.tar.xz
tuned-80093be74fbed8d4459938e19ff00920a41a9712.zip
- Real first complete version with initscript, config file and
proper Makefile and packaging.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/diskdevstat98
-rwxr-xr-xcontrib/diskdevstat.stp93
-rwxr-xr-xcontrib/netdevstat98
-rwxr-xr-xcontrib/netdevstat.stp93
4 files changed, 196 insertions, 186 deletions
diff --git a/contrib/diskdevstat b/contrib/diskdevstat
new file mode 100755
index 0000000..a18d1b7
--- /dev/null
+++ b/contrib/diskdevstat
@@ -0,0 +1,98 @@
+#!/usr/bin/stap
+#
+# diskdevstat: A simple systemtap script to record harddisk activity
+# of processes and display statistics for read/write operations
+# Copyright (C) 2008, 2009 Red Hat, Inc.
+# Authors: Phil Knirsch
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+#
+# Free Software Foundation, Inc.
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301, USA.
+#
+
+global ifavg, iflast
+
+probe vfs.write
+{
+ if(pid() == 0 || devname == "N/A") {
+ next;
+ }
+ ms = gettimeofday_ms();
+ if(iflast[0, pid(), devname, execname(), uid()] == 0) {
+ iflast[0, pid(), devname, execname(), uid()] = ms;
+ } else {
+ diff = ms - iflast[0, pid(), devname, execname(), uid()];
+ iflast[0, pid(), devname, execname(), uid()] = ms;
+ ifavg[0, pid(), devname, execname(), uid()] <<< diff;
+ }
+}
+
+probe vfs.read
+{
+ if(pid() == 0 || devname == "N/A") {
+ next;
+ }
+ ms = gettimeofday_ms();
+ if(iflast[1, pid(), devname, execname(), uid()] == 0) {
+ iflast[1, pid(), devname, execname(), uid()] = ms;
+ } else {
+ diff = ms - iflast[1, pid(), devname, execname(), uid()];
+ iflast[1, pid(), devname, execname(), uid()] = ms;
+ ifavg[1, pid(), devname, execname(), uid()] <<< diff;
+ }
+}
+
+
+function print_activity()
+{
+ printf("\033[2J\033[1;1H")
+ printf("%5s %5s %-7s %9s %9s %9s %9s %9s %9s %9s %9s %-15s\n",
+ "PID", "UID", "DEV", "WRITE_CNT", "WRITE_MIN", "WRITE_MAX",
+ "WRITE_AVG", "READ_CNT", "READ_MIN", "READ_MAX", "READ_AVG",
+ "COMMAND")
+
+ foreach ([type, pid, dev, exec, uid] in ifavg-) {
+ nxmit = @count(ifavg[0, pid, dev, exec, uid])
+ nrecv = @count(ifavg[1, pid, dev, exec, uid])
+ write_min = nxmit ? @min(ifavg[0, pid, dev, exec, uid]) : 0
+ write_max = nxmit ? @max(ifavg[0, pid, dev, exec, uid]) : 0
+ write_avg = nxmit ? @avg(ifavg[0, pid, dev, exec, uid]) : 0
+ read_min = nrecv ? @min(ifavg[1, pid, dev, exec, uid]) : 0
+ read_max = nrecv ? @max(ifavg[1, pid, dev, exec, uid]) : 0
+ read_avg = nrecv ? @avg(ifavg[1, pid, dev, exec, uid]) : 0
+ if(type == 0 || nxmit == 0) {
+ printf("%5d %5d %-7s %9d %5d.%03d %5d.%03d %5d.%03d",
+ pid, uid, dev, nxmit,
+ write_min/1000, write_min%1000,
+ write_max/1000, write_max%1000,
+ write_avg/1000, write_avg%1000)
+ printf(" %9d %5d.%03d %5d.%03d %5d.%03d %-15s\n",
+ nrecv,
+ read_min/1000, read_min%1000,
+ read_max/1000, read_max%1000,
+ read_avg/1000, read_avg%1000,
+ exec)
+ }
+ }
+
+ print("\n")
+}
+
+probe timer.s(5), end, error
+{
+ print_activity()
+}
+
diff --git a/contrib/diskdevstat.stp b/contrib/diskdevstat.stp
deleted file mode 100755
index a049a97..0000000
--- a/contrib/diskdevstat.stp
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/stap
-#
-# diskdevstat: A simple systemtap script to record harddisk activity of processes and
-# display statistics for read/write operations
-# Copyright (C) 2008, 2009 Red Hat, Inc.
-# Authors: Phil Knirsch
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-global ifavg, iflast, ifmin, ifmax;
-
-probe vfs.write
-{
- if(pid() == 0 || devname == "N/A") {
- next;
- }
- ns = gettimeofday_ms();
- if(iflast[0, pid(), devname, execname(), uid()] == 0) {
- iflast[0, pid(), devname, execname(), uid()] = ns;
- } else {
- diff = ns - iflast[0, pid(), devname, execname(), uid()];
- iflast[0, pid(), devname, execname(), uid()] = ns;
- if(ifmin[0, pid(), devname, execname(), uid()] == 0 || diff < ifmin[0, pid(), devname, execname(), uid()])
- ifmin[0, pid(), devname, execname(), uid()] = diff;
- if(diff > ifmax[0, pid(), devname, execname(), uid()])
- ifmax[0, pid(), devname, execname(), uid()] = diff;
- ifavg[0, pid(), devname, execname(), uid()] <<< diff;
- }
-}
-
-probe vfs.read
-{
- if(pid() == 0 || devname == "N/A") {
- next;
- }
- ns = gettimeofday_ms();
- if(iflast[1, pid(), devname, execname(), uid()] == 0) {
- iflast[1, pid(), devname, execname(), uid()] = ns;
- } else {
- diff = ns - iflast[1, pid(), devname, execname(), uid()];
- iflast[1, pid(), devname, execname(), uid()] = ns;
- if(ifmin[1, pid(), devname, execname(), uid()] == 0 || diff < ifmin[1, pid(), devname, execname(), uid()])
- ifmin[1, pid(), devname, execname(), uid()] = diff;
- if(diff > ifmax[1, pid(), devname, execname(), uid()])
- ifmax[1, pid(), devname, execname(), uid()] = diff;
- ifavg[1, pid(), devname, execname(), uid()] <<< diff;
- }
-}
-
-
-function print_activity()
-{
- printf("\033[2J\033[1;1H")
- printf("%5s %5s %-7s %9s %9s %9s %9s %9s %9s %9s %9s %-15s\n",
- "PID", "UID", "DEV", "WRITE_CNT", "WRITE_MIN", "WRITE_MAX", "WRITE_AVG", "READ_CNT", "READ_MIN", "READ_MAX", "READ_AVG", "COMMAND")
-
- foreach ([type, pid, dev, exec, uid] in ifavg-) {
- nxmit = @count(ifavg[0, pid, dev, exec, uid])
- nrecv = @count(ifavg[1, pid, dev, exec, uid])
- if(type == 0 || nxmit == 0) {
- printf("%5d %5d %-7s %9d %5d.%03d %5d.%03d %5d.%03d %9d %5d.%03d %5d.%03d %5d.%03d %-15s\n",
- pid, uid, dev,
- nxmit, ifmin[0, pid, dev, exec, uid]/1000, ifmin[0, pid, dev, exec, uid]%1000,
- ifmax[0, pid, dev, exec, uid]/1000, ifmax[0, pid, dev, exec, uid]%1000,
- nxmit ? @avg(ifavg[0, pid, dev, exec, uid])/1000 : 0, nxmit ? @avg(ifavg[0, pid, dev, exec, uid])%1000 : 0,
- nrecv, ifmin[1, pid, dev, exec, uid]/1000, ifmin[1, pid, dev, exec, uid]%1000,
- ifmax[1, pid, dev, exec, uid]/1000, ifmax[1, pid, dev, exec, uid]%1000,
- nrecv ? @avg(ifavg[1, pid, dev, exec, uid])/1000 : 0, nrecv ? @avg(ifavg[1, pid, dev, exec, uid])%1000 : 0,
- exec)
- }
- }
-
- print("\n")
-}
-
-probe timer.ms(5000), end, error
-{
- print_activity()
-}
-
diff --git a/contrib/netdevstat b/contrib/netdevstat
new file mode 100755
index 0000000..b2b4afc
--- /dev/null
+++ b/contrib/netdevstat
@@ -0,0 +1,98 @@
+#!/usr/bin/stap
+#
+# netdevstat: A simple systemtap script to record network activity of
+# processes and display statistics for transmit/receive operations
+# Copyright (C) 2008, 2009 Red Hat, Inc.
+# Authors: Phil Knirsch
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to:
+#
+# Free Software Foundation, Inc.
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301, USA.
+#
+
+global ifavg, iflast;
+
+probe netdev.transmit
+{
+ if(pid() == 0) {
+ next;
+ }
+ ms = gettimeofday_ms();
+ if(iflast[0, pid(), dev_name, execname(), uid()] == 0) {
+ iflast[0, pid(), dev_name, execname(), uid()] = ms;
+ } else {
+ diff = ms - iflast[0, pid(), dev_name, execname(), uid()];
+ iflast[0, pid(), dev_name, execname(), uid()] = ms;
+ ifavg[0, pid(), dev_name, execname(), uid()] <<< diff;
+ }
+}
+
+probe netdev.receive
+{
+ if(pid() == 0) {
+ next;
+ }
+ ms = gettimeofday_ms();
+ if(iflast[1, pid(), dev_name, execname(), uid()] == 0) {
+ iflast[1, pid(), dev_name, execname(), uid()] = ms;
+ } else {
+ diff = ms - iflast[1, pid(), dev_name, execname(), uid()];
+ iflast[1, pid(), dev_name, execname(), uid()] = ms;
+ ifavg[1, pid(), dev_name, execname(), uid()] <<< diff;
+ }
+}
+
+function print_activity()
+{
+ printf("\033[2J\033[1;1H")
+ printf("%5s %5s %-7s %9s %9s %9s %9s %9s %9s %9s %9s %-15s\n",
+ "PID", "UID", "DEV",
+ "XMIT_CNT", "XMIT_MIN", "XMIT_MAX", "XMIT_AVG",
+ "RECV_CNT", "RECV_MIN", "RECV_MAX", "RECV_AVG",
+ "COMMAND")
+
+ foreach ([type, pid, dev, exec, uid] in ifavg-) {
+ nxmit = @count(ifavg[0, pid, dev, exec, uid])
+ nrecv = @count(ifavg[1, pid, dev, exec, uid])
+ xmit_min = nxmit ? @min(ifavg[0, pid, dev, exec, uid]) : 0
+ xmit_max = nxmit ? @max(ifavg[0, pid, dev, exec, uid]) : 0
+ xmit_avg = nxmit ? @avg(ifavg[0, pid, dev, exec, uid]) : 0
+ recv_min = nrecv ? @min(ifavg[1, pid, dev, exec, uid]) : 0
+ recv_max = nrecv ? @max(ifavg[1, pid, dev, exec, uid]) : 0
+ recv_avg = nrecv ? @avg(ifavg[1, pid, dev, exec, uid]) : 0
+ if(type == 0 || nxmit == 0) {
+ printf("%5d %5d %-7s %9d %5d.%03d %5d.%03d %5d.%03d ",
+ pid, uid, dev, nxmit,
+ xmit_min/1000, xmit_min%1000,
+ xmit_max/1000, xmit_max%1000,
+ xmit_avg/1000, xmit_avg%1000)
+ printf("%9d %5d.%03d %5d.%03d %5d.%03d %-15s\n",
+ nrecv,
+ recv_min/1000, recv_min%1000,
+ recv_max/1000, recv_max%1000,
+ recv_avg/1000, recv_avg%1000,
+ exec)
+ }
+ }
+
+ print("\n")
+}
+
+probe timer.s(5), end, error
+{
+ print_activity()
+}
+
diff --git a/contrib/netdevstat.stp b/contrib/netdevstat.stp
deleted file mode 100755
index b5b0c2a..0000000
--- a/contrib/netdevstat.stp
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/stap
-#
-# netdevstat: A simple systemtap script to record network activity of processes and
-# display statistics for transmit/receive operations
-# Copyright (C) 2008, 2009 Red Hat, Inc.
-# Authors: Phil Knirsch
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-global ifavg, iflast, ifmin, ifmax;
-
-probe netdev.transmit
-{
- if(pid() == 0) {
- next;
- }
- ns = gettimeofday_ms();
- if(iflast[0, pid(), dev_name, execname(), uid()] == 0) {
- iflast[0, pid(), dev_name, execname(), uid()] = ns;
- } else {
- diff = ns - iflast[0, pid(), dev_name, execname(), uid()];
- iflast[0, pid(), dev_name, execname(), uid()] = ns;
- if(ifmin[0, pid(), dev_name, execname(), uid()] == 0 || diff < ifmin[0, pid(), dev_name, execname(), uid()])
- ifmin[0, pid(), dev_name, execname(), uid()] = diff;
- if(diff > ifmax[0, pid(), dev_name, execname(), uid()])
- ifmax[0, pid(), dev_name, execname(), uid()] = diff;
- ifavg[0, pid(), dev_name, execname(), uid()] <<< diff;
- }
-}
-
-probe netdev.receive
-{
- if(pid() == 0) {
- next;
- }
- ns = gettimeofday_ms();
- if(iflast[1, pid(), dev_name, execname(), uid()] == 0) {
- iflast[1, pid(), dev_name, execname(), uid()] = ns;
- } else {
- diff = ns - iflast[1, pid(), dev_name, execname(), uid()];
- iflast[1, pid(), dev_name, execname(), uid()] = ns;
- if(ifmin[1, pid(), dev_name, execname(), uid()] == 0 || diff < ifmin[1, pid(), dev_name, execname(), uid()])
- ifmin[1, pid(), dev_name, execname(), uid()] = diff;
- if(diff > ifmax[1, pid(), dev_name, execname(), uid()])
- ifmax[1, pid(), dev_name, execname(), uid()] = diff;
- ifavg[1, pid(), dev_name, execname(), uid()] <<< diff;
- }
-}
-
-
-function print_activity()
-{
- printf("\033[2J\033[1;1H")
- printf("%5s %5s %-7s %9s %9s %9s %9s %9s %9s %9s %9s %-15s\n",
- "PID", "UID", "DEV", "XMIT_CNT", "XMIT_MIN", "XMIT_MAX", "XMIT_AVG", "RECV_CNT", "RECV_MIN", "RECV_MAX", "RECV_AVG", "COMMAND")
-
- foreach ([type, pid, dev, exec, uid] in ifavg-) {
- nxmit = @count(ifavg[0, pid, dev, exec, uid])
- nrecv = @count(ifavg[1, pid, dev, exec, uid])
- if(type == 0 || nxmit == 0) {
- printf("%5d %5d %-7s %9d %5d.%03d %5d.%03d %5d.%03d %9d %5d.%03d %5d.%03d %5d.%03d %-15s\n",
- pid, uid, dev,
- nxmit, ifmin[0, pid, dev, exec, uid]/1000, ifmin[0, pid, dev, exec, uid]%1000,
- ifmax[0, pid, dev, exec, uid]/1000, ifmax[0, pid, dev, exec, uid]%1000,
- nxmit ? @avg(ifavg[0, pid, dev, exec, uid])/1000 : 0, nxmit ? @avg(ifavg[0, pid, dev, exec, uid])%1000 : 0,
- nrecv, ifmin[1, pid, dev, exec, uid]/1000, ifmin[1, pid, dev, exec, uid]%1000,
- ifmax[1, pid, dev, exec, uid]/1000, ifmax[1, pid, dev, exec, uid]%1000,
- nrecv ? @avg(ifavg[1, pid, dev, exec, uid])/1000 : 0, nrecv ? @avg(ifavg[1, pid, dev, exec, uid])%1000 : 0,
- exec)
- }
- }
-
- print("\n")
-}
-
-probe timer.ms(5000), end, error
-{
- print_activity()
-}
-