summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/io
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-03-18 12:11:25 +0100
committerMark Wielaard <mjw@redhat.com>2009-03-18 12:11:25 +0100
commit7d6fe193398090a3fb1847fc1a286772db114893 (patch)
tree872787782fdd42fb8acfb7999d65071e68509f96 /testsuite/systemtap.examples/io
parent67af0ab2fac61cce5a9a271c385939b5a8c77f87 (diff)
parentbc1a99dfcf9cd081ddf37f362dc1af2158c016b8 (diff)
downloadsystemtap-steved-7d6fe193398090a3fb1847fc1a286772db114893.tar.gz
systemtap-steved-7d6fe193398090a3fb1847fc1a286772db114893.tar.xz
systemtap-steved-7d6fe193398090a3fb1847fc1a286772db114893.zip
Merge branch 'master' into pr6866
Diffstat (limited to 'testsuite/systemtap.examples/io')
-rw-r--r--testsuite/systemtap.examples/io/ioblktime.meta13
-rwxr-xr-xtestsuite/systemtap.examples/io/ioblktime.stp29
2 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/io/ioblktime.meta b/testsuite/systemtap.examples/io/ioblktime.meta
new file mode 100644
index 00000000..18a8b168
--- /dev/null
+++ b/testsuite/systemtap.examples/io/ioblktime.meta
@@ -0,0 +1,13 @@
+title: Average Time Block IO Requests Spend in Queue
+name: ioblktime.stp
+version: 1.0
+author: William Cohen
+keywords: io
+subsystem: kernel
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.
+test_check: stap -p4 ioblktime.stp
+test_installcheck: stap ioblktime.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp
new file mode 100755
index 00000000..5ff59cf7
--- /dev/null
+++ b/testsuite/systemtap.examples/io/ioblktime.stp
@@ -0,0 +1,29 @@
+#! /usr/bin/env stap
+
+global req_time, etimes
+
+probe ioblock.request
+{
+ req_time[$bio] = gettimeofday_us()
+}
+
+probe ioblock.end
+{
+ t = gettimeofday_us()
+ s = req_time[$bio]
+ delete req_time[$bio]
+ if (s) {
+ etimes[devname, bio_rw_str(rw)] <<< t - s
+ }
+}
+
+probe timer.s(10), end {
+ printf("\033[2J\033[1;1H") /* clear screen */
+ printf("%10s %3s %10s %10s %10s\n",
+ "device", "rw", "total (us)", "count", "avg (us)")
+ foreach ([dev,rw] in etimes - limit 20) {
+ printf("%10s %3s %10d %10d %10d\n", dev, rw,
+ @sum(etimes[dev,rw]), @count(etimes[dev,rw]), @avg(etimes[dev,rw]))
+ }
+ delete etimes
+}