summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-07-04 17:11:29 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-07-04 17:11:29 -0400
commit53f7dd30e87fa480c5d43ce2a1312ce27a4372c9 (patch)
tree4f1c64048d43c50c11877a66d3f7f918e43a0f7b /testsuite/systemtap.examples
parent1b94bf6d310cf41041d0a6c24be85a892d443708 (diff)
parent422b0781177e0755df5542e1c70e809e6f3cfe89 (diff)
downloadsystemtap-steved-53f7dd30e87fa480c5d43ce2a1312ce27a4372c9.tar.gz
systemtap-steved-53f7dd30e87fa480c5d43ce2a1312ce27a4372c9.tar.xz
systemtap-steved-53f7dd30e87fa480c5d43ce2a1312ce27a4372c9.zip
Merge commit 'origin/master' into pr6429-comp-unwindsyms
* commit 'origin/master': ubuntu (2.6.24-16-server) kernel compatibility fix client/server take 2. See bz6565. Add functioncallcount.meta and functioncallcount.stp. Add para-callgraph.stp and para-callgraph.meta. Fixed __stp_get_mm_path() error return code. diagnostics improvement: print arch/mach at top if -vv Make _vfs.generic_commit_write only for kernel<=2.6.25 Handles "mortally wounded" threads correctly when detaching. further clarify that elfutils need not be absolutely freshest, nor rebuilt every time point out releases/ directory; clarify optionality of elfutils bundling Add auto_free_ref to auto_free stuff; bug 6694
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r--testsuite/systemtap.examples/ChangeLog8
-rw-r--r--testsuite/systemtap.examples/functioncallcount.meta13
-rw-r--r--testsuite/systemtap.examples/functioncallcount.stp17
-rw-r--r--testsuite/systemtap.examples/para-callgraph.meta13
-rw-r--r--testsuite/systemtap.examples/para-callgraph.stp20
5 files changed, 71 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog
index b1c34347..dcaafe59 100644
--- a/testsuite/systemtap.examples/ChangeLog
+++ b/testsuite/systemtap.examples/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-02 William Cohen <wcohen@redhat.com>
+
+ * functioncallcount.meta, functioncallcount.stp: New.
+
+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/functioncallcount.meta b/testsuite/systemtap.examples/functioncallcount.meta
new file mode 100644
index 00000000..4d419528
--- /dev/null
+++ b/testsuite/systemtap.examples/functioncallcount.meta
@@ -0,0 +1,13 @@
+title: Count Times Functions Called
+name: functioncallcount.stp
+version: 1.0
+author: anonymous
+keywords: profiling functions
+subsystem: kernel
+status: production
+exit: user-controlled
+output: sorted-list on-exit
+scope: system-wide
+description: The functioncallcount.stp script takes one argument, a list of functions to probe. The script will run and count the number of times that each of the functions on the list is called. On exit the script will print a sorted list from most frequently to least frequently called function.
+test_check: stap -p4 functioncallcount.stp "*@mm/*.c"
+test_installcheck: stap functioncallcount.stp "*@mm/*.c" -c "sleep 1"
diff --git a/testsuite/systemtap.examples/functioncallcount.stp b/testsuite/systemtap.examples/functioncallcount.stp
new file mode 100644
index 00000000..e393b612
--- /dev/null
+++ b/testsuite/systemtap.examples/functioncallcount.stp
@@ -0,0 +1,17 @@
+# The following line command will probe all the functions
+# in kernel's memory management code:
+#
+# stap functioncallcount.stp "*@mm/*.c"
+
+probe kernel.function(@1) { # probe functions listed on commandline
+ called[probefunc()] <<< 1 # add a count efficiently
+}
+
+global called
+
+probe end {
+ foreach (fn in called-) # Sort by call count (in decreasing order)
+ # (fn+ in called) # Sort by function name
+ printf("%s %d\n", fn, @count(called[fn]))
+ exit()
+}
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) }