summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
authorWilliam Cohen <wcohen@redhat.com>2008-07-02 14:11:37 -0400
committerWilliam Cohen <wcohen@redhat.com>2008-07-02 14:11:37 -0400
commit92fa0578ee7cc6118487b386d9b85d8966e2771b (patch)
tree93b1105b880d1b8d43d2df5ff27e25211b724360 /testsuite/systemtap.examples
parentb77e6d1fc44f553e8d3ee7ec3b7e6076ad86fed6 (diff)
downloadsystemtap-steved-92fa0578ee7cc6118487b386d9b85d8966e2771b.tar.gz
systemtap-steved-92fa0578ee7cc6118487b386d9b85d8966e2771b.tar.xz
systemtap-steved-92fa0578ee7cc6118487b386d9b85d8966e2771b.zip
Add para-callgraph.stp and para-callgraph.meta.
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r--testsuite/systemtap.examples/ChangeLog4
-rw-r--r--testsuite/systemtap.examples/para-callgraph.meta13
-rw-r--r--testsuite/systemtap.examples/para-callgraph.stp20
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog
index b1c34347..c4d2c355 100644
--- a/testsuite/systemtap.examples/ChangeLog
+++ b/testsuite/systemtap.examples/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-02 William Cohen <wcohen@redhat.com>
+
+ * para-callgraph.stp, para-callgraph.meta: New.
+
2008-06-20 William Cohen <wcohen@redhat.com>
* traceio2.meta: Correct test_check and test_installcheck commands.
diff --git a/testsuite/systemtap.examples/para-callgraph.meta b/testsuite/systemtap.examples/para-callgraph.meta
new file mode 100644
index 00000000..3ce4b648
--- /dev/null
+++ b/testsuite/systemtap.examples/para-callgraph.meta
@@ -0,0 +1,13 @@
+title: Tracing Calls for Sections of Code
+name: para-callgraph.stp
+version: 1.0
+author: anonymous
+keywords: trace callgraph
+subsystem: kernel
+status: production
+exit: user-controlled
+output: trace
+scope: system-wide
+description: The script takes two arguments: the first argument is the function to starts/stops the per thread call graph traces and the second argument is the list of functions to generate trace information on. The script prints out a timestap for the thread, the function name and pid, followed by entry or exit symboly and function name.
+test_check: stap -p4 para-callgraph.stp sys_read "*@fs/*.c"
+test_installcheck: stap para-callgraph.stp sys_read "*@fs/*.c" -c "sleep 1"
diff --git a/testsuite/systemtap.examples/para-callgraph.stp b/testsuite/systemtap.examples/para-callgraph.stp
new file mode 100644
index 00000000..1afb8837
--- /dev/null
+++ b/testsuite/systemtap.examples/para-callgraph.stp
@@ -0,0 +1,20 @@
+function trace(entry_p) {
+ if(tid() in trace)
+ printf("%s%s%s\n",thread_indent(entry_p),
+ (entry_p>0?"->":"<-"),
+ probefunc())
+}
+
+global trace
+probe kernel.function(@1).call {
+ if (execname() == "stapio") next # skip our own helper process
+ trace[tid()] = 1
+ trace(1)
+}
+probe kernel.function(@1).return {
+ trace(-1)
+ delete trace[tid()]
+}
+
+probe kernel.function(@2).call { trace(1) }
+probe kernel.function(@2).return { trace(-1) }