summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/io/iotop.stp
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-08-07 16:47:18 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-08-07 16:47:18 -0400
commit384c5fe974abe35ab11dce4446dc5eed86585a3b (patch)
tree9bbdc8206d4a9c08866dc2251e40f4f7249696d4 /testsuite/systemtap.examples/io/iotop.stp
parent9b3f22a9b83c4fd5e66874d78f4d35ad742ff802 (diff)
downloadsystemtap-steved-384c5fe974abe35ab11dce4446dc5eed86585a3b.tar.gz
systemtap-steved-384c5fe974abe35ab11dce4446dc5eed86585a3b.tar.xz
systemtap-steved-384c5fe974abe35ab11dce4446dc5eed86585a3b.zip
samples: separate into subdirectories by subsystem
Diffstat (limited to 'testsuite/systemtap.examples/io/iotop.stp')
-rw-r--r--testsuite/systemtap.examples/io/iotop.stp25
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/io/iotop.stp b/testsuite/systemtap.examples/io/iotop.stp
new file mode 100644
index 00000000..6050343c
--- /dev/null
+++ b/testsuite/systemtap.examples/io/iotop.stp
@@ -0,0 +1,25 @@
+global reads, writes, total_io
+
+probe kernel.function("vfs_read") {
+ reads[execname()] += $count
+}
+
+probe kernel.function("vfs_write") {
+ writes[execname()] += $count
+}
+
+# print top 10 IO processes every 5 seconds
+probe timer.s(5) {
+ foreach (name in writes)
+ total_io[name] += writes[name]
+ foreach (name in reads)
+ total_io[name] += reads[name]
+ printf ("%16s\t%10s\t%10s\n", "Process", "KB Read", "KB Written")
+ foreach (name in total_io- limit 10)
+ printf("%16s\t%10d\t%10d\n", name,
+ reads[name]/1024, writes[name]/1024)
+ delete reads
+ delete writes
+ delete total_io
+ print("\n")
+}