summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
authorWilliam Cohen <wcohen@redhat.com>2008-06-20 15:06:42 -0400
committerWilliam Cohen <wcohen@redhat.com>2008-06-20 15:06:42 -0400
commit7fe8474a7a266329b32e4f64af7f642a591799d7 (patch)
tree74e17b27d83d745984f75995f355d638a0c361d8 /testsuite/systemtap.examples
parente3cbdeffc01c18d5aee8a8d43fbd277316a18f87 (diff)
downloadsystemtap-steved-7fe8474a7a266329b32e4f64af7f642a591799d7.tar.gz
systemtap-steved-7fe8474a7a266329b32e4f64af7f642a591799d7.tar.xz
systemtap-steved-7fe8474a7a266329b32e4f64af7f642a591799d7.zip
Add test for dev.stp tapset functions.
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r--testsuite/systemtap.examples/ChangeLog4
-rw-r--r--testsuite/systemtap.examples/traceio2.meta13
-rw-r--r--testsuite/systemtap.examples/traceio2.stp20
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog
index 7905119b..1f15cfd3 100644
--- a/testsuite/systemtap.examples/ChangeLog
+++ b/testsuite/systemtap.examples/ChangeLog
@@ -1,3 +1,7 @@
+2008-06-20 William Cohen <wcohen@redhat.com>
+
+ * traceio2.stp, traceio2.meta: New.
+
2008-06-18 William Cohen <wcohen@redhat.com>
* sleepingBeauties.stp, sleepingBeauties.meta: New.
diff --git a/testsuite/systemtap.examples/traceio2.meta b/testsuite/systemtap.examples/traceio2.meta
new file mode 100644
index 00000000..89561e71
--- /dev/null
+++ b/testsuite/systemtap.examples/traceio2.meta
@@ -0,0 +1,13 @@
+title: Watch I/O Activity on a Particular Device
+name: traceio2.stp
+version: 1.0
+author: Red Hat
+keywords: io
+subsystem: io
+status: production
+exit: user-controlled
+output: trace
+scope: system-wide
+description: Print out the executable name and process number as reads and writes to the specified device occur.
+test_check: stap -p4 traceio2.stp `stat -c "0x%D" /`
+test_installcheck: stap traceio2.stp `stat -c "0x%D" /` -c "sleep 1"
diff --git a/testsuite/systemtap.examples/traceio2.stp b/testsuite/systemtap.examples/traceio2.stp
new file mode 100644
index 00000000..656c38b3
--- /dev/null
+++ b/testsuite/systemtap.examples/traceio2.stp
@@ -0,0 +1,20 @@
+global device_of_interest
+
+probe begin {
+ /* The following is not the most efficient way to do this.
+ One could directly put the result of usrdev2kerndev()
+ into device_of_interest. However, want to test out
+ the other device functions */
+ dev = usrdev2kerndev($1)
+ device_of_interest = MKDEV(MAJOR(dev), MINOR(dev))
+}
+
+probe kernel.function ("vfs_write"),
+ kernel.function ("vfs_read")
+{
+ dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev
+
+ if (dev_nr == device_of_interest)
+ printf ("%s(%d) %s 0x%x\n",
+ execname(), pid(), probefunc(), dev_nr)
+}