summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/io/iostats.stp
diff options
context:
space:
mode:
authorWilliam Cohen <wcohen@redhat.com>2009-02-06 17:44:23 -0500
committerWilliam Cohen <wcohen@redhat.com>2009-02-06 17:44:23 -0500
commit3e4444ed0b5367ee58c89685c2ee072abc185737 (patch)
tree9c2d1cc0976246467834d39b1c48b17a837b428c /testsuite/systemtap.examples/io/iostats.stp
parent5c54d49ebb4da71680cb45e3be221e11b9b8d364 (diff)
downloadsystemtap-steved-3e4444ed0b5367ee58c89685c2ee072abc185737.tar.gz
systemtap-steved-3e4444ed0b5367ee58c89685c2ee072abc185737.tar.xz
systemtap-steved-3e4444ed0b5367ee58c89685c2ee072abc185737.zip
Fold the systemtap.samples/iotask*.stp into systemtap.examples/io/iostats.stp.
Regenerate the catalog information.
Diffstat (limited to 'testsuite/systemtap.examples/io/iostats.stp')
-rw-r--r--testsuite/systemtap.examples/io/iostats.stp44
1 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/io/iostats.stp b/testsuite/systemtap.examples/io/iostats.stp
new file mode 100644
index 00000000..90bb4f5b
--- /dev/null
+++ b/testsuite/systemtap.examples/io/iostats.stp
@@ -0,0 +1,44 @@
+#! /usr/bin/env stap
+global opens, reads, writes, totals
+
+probe begin { printf("starting probe\n") }
+
+probe syscall.open {
+ e=execname();
+ opens[e] <<< 1 # statistics array
+}
+
+probe syscall.read.return {
+ count = $return
+ if ( count >= 0 ) {
+ e=execname();
+ reads[e] <<< count # statistics array
+ totals[e] += count
+ }
+}
+
+probe syscall.write.return {
+ count = $return
+ if (count >= 0 ) {
+ e=execname();
+ writes[e] <<< count # statistics array
+ totals[e] += count
+ }
+}
+
+probe end {
+ printf("\n%16s %8s %8s %8s %8s %8s %8s %8s\n",
+ "", "", "", "read", "read", "", "write", "write")
+ printf("%16s %8s %8s %8s %8s %8s %8s %8s\n",
+ "name", "open", "read", "KB tot", "B avg", "write", "KB tot", "B avg")
+ foreach (name in totals- limit 20) { # sort by total io
+ printf("%16s %8d %8d %8d %8d %8d %8d %8d\n",
+ name, @count(opens[name]),
+ @count(reads[name]),
+ (@count(reads[name]) ? @sum(reads[name])>>10 : 0 ),
+ (@count(reads[name]) ? @avg(reads[name]) : 0 ),
+ @count(writes[name]),
+ (@count(writes[name]) ? @sum(writes[name])>>10 : 0 ),
+ (@count(writes[name]) ? @avg(writes[name]) : 0 ))
+ }
+}