summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-02-20 14:56:38 +0100
committerMark Wielaard <mjw@redhat.com>2009-02-20 14:56:38 +0100
commit02615365a92ca2570c1f96abc8a97674aa2ccae1 (patch)
treeebedfd91a0f6d299b39e84295e091e12c0767dc8 /testsuite/systemtap.examples
parentc3bad3042df505a3470f1e20b09822a9df1d4761 (diff)
parentadc67597f327cd43d58b1d0cb740dab14a75a058 (diff)
downloadsystemtap-steved-02615365a92ca2570c1f96abc8a97674aa2ccae1.tar.gz
systemtap-steved-02615365a92ca2570c1f96abc8a97674aa2ccae1.tar.xz
systemtap-steved-02615365a92ca2570c1f96abc8a97674aa2ccae1.zip
Merge branch 'master' into pr6866
Conflicts: ChangeLog: Removed runtime/ChangeLog: Removed runtime/sym.c: Merged runtime/task_finder.c: Merged tapset/ChangeLog: Removed testsuite/ChangeLog: Removed
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r--testsuite/systemtap.examples/ChangeLog349
-rw-r--r--testsuite/systemtap.examples/index.html21
-rw-r--r--testsuite/systemtap.examples/index.txt74
-rw-r--r--testsuite/systemtap.examples/interrupt/scf.meta13
-rw-r--r--testsuite/systemtap.examples/interrupt/scf.stp21
-rw-r--r--testsuite/systemtap.examples/io/iostats.meta13
-rw-r--r--testsuite/systemtap.examples/io/iostats.stp44
-rw-r--r--testsuite/systemtap.examples/keyword-index.html44
-rw-r--r--testsuite/systemtap.examples/keyword-index.txt121
-rwxr-xr-xtestsuite/systemtap.examples/memory/kmalloc-top171
-rw-r--r--testsuite/systemtap.examples/memory/kmalloc-top.meta13
-rw-r--r--testsuite/systemtap.examples/memory/pfaults.meta13
-rw-r--r--testsuite/systemtap.examples/memory/pfaults.stp35
-rw-r--r--testsuite/systemtap.examples/network/tcp_connections.meta13
-rw-r--r--testsuite/systemtap.examples/network/tcp_connections.stp14
-rwxr-xr-xtestsuite/systemtap.examples/profiling/functioncallcount.stp2
-rw-r--r--testsuite/systemtap.examples/profiling/latencytap.stp7
-rw-r--r--testsuite/systemtap.examples/profiling/timeout.meta13
-rw-r--r--testsuite/systemtap.examples/profiling/timeout.stp102
-rw-r--r--testsuite/systemtap.examples/profiling/topsys.meta13
-rw-r--r--testsuite/systemtap.examples/profiling/topsys.stp24
21 files changed, 767 insertions, 353 deletions
diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog
deleted file mode 100644
index 253e1a76..00000000
--- a/testsuite/systemtap.examples/ChangeLog
+++ /dev/null
@@ -1,349 +0,0 @@
-2009-01-02 Mark Wielaard <mjw@redhat.com>
-
- PR9693. Reported by Eugeniy Meshcheryakov <eugen@debian.org>
- * io/traceio2.stp: Add proper #! /usr/bin/env stap line.
- * profiling/functioncallcount.stp: Likewise.
-
-2008-12-10 William Cohen <wcohen@redhat.com>
-
- * process/futexes.stp:
- * profiling/thread-times.stp: Tweak formatting.
-
-2008-12-10 Tim Moore <timoore@redhat.com>
-
- * profiling/latencytap.stp: Probe scheduler to identify processes
- that have slept inordinately.
-
-2008-12-09 William Cohen <wcohen@redhat.com>
-
- * general/ansi_colors.stp:
- * general/key.stp:
- * general/keyhack.stp:
- * general/para-callgraph.stp:
- * io/disktop.stp:
- * io/io_submit.stp:
- * io/iostat-scsi.stp:
- * io/iotime.stp:
- * io/traceio.stp:
- * io/traceio2.stp:
- * network/nettop.stp:
- * process/futexes.stp:
- * process/proc_snoop.stp:
- * process/sig_by_pid.stp:
- * process/sigkill.stp:
- * process/sigmon.stp:
- * process/syscalls_by_pid.stp:
- * process/syscalls_by_proc.stp:
- * process/wait4time.stp:
- * profiling/thread-times.stp: Tweak formatting, indent two space.
-
-2008-11-25 Mark Wielaard <mjw@redhat.com>
-
- * general/para-callgraph.meta: Add accidentially removed -c back
- to test_installcheck.
-
-2008-11-25 Mark Wielaard <mjw@redhat.com>
-
- * general/para-callgraph.meta: Don't use single quotes.
-
-2008-11-20 Frank Ch. Eigler <fche@elastic.org>
-
- * examples-index-gen.pl: Make "keywords: foo bar" list into
- clickable links.
-
-2008-11-20 Frank Ch. Eigler <fche@elastic.org>
-
- * subsystem-*: Removed subsystem indexes.
-
-2008-11-19 Frank Ch. Eigler <fche@elastic.org>
-
- * process/sleepingBeauties.meta: Updated description.
-
-2008-10-27 William Cohen <wcohen@redhat.com>
-
- * io/traceio2.stp: Use local variable available from vfs tapset.
-
-2008-10-27 William Cohen <wcohen@redhat.com>
-
- * io/disktop.stp: Clean up disktop.stp and check in for real.
-
-2008-10-29 Frank Ch. Eigler <fche@elastic.org>
-
- * process/syscalltimes: Rename global "start" to avoid collision
- with syscall tapset local variable.
-
-2008-10-27 William Cohen <wcohen@redhat.com>
-
- * io/disktop.stp: Make use of devname added to vfs tapset.
-
-2008-10-24 William Cohen <wcohen@redhat.com>
-
- * io/traceio.stp:
- * io/traceio2.stp:
- * io/iotop.stp:
- * io/disktop.stp: Use vfs tapset rather than kernel functions probes.
-
-2008-09-12 Frank Ch. Eigler <fche@elastic.org>
-
- * io/traceio2.stp: Make compatible with RHEL5.
- * general/para-callgraph.meta: Tweak quoting for dejagnu passage.
-
-2008-08-15 Frank Ch. Eigler <fche@elastic.org>
-
- * general/para-callgraph*: Extend.
- * indexes: Regenerated.
-
-2008-08-11 Mark Wielaard <mwielaard@redhat.com>
-
- * check.exp: Make sure that stderr gets redircted so warnings don't
- make example script run fail.
-
-2008-08-11 Mark Wielaard <mwielaard@redhat.com>
-
- PR6835. Reported by Eugeniy Meshcheryakov <eugen@debian.org>
- * io/io_submit.stp: Fix #! start. Convert to normal line-ending.
-
-2008-08-11 Mark Wielaard <mwielaard@redhat.com>
-
- PR2895. Reported by Eugeniy Meshcheryakov <eugen@debian.org>
- * general/graphs.stp: Add proper #! /usr/bin/env stap line.
- * general/para-callgraph.stp: Likewise.
- * io/io_submit.stp: Likewise.
- * io/iotop.stp: Likewise.
- * io/traceio.stp: Likewise.
- * process/proc_snoop.stp: Likewise.
- * process/sigkill.stp: Likewise.
- * iotask.stp: Likewise.
- * pfaults.stp: Likewise.
- * profile.stp: Likewise.
-
-2008-08-08 Mark Wielaard <mwielaard@redhat.com>
-
- * examples-index-gen.pl: Add index of subsystem and keywords at top of
- HTML indexes.
- * *index.html: Regenerated.
- * *index.txt: Likewise.
-
-2008-08-08 Mark Wielaard <mwielaard@redhat.com>
-
- * examples-index-gen.pl (add_meta_txt): Don't output output, exits,
- status line.
- (add_meta_html): Likewise.
- * *index.html: Regenerated.
- * *index.txt: Likewise.
-
-2008-08-08 Mark Wielaard <mwielaard@redhat.com>
-
- * examples-index-gen.pl (inputdir): Make absolute.
- (outputdir): Likewise.
- (supportfiles): Copy from new html dir. Add README. Make sure
- new html subdir is created in outputdir.
-
-2008-08-07 Frank Ch. Eigler <fche@elastic.org>
-
- * *index.txt, *index.html: New generated files.
- * .gitignore: Zap it.
- * html/*, examples-index-gen.pl: Adapt to html/ boilerplate subdir.
-
-2008-08-07 Frank Ch. Eigler <fche@elastic.org>
-
- * small_demos: Unique parts kept, others dropped.
- * all other samples: Moved into new subdirectories.
-
-2008-08-07 David Smith <dsmith@redhat.com>
-
- * .gitignore: New file.
-
-2008-08-07 Mark Wielaard <mwielaard@redhat.com>
-
- * examples-index-gen.pl: New file.
- * systemtap.css: Likewise.
- * systemtapcorner.gif: Likewise.
- * systemtaplogo.png: Likewise.
- * html_footer.tmpl: Likewise.
- * html_header.tmpl: Likewise.
- * Makefile.am (EXTRA_DIST): Add new support files.
-
-2008-08-07 Mark Wielaard <mwielaard@redhat.com>
-
- * futexes.meta: Correct name: entry.
-
-2008-08-01 William Cohen <wcohen@redhat.com>
-
- * helloworld.meta, traceio2.meta: Tweak test_installcheck.
-
-2008-08-01 William Cohen <wcohen@redhat.com>
-
- * check.exp: Run both tests for installcheck tests.
-
-2008-07-11 Mark Wielaard <mwielaard@redhat.com>
-
- * traceio.meta: s/decending/descending/ in description.
- * iotop.meta: Likewise.
-
-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.
-
-2008-06-20 William Cohen <wcohen@redhat.com>
-
- * traceio2.stp, traceio2.meta: New.
-
-2008-06-18 William Cohen <wcohen@redhat.com>
-
- * sleepingBeauties.stp, sleepingBeauties.meta: New.
-
-2008-06-17 William Cohen <wcohen@redhat.com>
-
- * graphs.stp, graphs.meta: New.
-
-2008-06-12 William Cohen <wcohen@redhat.com>
-
- * thread-times.stp, thread-times.meta: New.
-
-2008-05-20 William Cohen <wcohen@redhat.com>
-
- * io_submit.stp, io_submit.meta:
- * traceio.stp, traceio.meta:
- * iotop.stp, iotop.meta:
- * disktop.stp, disktop.meta:
- * sigkill.stp, sigkill.meta: New.
-
-2008-05-09 William Cohen <wcohen@redhat.com>
-
- * syscalls_by_pid.meta, syscalls_by_proc.meta:
- * sigmon.meta, sig_by_pid.meta, sig_by_proc.meta:
- * socket-trace.meta: New.
-
-2008-05-08 William Cohen <wcohen@redhat.com>
-
- * iotime.meta: New.
-
-2008-05-08 William Cohen <wcohen@redhat.com>
-
- * sleeptime.meta, wait4time.meta: New.
-
-2008-05-08 Mark Wielaard <mwielaard@redhat.com>
-
- * futexes.meta (test_check,test_installcheck): Change futex.stp to
- futexes.stp.
-
-2008-05-07 William Cohen <wcohen@redhat.com>
-
- * futexes.meta, nettop.meta, pf2.meta: New.
-
-2008-05-07 William Cohen <wcohen@redhat.com>
-
- * pf2.stp: Clean up output.
-
-2008-05-01 William Cohen <wcohen@redhat.com>
-
- * helloworld.meta: New file.
-
-2008-04-27 William Cohen <wcohen@redhat.com>
-
- * check.exp: New script to run tests on cataloged examples.
-
-2008-03-09 Wenji Huang <wenji.huang@oracle.com>
-
- * wait4time.stp: Change reference of $pid to local variable pid.
-
-2008-03-05 David Smith <dsmith@redhat.com>
-
- PR5422
- * iostat-scsi.stp: Updated to handle kernel versions > 2.6.24.
- * iostat-scsi.txt: Updated.
-
-2008-01-29 Frank Ch. Eigler <fche@elastic.org>
-
- * nettop.stp: Reorganize array usage to minimize contention.
-
-2007-11-19 Frank Ch. Eigler <fche@elastic.org>
-
- * iostat-scsi.stp: Adopt "!" probe point flag.
-
-2007-11-09 Martin Hunt <hunt@redhat.com>
-
- * README: New.
-
- * *.stp. Fix path. See PR 4718.
-
-2007-10-10 Mike Mason
-
- * syscalltimes, syscalltime.txt: New combination shell/SystemTap script
- to measure system call times.
-
-2007-10-05 Frank Ch. Eigler <fche@elastic.org>
-
- * futexes.stp, sig_by_proc.stp, small_demos/rwtiming.stp: Fix elision
- warnings.
-
-2007-09-15 Wenji Huang <wenji.huang@oracle.com>
-
- * iostat-scsi.stp: Make module probe optional,clarify reference to flags.
- * small_demos/sched_snoop.stp(scheduler.migrage,scheduler.balance): Make optional.
-
-2007-09-05 Frank Ch. Eigler <fche@elastic.org>
-
- * pf2.stp: Exploit sortable aggregates.
-
-2007-08-09 Frank Ch. Eigler <fche@elastic.org>
-
- PR 4718, from Eugeniy Meshcheryakov <eugen@debian.org>:
- * *.stp: Make all shell scripts lead with #! /usr/bin/stap
-
-2007-05-29 Mike Mason <mmlnx@us.ibm.com>
-
- * sig_count_by_pid.stp, sig_count_by_pid.txt,
- sig_count_by_proc.stp, sig_count_by_proc.txt: Print signal activity
-
-2007-04-02 Frank Ch. Eigler <fche@elastic.org>
-
- * socket-trace.stp, small_demos/prof.stp, top.stp: Adapt to
- .inline -> .function change.
-
-2007-01-30 Frank Ch. Eigler <fche@elastic.org>
-
- * socket-trace.stp: Added from the tutorial.
-
-2007-01-29 Mike Mason <mmlnx@us.ibm.com>
-
- * socktop, socktop.txt: New example that uses a shell script to process
- command line options for a systemtap script.
-
-2007-01-11 Will Cohen <wcohen@redhat.com>
-
- * iotime.stp:
- * sleeptime.stp:
- * wait4time.stp: New examples.
-
-2007-01-10 Martin Hunt <hunt@redhat.com>
-
- * small_demos/top.stp: Use "limit" option in foreach.
-
-2007-01-01 Frank Ch. Eigler <fche@redhat.com>
-
- * *: Added several .stp/.txt files from the wiki.
-
-2006-04-20 Martin Hunt <hunt@redhat.com>
-
- * small_demos/top.stp: Use printf.
-
-2006-03-30 Martin Hunt <hunt@redhat.com>
-
- * small_demos/close.stp: Make it executable.
-
-2006-03-09 Martin Hunt <hunt@redhat.com>
-
- * key.stp: Toy example.
- * prof.stp: Example profiler.
- * top.stp: Print the top 20 syscalls.
-
diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html
index 52bc294b..7b76baa1 100644
--- a/testsuite/systemtap.examples/index.html
+++ b/testsuite/systemtap.examples/index.html
@@ -49,12 +49,18 @@ keywords: <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br>
<li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Callgraph tracing with arguments<br>
keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#CALLGRAPH">CALLGRAPH</a> <br>
<p>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.</p></li>
+<li><a href="interrupt/scf.stp">interrupt/scf.stp</a> - Tally Backtraces for Inter-Processor Interrupt (IPI)<br>
+keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
+<p>The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.</p></li>
<li><a href="io/disktop.stp">io/disktop.stp</a> - Summarize Disk Read/Write Traffic<br>
keywords: <a href="keyword-index.html#DISK">DISK</a> <br>
<p>Get the status of reading/writing disk every 5 seconds, output top ten entries during that period.</p></li>
<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br>
keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
<p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li>
+<li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br>
+keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li>
<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br>
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <br>
<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li>
@@ -67,12 +73,21 @@ keywords: <a href="keyword-index.html#IO">IO</a> <br>
<li><a href="io/traceio2.stp">io/traceio2.stp</a> - Watch I/O Activity on a Particular Device<br>
keywords: <a href="keyword-index.html#IO">IO</a> <br>
<p>Print out the executable name and process number as reads and writes to the specified device occur.</p></li>
+<li><a href="memory/kmalloc-top">memory/kmalloc-top</a> - Show Paths to Kernel Malloc (kmalloc) Invocations<br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+<p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).</p></li>
+<li><a href="memory/pfaults.stp">memory/pfaults.stp</a> - Generate Log of Major and Minor Page Faults<br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+<p>The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.</p></li>
<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br>
keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <a href="keyword-index.html#PER-PROCESS">PER-PROCESS</a> <br>
<p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li>
<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br>
keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li>
+<li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
+<p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li>
<li><a href="process/futexes.stp">process/futexes.stp</a> - System-Wide Futex Contention<br>
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#LOCKING">LOCKING</a> <a href="keyword-index.html#FUTEX">FUTEX</a> <br>
<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li>
@@ -112,6 +127,12 @@ keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword-
<li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br>
keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
<p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li>
+<li><a href="profiling/timeout.stp">profiling/timeout.stp</a> - Show Processes Doing Polling Operations<br>
+keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p>The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes.</p></li>
+<li><a href="profiling/topsys.stp">profiling/topsys.stp</a> - Show Processes Doing Polling Operations<br>
+keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The topsys.stp script lists out the top twenty systemcalls for the previous 5 seconds. The output is sorted from most frequent to least frequent.</p></li>
</ul>
</td>
</tr>
diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt
index fce068b8..fdcd3b31 100644
--- a/testsuite/systemtap.examples/index.txt
+++ b/testsuite/systemtap.examples/index.txt
@@ -27,6 +27,16 @@ keywords: trace callgraph
the trigger.
+interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
+keywords: interrupt backtrace
+
+ The Linux kernel function smp_call_function causes expensive
+ inter-processor interrupts (IPIs). The scf.stp script tallies the
+ processes and backtraces causing the interprocessor interrupts to
+ identify the cause of the expensive IPI. On exit the script prints
+ the tallies in descending frequency.
+
+
io/disktop.stp - Summarize Disk Read/Write Traffic
keywords: disk
@@ -42,6 +52,17 @@ keywords: io backtrace
list from most common to least common backtrace.
+io/iostats.stp - List Executables Reading and Writing the Most Data
+keywords: io profiling
+
+ The iostat.stp script measures the amount of data successfully read
+ and written by all the executables on the system. The output is
+ sorted from most greatest sum of bytes read and written by an
+ executable to the least. The output contains the count of operations
+ (opens, reads, and writes), the totals and averages for the number of
+ bytes read and written.
+
+
io/iotime.stp - Trace Time Spent in Read and Write for Files
keywords: syscall read write time io
@@ -79,6 +100,29 @@ keywords: io
to the specified device occur.
+memory/kmalloc-top - Show Paths to Kernel Malloc (kmalloc) Invocations
+keywords: memory
+
+ The kmalloc-top perl program runs a small systemtap script to collect
+ stack traces for each call to the kmalloc function and counts the
+ time that each stack trace is observed. When kmalloc-top exits it
+ prints out sorted list. The output can be be filtered to print only
+ only the first stack traces (-t) stack traces with more a minimum
+ counts (-m), or exclude certain stack traces (-e).
+
+
+memory/pfaults.stp - Generate Log of Major and Minor Page Faults
+keywords: memory
+
+ The pfaults.stp script generates a simple log for each major and
+ minor page fault that occurs on the system. Each line contains a
+ timestamp (in microseconds) when the page fault servicing was
+ completed, the pid of the process, the address of the page fault, the
+ type of access (read or write), the type of fault (major or minor),
+ and the elapsed time for page fault. This log can be examined to
+ determine where the page faults are occuring.
+
+
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
keywords: network traffic per-process
@@ -99,6 +143,16 @@ keywords: network socket
element of the line is the function name.
+network/tcp_connections.stp - Track Creation of Incoming TCP Connections
+keywords: network tcp socket
+
+ The tcp_connections.stp script prints information for each new
+ incoming TCP connection accepted by the computer. The information
+ includes the UID, the command accepting the connection, the PID of
+ the command, the port the connection is on, and the IP address of the
+ originator of the request.
+
+
process/futexes.stp - System-Wide Futex Contention
keywords: syscall locking futex
@@ -211,3 +265,23 @@ keywords: profiling
user-space and kernel-space.
+profiling/timeout.stp - Show Processes Doing Polling Operations
+keywords: profiling
+
+ The timeout.stp script is based on a blog entry
+ (http://udrepper.livejournal.com/19041.html) mentioning a need for a
+ tool to help developers find applications that are polling. The
+ timeout.stp script monitors systemcall used for polling and records
+ the systemcalls that timed out rather than returned because some
+ action occurred. The script updates the screen once a second with the
+ top twenty processes.
+
+
+profiling/topsys.stp - Show Processes Doing Polling Operations
+keywords: profiling
+
+ The topsys.stp script lists out the top twenty systemcalls for the
+ previous 5 seconds. The output is sorted from most frequent to least
+ frequent.
+
+
diff --git a/testsuite/systemtap.examples/interrupt/scf.meta b/testsuite/systemtap.examples/interrupt/scf.meta
new file mode 100644
index 00000000..1d6ec3d8
--- /dev/null
+++ b/testsuite/systemtap.examples/interrupt/scf.meta
@@ -0,0 +1,13 @@
+title: Tally Backtraces for Inter-Processor Interrupt (IPI)
+name: scf.stp
+version: 1.0
+author: William Cohen
+keywords: interrupt backtrace
+subsystem: kernel
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.
+test_check: stap -p4 scf.stp
+test_installcheck: stap scf.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/interrupt/scf.stp b/testsuite/systemtap.examples/interrupt/scf.stp
new file mode 100644
index 00000000..f84c2494
--- /dev/null
+++ b/testsuite/systemtap.examples/interrupt/scf.stp
@@ -0,0 +1,21 @@
+#! /usr/bin/env stap
+# scf.stp
+# A reimplementation of user script:smp_call_function example given at OLS 2005
+# in the current language.
+
+global traces
+
+probe begin { print("Starting probe, type control-c to stop.\n") }
+
+probe kernel.function("smp_call_function")
+{
+ traces[pid(), pexecname(), backtrace()] ++
+}
+
+probe end {
+ foreach ([pid, name, stack] in traces-) { # sort by frequency encountered
+ printf ("traces[%d,%s,\n", pid, name)
+ print_stack (stack)
+ printf ("] = %d\n", traces[pid, name, stack]);
+ }
+}
diff --git a/testsuite/systemtap.examples/io/iostats.meta b/testsuite/systemtap.examples/io/iostats.meta
new file mode 100644
index 00000000..a74c9fe4
--- /dev/null
+++ b/testsuite/systemtap.examples/io/iostats.meta
@@ -0,0 +1,13 @@
+title: List Executables Reading and Writing the Most Data
+name: iostats.stp
+version: 1.0
+author: anonymous
+keywords: io profiling
+subsystem: io
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.
+test_check: stap -p4 iostats.stp
+test_installcheck: stap iostats.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/io/iostats.stp b/testsuite/systemtap.examples/io/iostats.stp
new file mode 100644
index 00000000..90bb4f5b
--- /dev/null
+++ b/testsuite/systemtap.examples/io/iostats.stp
@@ -0,0 +1,44 @@
+#! /usr/bin/env stap
+global opens, reads, writes, totals
+
+probe begin { printf("starting probe\n") }
+
+probe syscall.open {
+ e=execname();
+ opens[e] <<< 1 # statistics array
+}
+
+probe syscall.read.return {
+ count = $return
+ if ( count >= 0 ) {
+ e=execname();
+ reads[e] <<< count # statistics array
+ totals[e] += count
+ }
+}
+
+probe syscall.write.return {
+ count = $return
+ if (count >= 0 ) {
+ e=execname();
+ writes[e] <<< count # statistics array
+ totals[e] += count
+ }
+}
+
+probe end {
+ printf("\n%16s %8s %8s %8s %8s %8s %8s %8s\n",
+ "", "", "", "read", "read", "", "write", "write")
+ printf("%16s %8s %8s %8s %8s %8s %8s %8s\n",
+ "name", "open", "read", "KB tot", "B avg", "write", "KB tot", "B avg")
+ foreach (name in totals- limit 20) { # sort by total io
+ printf("%16s %8d %8d %8d %8d %8d %8d %8d\n",
+ name, @count(opens[name]),
+ @count(reads[name]),
+ (@count(reads[name]) ? @sum(reads[name])>>10 : 0 ),
+ (@count(reads[name]) ? @avg(reads[name]) : 0 ),
+ @count(writes[name]),
+ (@count(writes[name]) ? @sum(writes[name])>>10 : 0 ),
+ (@count(writes[name]) ? @avg(writes[name]) : 0 ))
+ }
+}
diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html
index 61112579..b3ea0943 100644
--- a/testsuite/systemtap.examples/keyword-index.html
+++ b/testsuite/systemtap.examples/keyword-index.html
@@ -39,9 +39,12 @@
</ul>
<h2>Examples by Keyword</h2>
-<p><tt><a href="#BACKTRACE">BACKTRACE</a> <a href="#CALLGRAPH">CALLGRAPH</a> <a href="#CPU">CPU</a> <a href="#DISK">DISK</a> <a href="#FUNCTIONS">FUNCTIONS</a> <a href="#FUTEX">FUTEX</a> <a href="#GRAPH">GRAPH</a> <a href="#IO">IO</a> <a href="#LOCKING">LOCKING</a> <a href="#NETWORK">NETWORK</a> <a href="#PER-PROCESS">PER-PROCESS</a> <a href="#PROFILING">PROFILING</a> <a href="#READ">READ</a> <a href="#SCHEDULER">SCHEDULER</a> <a href="#SIGNALS">SIGNALS</a> <a href="#SIMPLE">SIMPLE</a> <a href="#SLEEP">SLEEP</a> <a href="#SOCKET">SOCKET</a> <a href="#SYSCALL">SYSCALL</a> <a href="#TIME">TIME</a> <a href="#TRACE">TRACE</a> <a href="#TRAFFIC">TRAFFIC</a> <a href="#USE">USE</a> <a href="#WAIT4">WAIT4</a> <a href="#WRITE">WRITE</a> </tt></p>
+<p><tt><a href="#BACKTRACE">BACKTRACE</a> <a href="#CALLGRAPH">CALLGRAPH</a> <a href="#CPU">CPU</a> <a href="#DISK">DISK</a> <a href="#FUNCTIONS">FUNCTIONS</a> <a href="#FUTEX">FUTEX</a> <a href="#GRAPH">GRAPH</a> <a href="#INTERRUPT">INTERRUPT</a> <a href="#IO">IO</a> <a href="#LOCKING">LOCKING</a> <a href="#MEMORY">MEMORY</a> <a href="#NETWORK">NETWORK</a> <a href="#PER-PROCESS">PER-PROCESS</a> <a href="#PROFILING">PROFILING</a> <a href="#READ">READ</a> <a href="#SCHEDULER">SCHEDULER</a> <a href="#SIGNALS">SIGNALS</a> <a href="#SIMPLE">SIMPLE</a> <a href="#SLEEP">SLEEP</a> <a href="#SOCKET">SOCKET</a> <a href="#SYSCALL">SYSCALL</a> <a href="#TCP">TCP</a> <a href="#TIME">TIME</a> <a href="#TRACE">TRACE</a> <a href="#TRAFFIC">TRAFFIC</a> <a href="#USE">USE</a> <a href="#WAIT4">WAIT4</a> <a href="#WRITE">WRITE</a> </tt></p>
<h3><a name="BACKTRACE">BACKTRACE</a></h3>
<ul>
+<li><a href="interrupt/scf.stp">interrupt/scf.stp</a> - Tally Backtraces for Inter-Processor Interrupt (IPI)<br>
+keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
+<p>The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.</p></li>
<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br>
keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
<p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li>
@@ -88,11 +91,20 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde
keywords: <a href="keyword-index.html#DISK">DISK</a> <a href="keyword-index.html#CPU">CPU</a> <a href="keyword-index.html#USE">USE</a> <a href="keyword-index.html#GRAPH">GRAPH</a> <br>
<p>The script tracks the disk and CPU utilization. The resulting output of the script can be piped into gnuplot to generate a graph of disk and CPU USE.</p></li>
</ul>
+<h3><a name="INTERRUPT">INTERRUPT</a></h3>
+<ul>
+<li><a href="interrupt/scf.stp">interrupt/scf.stp</a> - Tally Backtraces for Inter-Processor Interrupt (IPI)<br>
+keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
+<p>The Linux kernel function smp_call_function causes expensive inter-processor interrupts (IPIs). The scf.stp script tallies the processes and backtraces causing the interprocessor interrupts to identify the cause of the expensive IPI. On exit the script prints the tallies in descending frequency.</p></li>
+</ul>
<h3><a name="IO">IO</a></h3>
<ul>
<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br>
keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
<p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li>
+<li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br>
+keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li>
<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br>
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <br>
<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li>
@@ -115,6 +127,15 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#SCH
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#LOCKING">LOCKING</a> <a href="keyword-index.html#FUTEX">FUTEX</a> <br>
<p>The script watches the futex syscall on the system. On exit the futexes address, the number of contentions, and the average time for each contention on the futex are printed from lowest pid number to highest.</p></li>
</ul>
+<h3><a name="MEMORY">MEMORY</a></h3>
+<ul>
+<li><a href="memory/kmalloc-top">memory/kmalloc-top</a> - Show Paths to Kernel Malloc (kmalloc) Invocations<br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+<p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).</p></li>
+<li><a href="memory/pfaults.stp">memory/pfaults.stp</a> - Generate Log of Major and Minor Page Faults<br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+<p>The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.</p></li>
+</ul>
<h3><a name="NETWORK">NETWORK</a></h3>
<ul>
<li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br>
@@ -123,6 +144,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br>
keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li>
+<li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
+<p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li>
</ul>
<h3><a name="PER-PROCESS">PER-PROCESS</a></h3>
<ul>
@@ -132,6 +156,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
</ul>
<h3><a name="PROFILING">PROFILING</a></h3>
<ul>
+<li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br>
+keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li>
<li><a href="process/pf2.stp">process/pf2.stp</a> - Profile kernel functions<br>
keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
<p>The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.</p></li>
@@ -141,6 +168,12 @@ keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword-
<li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br>
keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
<p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li>
+<li><a href="profiling/timeout.stp">profiling/timeout.stp</a> - Show Processes Doing Polling Operations<br>
+keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p>The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes.</p></li>
+<li><a href="profiling/topsys.stp">profiling/topsys.stp</a> - Show Processes Doing Polling Operations<br>
+keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The topsys.stp script lists out the top twenty systemcalls for the previous 5 seconds. The output is sorted from most frequent to least frequent.</p></li>
</ul>
<h3><a name="READ">READ</a></h3>
<ul>
@@ -186,6 +219,9 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde
<li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions called in Network Socket Code<br>
keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
<p>The script instrument each of the functions inn the Linux kernel's net/socket.c file. The script prints out trace. The first element of a line is time delta in microseconds from the previous entry. This is followed by the command name and the PID. The "->" and "<-" indicates function entry and function exit, respectively. The last element of the line is the function name.</p></li>
+<li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
+<p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li>
</ul>
<h3><a name="SYSCALL">SYSCALL</a></h3>
<ul>
@@ -208,6 +244,12 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br>
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#WAIT4">WAIT4</a> <br>
<p>The script watches each wait4 syscall on the system. At the end of each wait4 syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "wait4:" key, the duration of the wait and the PID that the wait4 was waiting for. If the waited for PID is not specified , it is "-1".</p></li>
</ul>
+<h3><a name="TCP">TCP</a></h3>
+<ul>
+<li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
+<p>The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.</p></li>
+</ul>
<h3><a name="TIME">TIME</a></h3>
<ul>
<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br>
diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt
index 8cafd43f..5f382e75 100644
--- a/testsuite/systemtap.examples/keyword-index.txt
+++ b/testsuite/systemtap.examples/keyword-index.txt
@@ -3,6 +3,16 @@ SYSTEMTAP EXAMPLES INDEX BY KEYWORD
= BACKTRACE =
+interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
+keywords: interrupt backtrace
+
+ The Linux kernel function smp_call_function causes expensive
+ inter-processor interrupts (IPIs). The scf.stp script tallies the
+ processes and backtraces causing the interprocessor interrupts to
+ identify the cause of the expensive IPI. On exit the script prints
+ the tallies in descending frequency.
+
+
io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
keywords: io backtrace
@@ -93,6 +103,18 @@ keywords: disk cpu use graph
and CPU USE.
+= INTERRUPT =
+
+interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
+keywords: interrupt backtrace
+
+ The Linux kernel function smp_call_function causes expensive
+ inter-processor interrupts (IPIs). The scf.stp script tallies the
+ processes and backtraces causing the interprocessor interrupts to
+ identify the cause of the expensive IPI. On exit the script prints
+ the tallies in descending frequency.
+
+
= IO =
io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
@@ -103,6 +125,17 @@ keywords: io backtrace
list from most common to least common backtrace.
+io/iostats.stp - List Executables Reading and Writing the Most Data
+keywords: io profiling
+
+ The iostat.stp script measures the amount of data successfully read
+ and written by all the executables on the system. The output is
+ sorted from most greatest sum of bytes read and written by an
+ executable to the least. The output contains the count of operations
+ (opens, reads, and writes), the totals and averages for the number of
+ bytes read and written.
+
+
io/iotime.stp - Trace Time Spent in Read and Write for Files
keywords: syscall read write time io
@@ -160,6 +193,31 @@ keywords: syscall locking futex
highest.
+= MEMORY =
+
+memory/kmalloc-top - Show Paths to Kernel Malloc (kmalloc) Invocations
+keywords: memory
+
+ The kmalloc-top perl program runs a small systemtap script to collect
+ stack traces for each call to the kmalloc function and counts the
+ time that each stack trace is observed. When kmalloc-top exits it
+ prints out sorted list. The output can be be filtered to print only
+ only the first stack traces (-t) stack traces with more a minimum
+ counts (-m), or exclude certain stack traces (-e).
+
+
+memory/pfaults.stp - Generate Log of Major and Minor Page Faults
+keywords: memory
+
+ The pfaults.stp script generates a simple log for each major and
+ minor page fault that occurs on the system. Each line contains a
+ timestamp (in microseconds) when the page fault servicing was
+ completed, the pid of the process, the address of the page fault, the
+ type of access (read or write), the type of fault (major or minor),
+ and the elapsed time for page fault. This log can be examined to
+ determine where the page faults are occuring.
+
+
= NETWORK =
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
@@ -182,6 +240,16 @@ keywords: network socket
element of the line is the function name.
+network/tcp_connections.stp - Track Creation of Incoming TCP Connections
+keywords: network tcp socket
+
+ The tcp_connections.stp script prints information for each new
+ incoming TCP connection accepted by the computer. The information
+ includes the UID, the command accepting the connection, the PID of
+ the command, the port the connection is on, and the IP address of the
+ originator of the request.
+
+
= PER-PROCESS =
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
@@ -195,6 +263,17 @@ keywords: network traffic per-process
= PROFILING =
+io/iostats.stp - List Executables Reading and Writing the Most Data
+keywords: io profiling
+
+ The iostat.stp script measures the amount of data successfully read
+ and written by all the executables on the system. The output is
+ sorted from most greatest sum of bytes read and written by an
+ executable to the least. The output contains the count of operations
+ (opens, reads, and writes), the totals and averages for the number of
+ bytes read and written.
+
+
process/pf2.stp - Profile kernel functions
keywords: profiling
@@ -222,6 +301,26 @@ keywords: profiling
user-space and kernel-space.
+profiling/timeout.stp - Show Processes Doing Polling Operations
+keywords: profiling
+
+ The timeout.stp script is based on a blog entry
+ (http://udrepper.livejournal.com/19041.html) mentioning a need for a
+ tool to help developers find applications that are polling. The
+ timeout.stp script monitors systemcall used for polling and records
+ the systemcalls that timed out rather than returned because some
+ action occurred. The script updates the screen once a second with the
+ top twenty processes.
+
+
+profiling/topsys.stp - Show Processes Doing Polling Operations
+keywords: profiling
+
+ The topsys.stp script lists out the top twenty systemcalls for the
+ previous 5 seconds. The output is sorted from most frequent to least
+ frequent.
+
+
= READ =
io/iotime.stp - Trace Time Spent in Read and Write for Files
@@ -318,6 +417,16 @@ keywords: network socket
element of the line is the function name.
+network/tcp_connections.stp - Track Creation of Incoming TCP Connections
+keywords: network tcp socket
+
+ The tcp_connections.stp script prints information for each new
+ incoming TCP connection accepted by the computer. The information
+ includes the UID, the command accepting the connection, the PID of
+ the command, the port the connection is on, and the IP address of the
+ originator of the request.
+
+
= SYSCALL =
io/iotime.stp - Trace Time Spent in Read and Write for Files
@@ -381,6 +490,18 @@ keywords: syscall wait4
waiting for. If the waited for PID is not specified , it is "-1".
+= TCP =
+
+network/tcp_connections.stp - Track Creation of Incoming TCP Connections
+keywords: network tcp socket
+
+ The tcp_connections.stp script prints information for each new
+ incoming TCP connection accepted by the computer. The information
+ includes the UID, the command accepting the connection, the PID of
+ the command, the port the connection is on, and the IP address of the
+ originator of the request.
+
+
= TIME =
io/iotime.stp - Trace Time Spent in Read and Write for Files
diff --git a/testsuite/systemtap.examples/memory/kmalloc-top b/testsuite/systemtap.examples/memory/kmalloc-top
new file mode 100755
index 00000000..ccce0c17
--- /dev/null
+++ b/testsuite/systemtap.examples/memory/kmalloc-top
@@ -0,0 +1,171 @@
+#!/usr/bin/perl
+#
+# This script accumulates the execution paths of all calls to kmalloc
+# in the kernel. On Ctrl-C (or exit of the command provided by -c option),
+# it sorts, filters and displays them on
+# stdout.
+#
+# The -e (exclude) option can be used to specify a comma-separated list
+# - any stack with contents matching any of the items in the list will
+# be excluded from the output.
+#
+# The -m (min) option can be used to specify the minimum number of
+# occurrences a stack needs to be included in the output.
+#
+# The -t (top) option can be used to specify printing only the
+# top N stack traces.
+#
+# The -c (command) option runs starts the command and script
+# only runs for the duration of the command.
+#
+# The -o (options) option passes the options to systemap.
+#
+# Usage: ./kmalloc-top [-m min] [-e exclude list] [-t top_n] [-c command]
+# [-o options]
+# Ctrl-c
+
+use Getopt::Std;
+
+my $kmalloc_stacks;
+my $total_kmallocs;
+my $filtered_kmallocs;
+my $sorted_stacks;
+my $first_n = 1000000000;
+my $min_count = 1;
+my $exclude;
+my $options;
+
+$SIG{INT} = \&sigint_handler;
+
+getopts('c:e:m:t:o:');
+
+if ($opt_e) {
+ $exclude = join('|', split(/,/, $opt_e));
+ print "Will exclude stacks containing: $exclude\n";
+}
+
+if ($opt_t) {
+ $first_n = $opt_t;
+ print "Will print only the top $first_n stacks.\n";
+}
+
+if ($opt_m) {
+ $min_count = $opt_m;
+}
+
+if ($opt_c) {
+ $command="-c \"$opt_c\""
+}
+
+if ($opt_o) {
+ $options=$opt_o
+}
+
+print "Will print stacks with counts >= $min_count.\n";
+print STDERR "Press Ctrl-C to stop.\n";
+
+#The systemtap script that instruments the kmalloc
+$script="
+global kmalloc_stack
+
+probe kernel.function(\"__kmalloc\") { kmalloc_stack[backtrace()]++ }
+
+probe timer.ms(100), end
+{
+ foreach (stack in kmalloc_stack) {
+ printf(\"<hashkey>\\n\")
+ print_stack(stack)
+ printf(\"</hashkey>\\n\")
+ printf(\"<hashval>%d</hashval>\\n\", kmalloc_stack[stack])
+ }
+ delete kmalloc_stack
+}
+";
+
+open STREAM, "stap $options -e '$script' $command|" or die "Couldn't get output stream $!";
+
+while (<STREAM>) {
+ if (/<hashval>(.*?)<\/hashval>/) {
+ update_hash($key, $1);
+ $key = "";
+ } elsif ($_ !~ (/<hashkey>|<\/hashkey>/)) {
+ $key .= $_;
+ }
+}
+
+$num_keys_before_filtering = scalar keys %kmalloc_stacks;
+$total_kmallocs = count_kmallocs();
+filter_stacks();
+sort_stacks();
+top_stacks();
+sort_stacks();
+$num_keys_after_filtering = scalar keys %kmalloc_stacks;
+$filtered_kmallocs = count_kmallocs();
+summarize();
+exit();
+
+sub update_hash
+{
+ my($key, $val) = @_;
+ $kmalloc_stacks{$key} += $val;
+}
+
+sub filter_stacks
+{
+ while (($stack, $count) = each %kmalloc_stacks) {
+ if ($count < $min_count) {
+ delete $kmalloc_stacks{$stack};
+ } elsif ($exclude && $stack =~ /$exclude/) {
+ delete $kmalloc_stacks{$stack};
+ }
+ }
+}
+
+sub top_stacks
+{
+ $count=0;
+ foreach $stack(@sorted_stacks) {
+ $count+=1;
+ if ($count > $first_n) {
+ delete $kmalloc_stacks{$stack};
+ }
+ }
+}
+
+sub sort_stacks
+{
+ @sorted_stacks = sort { $kmalloc_stacks{$b} <=> $kmalloc_stacks{$a} } keys %kmalloc_stacks;
+}
+
+sub count_kmallocs {
+ $count = 0;
+ foreach $stack(%kmalloc_stacks) {
+ $count += $kmalloc_stacks{$stack};
+ }
+ return $count;
+}
+
+sub summarize {
+ print "\n";
+ foreach $stack(@sorted_stacks) {
+ print "This path seen $kmalloc_stacks{$stack} times:\n$stack\n";
+ }
+
+ if ($total_kmallocs > 0) {
+ $percent = ($filtered_kmallocs)*100/$total_kmallocs;
+ } else {
+ $percent = 0;
+ }
+ print "Num stacks before filtering: $num_keys_before_filtering\n";
+ print "Num stacks after filtering: $num_keys_after_filtering\n";
+ print "Total kmallocs (before filtering): $total_kmallocs\n";
+ print "Total kmallocs (after filtering): $filtered_kmallocs\n";
+ print "The filter stacks have $percent of the total kmallocs\n";
+
+ close(STREAM);
+}
+
+sub sigint_handler
+{
+ system("pkill kmalloc-stacks");
+}
diff --git a/testsuite/systemtap.examples/memory/kmalloc-top.meta b/testsuite/systemtap.examples/memory/kmalloc-top.meta
new file mode 100644
index 00000000..93308909
--- /dev/null
+++ b/testsuite/systemtap.examples/memory/kmalloc-top.meta
@@ -0,0 +1,13 @@
+title: Show Paths to Kernel Malloc (kmalloc) Invocations
+name: kmalloc-top
+version: 1.0
+author: anonymous
+keywords: memory
+subsystem: memory
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).
+test_check: ./kmalloc-top -o "-p4" -c "sleep 0"
+test_installcheck: ./kmalloc-top -c "sleep 1"
diff --git a/testsuite/systemtap.examples/memory/pfaults.meta b/testsuite/systemtap.examples/memory/pfaults.meta
new file mode 100644
index 00000000..149d83fa
--- /dev/null
+++ b/testsuite/systemtap.examples/memory/pfaults.meta
@@ -0,0 +1,13 @@
+title: Generate Log of Major and Minor Page Faults
+name: pfaults.stp
+version: 1.0
+author: anonymous
+keywords: memory
+subsystem: memory
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.
+test_check: stap -p4 pfaults.stp
+test_installcheck: stap pfaults.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/memory/pfaults.stp b/testsuite/systemtap.examples/memory/pfaults.stp
new file mode 100644
index 00000000..5bf1a8a6
--- /dev/null
+++ b/testsuite/systemtap.examples/memory/pfaults.stp
@@ -0,0 +1,35 @@
+#! /usr/bin/env stap
+
+global fault_entry_time, fault_address, fault_access
+global time_offset
+
+probe begin { time_offset = gettimeofday_us() }
+
+probe vm.pagefault {
+ t = gettimeofday_us()
+ p = pid()
+ fault_entry_time[p] = t
+ fault_address[p] = address
+ fault_access[p] = write_access ? "w" : "r"
+}
+
+probe vm.pagefault.return {
+ t=gettimeofday_us()
+ p = pid()
+ if (!(p in fault_entry_time)) next
+ e = t - fault_entry_time[p]
+ if (vm_fault_contains(fault_type,VM_FAULT_MINOR)) {
+ ftype="minor"
+ } else if (vm_fault_contains(fault_type,VM_FAULT_MAJOR)) {
+ ftype="major"
+ } else {
+ next #only want to deal with minor and major page faults
+ }
+
+ printf("%d:%d:%p:%s:%s:%d\n",
+ t - time_offset, p, fault_address[p], fault_access[p], ftype, e)
+ #free up memory
+ delete fault_entry_time[p]
+ delete fault_address[p]
+ delete fault_access[p]
+}
diff --git a/testsuite/systemtap.examples/network/tcp_connections.meta b/testsuite/systemtap.examples/network/tcp_connections.meta
new file mode 100644
index 00000000..0bc9bcb1
--- /dev/null
+++ b/testsuite/systemtap.examples/network/tcp_connections.meta
@@ -0,0 +1,13 @@
+title: Track Creation of Incoming TCP Connections
+name: tcp_connections.stp
+version: 1.0
+author: anonymous
+keywords: network tcp socket
+subsystem: kernel
+status: production
+exit: user-controlled
+output: trace
+scope: system-wide
+description: The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.
+test_check: stap -p4 tcp_connections.stp
+test_installcheck: stap tcp_connections.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/network/tcp_connections.stp b/testsuite/systemtap.examples/network/tcp_connections.stp
new file mode 100644
index 00000000..bd2db76a
--- /dev/null
+++ b/testsuite/systemtap.examples/network/tcp_connections.stp
@@ -0,0 +1,14 @@
+#! /usr/bin/env stap
+
+probe begin {
+ printf("%6s %16s %6s %6s %16s\n",
+ "UID", "CMD", "PID", "PORT", "IP_SOURCE")
+}
+
+probe kernel.function("tcp_accept").return?,
+ kernel.function("inet_csk_accept").return? {
+ sock = $return
+ if (sock != 0)
+ printf("%6d %16s %6d %6d %16s\n", uid(), execname(), pid(),
+ inet_get_local_port(sock), inet_get_ip_source(sock))
+}
diff --git a/testsuite/systemtap.examples/profiling/functioncallcount.stp b/testsuite/systemtap.examples/profiling/functioncallcount.stp
index 9e9ec3fd..31eaee70 100755
--- a/testsuite/systemtap.examples/profiling/functioncallcount.stp
+++ b/testsuite/systemtap.examples/profiling/functioncallcount.stp
@@ -4,7 +4,7 @@
#
# stap functioncallcount.stp "*@mm/*.c"
-probe kernel.function(@1) { # probe functions listed on commandline
+probe kernel.function(@1).call { # probe functions listed on commandline
called[probefunc()] <<< 1 # add a count efficiently
}
diff --git a/testsuite/systemtap.examples/profiling/latencytap.stp b/testsuite/systemtap.examples/profiling/latencytap.stp
index 96944858..28956129 100644
--- a/testsuite/systemtap.examples/profiling/latencytap.stp
+++ b/testsuite/systemtap.examples/profiling/latencytap.stp
@@ -22,8 +22,8 @@ function _get_sleep_time:long(rq_param:long, p_param:long)
# Get the backtrace from an arbitrary task
function task_backtrace:string (task:long)
%{
- _stp_stack_snprint(THIS->__retvalue, MAXSTRINGLEN,
- task_pt_regs((struct task_struct *)THIS->task), 0, 0, MAXTRACE);
+ _stp_stack_snprint_tsk(THIS->__retvalue, MAXSTRINGLEN,
+ (struct task_struct *)THIS->task, 0, MAXTRACE);
%}
probe kernel.function("enqueue_task_fair") {
@@ -41,6 +41,9 @@ global pid_sleep
probe timer.ms(1000) {
foreach ([pid, backtrace] in sleep_time) {
pid_sleep[pid] += sleep_time[pid, backtrace]
+ printf("%s %d:\n", process_names[pid], pid)
+ print_stack(backtrace)
+ printf("\n")
}
foreach ([pid+] in pid_sleep) {
printf("%s %d %d\n", process_names[pid], @max(sleep_agg[pid]) / 1000000, @avg(sleep_agg[pid]) / 1000000)
diff --git a/testsuite/systemtap.examples/profiling/timeout.meta b/testsuite/systemtap.examples/profiling/timeout.meta
new file mode 100644
index 00000000..aa683c0a
--- /dev/null
+++ b/testsuite/systemtap.examples/profiling/timeout.meta
@@ -0,0 +1,13 @@
+title: Show Processes Doing Polling Operations
+name: timeout.stp
+version: 1.0
+author: Uli Drepper and William Cohen
+keywords: profiling
+subsystem: kernel
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes.
+test_check: stap -p4 timeout.stp
+test_installcheck: stap timeout.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/profiling/timeout.stp b/testsuite/systemtap.examples/profiling/timeout.stp
new file mode 100644
index 00000000..48d6d21d
--- /dev/null
+++ b/testsuite/systemtap.examples/profiling/timeout.stp
@@ -0,0 +1,102 @@
+#! /usr/bin/env stap
+# Copyright (C) 2009 Red Hat, Inc.
+# Written by Ulrich Drepper <drepper@redhat.com>
+# Modified by William Cohen <wcohen@redhat.com>
+
+global process, timeout_count, to
+global poll_timeout, epoll_timeout, select_timeout, itimer_timeout
+global nanosleep_timeout, futex_timeout, signal_timeout
+
+probe syscall.poll, syscall.epoll_wait {
+ if (timeout) to[pid()]=timeout
+}
+
+probe syscall.poll.return {
+ p = pid()
+ if ($return == 0 && to[p] > 0 ) {
+ poll_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+ delete to[p]
+ }
+}
+
+probe syscall.epoll_wait.return {
+ p = pid()
+ if ($return == 0 && to[p] > 0 ) {
+ epoll_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+ delete to[p]
+ }
+}
+
+probe syscall.select.return {
+ if ($return == 0) {
+ p = pid()
+ select_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+ }
+}
+
+probe syscall.futex.return {
+ if (errno_str($return) == "ETIMEDOUT") {
+ p = pid()
+ futex_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+ }
+}
+
+probe syscall.nanosleep.return {
+ if ($return == 0) {
+ p = pid()
+ nanosleep_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+ }
+}
+
+probe kernel.function("it_real_fn") {
+ p = pid()
+ itimer_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+}
+
+probe syscall.rt_sigtimedwait.return {
+ if (errno_str($return) == "EAGAIN") {
+ p = pid()
+ signal_timeout[p]++
+ timeout_count[p]++
+ process[p] = execname()
+ }
+}
+
+probe syscall.exit {
+ p = pid()
+ if (p in process) {
+ delete process[p]
+ delete timeout_count[p]
+ delete poll_timeout[p]
+ delete epoll_timeout[p]
+ delete select_timeout[p]
+ delete itimer_timeout[p]
+ delete futex_timeout[p]
+ delete nanosleep_timeout[p]
+ delete signal_timeout[p]
+ }
+}
+
+probe timer.s(1) {
+ printf("\033[2J\033[1;1H") /* clear screen */
+ printf (" uid | poll select epoll itimer futex nanosle signal| process\n")
+ foreach (p in timeout_count- limit 20) {
+ printf ("%5d |%7d %7d %7d %7d %7d %7d %7d| %-.38s\n", p,
+ poll_timeout[p], select_timeout[p],
+ epoll_timeout[p], itimer_timeout[p],
+ futex_timeout[p], nanosleep_timeout[p],
+ signal_timeout[p], process[p])
+ }
+}
diff --git a/testsuite/systemtap.examples/profiling/topsys.meta b/testsuite/systemtap.examples/profiling/topsys.meta
new file mode 100644
index 00000000..3642713d
--- /dev/null
+++ b/testsuite/systemtap.examples/profiling/topsys.meta
@@ -0,0 +1,13 @@
+title: Show Processes Doing Polling Operations
+name: topsys.stp
+version: 1.0
+author: anonymous
+keywords: profiling
+subsystem: kernel syscalls
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The topsys.stp script lists out the top twenty systemcalls for the previous 5 seconds. The output is sorted from most frequent to least frequent.
+test_check: stap -p4 topsys.stp
+test_installcheck: stap topsys.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/profiling/topsys.stp b/testsuite/systemtap.examples/profiling/topsys.stp
new file mode 100644
index 00000000..34cf826c
--- /dev/null
+++ b/testsuite/systemtap.examples/profiling/topsys.stp
@@ -0,0 +1,24 @@
+#! /usr/bin/env stap
+#
+# This script continuously lists the top 20 systemcalls in the interval
+# 5 seconds
+#
+
+global syscalls_count
+
+probe syscall.* {
+ syscalls_count[name]++
+}
+
+function print_systop () {
+ printf ("%25s %10s\n", "SYSCALL", "COUNT")
+ foreach (syscall in syscalls_count- limit 20) {
+ printf("%25s %10d\n", syscall, syscalls_count[syscall])
+ }
+ delete syscalls_count
+}
+
+probe timer.s(5) {
+ print_systop ()
+ printf("--------------------------------------------------------------\n")
+}