summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/small_demos/fileopen.stp
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.examples/small_demos/fileopen.stp')
-rwxr-xr-xtestsuite/systemtap.examples/small_demos/fileopen.stp24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/small_demos/fileopen.stp b/testsuite/systemtap.examples/small_demos/fileopen.stp
new file mode 100755
index 00000000..c1298f9c
--- /dev/null
+++ b/testsuite/systemtap.examples/small_demos/fileopen.stp
@@ -0,0 +1,24 @@
+#! /usr/bin/env stap
+
+#
+# fileopen.stp
+#
+# This is based on dtrace script from
+# http://www.gnome.org/~gman/blog/2006/Jan
+#
+# stap fileopen.stp -c "zenity --about"
+# or
+# ./fileopen.stp -c "program or script"
+
+global opens
+
+probe syscall.open {
+ if (target() == pid()) opens[filename] ++
+}
+
+probe end {
+ foreach([name] in opens+) {
+ printf("%-70s%5d\n", name, opens[name])
+ }
+}
+