]> sourceware.org Git - systemtap.git/commitdiff
added simplified, working para-callgraph
authorddomingo <ddomingo@redhat.com>
Mon, 27 Oct 2008 03:11:27 +0000 (13:11 +1000)
committerddomingo <ddomingo@redhat.com>
Mon, 27 Oct 2008 03:11:27 +0000 (13:11 +1000)
testsuite/systemtap.examples/general/para-callgraph-simple.meta [new file with mode: 0644]
testsuite/systemtap.examples/general/para-callgraph-simple.stp [new file with mode: 0755]

diff --git a/testsuite/systemtap.examples/general/para-callgraph-simple.meta b/testsuite/systemtap.examples/general/para-callgraph-simple.meta
new file mode 100644 (file)
index 0000000..4a0bb25
--- /dev/null
@@ -0,0 +1,7 @@
+title: Callgraph tracing with arguments
+name: para-callgraph.stp
+keywords: trace callgraph
+subsystem: general
+description: Print a timed per-thread callgraph, complete with function parameters and return values.  The first parameter names the function probe points to trace.  The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger.
+test_check: stap -p4 para-callgraph.stp sys_read '*@fs/*.c'
+test_installcheck: TBD
diff --git a/testsuite/systemtap.examples/general/para-callgraph-simple.stp b/testsuite/systemtap.examples/general/para-callgraph-simple.stp
new file mode 100755 (executable)
index 0000000..17cf50a
--- /dev/null
@@ -0,0 +1,40 @@
+function trace(entry_p) {\r
+   if(tid() in trace)\r
+       printf("%s%s%s\n",thread_indent(entry_p),\r
+                         (entry_p>0?"->":"<-"),\r
+                         probefunc())\r
+}\r
+\r
+global trace\r
+probe kernel.function(@1).call {\r
+   if (execname() == "stapio") next # skip our own helper process\r
+   trace[tid()] = 1\r
+   trace(1)\r
+}\r
+probe kernel.function(@1).return {\r
+   trace(-1)\r
+   delete trace[tid()]\r
+}\r
+\r
+probe kernel.function(@2).call { trace(1) }\r
+probe kernel.function(@2).return { trace(-1) }\r
+function trace(entry_p) {\r
+   if(tid() in trace)\r
+       printf("%s%s%s\n",thread_indent(entry_p),\r
+                         (entry_p>0?"->":"<-"),\r
+                         probefunc())\r
+}\r
+\r
+global trace\r
+probe kernel.function(@1).call {\r
+   if (execname() == "stapio") next # skip our own helper process\r
+   trace[tid()] = 1\r
+   trace(1)\r
+}\r
+probe kernel.function(@1).return {\r
+   trace(-1)\r
+   delete trace[tid()]\r
+}\r
+\r
+probe kernel.function(@2).call { trace(1) }\r
+probe kernel.function(@2).return { trace(-1) }\r
This page took 0.029638 seconds and 5 git commands to generate.