diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-15 14:43:03 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-15 14:43:03 -0400 |
commit | aa15b9f0167dfc87c3bd78e956005b0eacefbc98 (patch) | |
tree | f6bab22f132d016c696cda3bef5932ae30823d64 /testsuite/systemtap.examples/general | |
parent | a43ba4339f5b291d139e0be59bba4bc46c55ea25 (diff) | |
download | systemtap-steved-aa15b9f0167dfc87c3bd78e956005b0eacefbc98.tar.gz systemtap-steved-aa15b9f0167dfc87c3bd78e956005b0eacefbc98.tar.xz systemtap-steved-aa15b9f0167dfc87c3bd78e956005b0eacefbc98.zip |
extend callgraph example to use $$parms / $$return
Diffstat (limited to 'testsuite/systemtap.examples/general')
-rw-r--r-- | testsuite/systemtap.examples/general/para-callgraph.meta | 16 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/general/para-callgraph.stp | 26 |
2 files changed, 19 insertions, 23 deletions
diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta index 3ce4b648..740ed5ce 100644 --- a/testsuite/systemtap.examples/general/para-callgraph.meta +++ b/testsuite/systemtap.examples/general/para-callgraph.meta @@ -1,13 +1,7 @@ -title: Tracing Calls for Sections of Code +title: Callgraph tracing with arguments 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" +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 'kernel.function("*@fs/proc*.c")' 'kernel.function("sys_read")' +test_installcheck: stap para-callgraph.stp 'kernel.function("*@fs/proc*.c")' 'kernel.function("sys_read")' -c 'cat /proc/sys/vm/*' diff --git a/testsuite/systemtap.examples/general/para-callgraph.stp b/testsuite/systemtap.examples/general/para-callgraph.stp index e28f5d6b..9abb00c2 100755 --- a/testsuite/systemtap.examples/general/para-callgraph.stp +++ b/testsuite/systemtap.examples/general/para-callgraph.stp @@ -1,22 +1,24 @@ #! /usr/bin/env stap -function trace(entry_p) { - if(tid() in trace) - printf("%s%s%s\n",thread_indent(entry_p), - (entry_p>0?"->":"<-"), - probefunc()) +function trace(entry_p, extra) { + %( $# > 1 %? if (tid() in trace) %) + printf("%s%s%s %s\n", + thread_indent (entry_p), + (entry_p>0?"->":"<-"), + probefunc (), + extra) } + +%( $# > 1 %? global trace -probe kernel.function(@1).call { - if (execname() == "stapio") next # skip our own helper process +probe $2.call { trace[tid()] = 1 - trace(1) } -probe kernel.function(@1).return { - trace(-1) +probe $2.return { delete trace[tid()] } +%) -probe kernel.function(@2).call { trace(1) } -probe kernel.function(@2).return { trace(-1) } +probe $1.call { trace(1, $$parms) } +probe $1.return { trace(-1, $$return) } |