summaryrefslogtreecommitdiffstats
path: root/examples/small_demos/fileopen.stp
diff options
context:
space:
mode:
authorwcohen <wcohen>2006-05-05 20:35:30 +0000
committerwcohen <wcohen>2006-05-05 20:35:30 +0000
commit708a511bd92ec7ba3ff8787c67b3058dbdaa5f3a (patch)
tree1898c9ac1f04c537c0e0790624700df88a620714 /examples/small_demos/fileopen.stp
parent3897de04275daf1727e115e6bb7a5a4ae8fd46b3 (diff)
downloadsystemtap-steved-708a511bd92ec7ba3ff8787c67b3058dbdaa5f3a.tar.gz
systemtap-steved-708a511bd92ec7ba3ff8787c67b3058dbdaa5f3a.tar.xz
systemtap-steved-708a511bd92ec7ba3ff8787c67b3058dbdaa5f3a.zip
2006-05-05 Will Cohen <wcohen@redhat.com>
* small_demos/fileopen.stp: Shows use of target() to look at pid. * small_demos/rwtiming.stp: Shows per executable histograms of time spent in read and write system calls.
Diffstat (limited to 'examples/small_demos/fileopen.stp')
-rw-r--r--examples/small_demos/fileopen.stp19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/small_demos/fileopen.stp b/examples/small_demos/fileopen.stp
new file mode 100644
index 00000000..5d59ee55
--- /dev/null
+++ b/examples/small_demos/fileopen.stp
@@ -0,0 +1,19 @@
+# fileopen.stp
+#
+# This is based on dtrace script from
+# http://www.gnome.org/~gman/blog/2006/Jan
+#
+#stap fileopen.stp -c "zenity --about"
+
+global opens
+
+probe syscall.open {
+ if (target() == pid()) opens[filename] ++
+}
+
+probe end {
+ foreach([name] in opens+) {
+ printf("%-70s%5d\n", name, opens[name])
+ }
+}
+