summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r--testsuite/systemtap.examples/README146
-rw-r--r--testsuite/systemtap.examples/general/ansi_colors.meta13
-rwxr-xr-xtestsuite/systemtap.examples/general/ansi_colors.stp43
-rw-r--r--testsuite/systemtap.examples/general/ansi_colors2.meta13
-rwxr-xr-xtestsuite/systemtap.examples/general/ansi_colors2.stp31
-rw-r--r--testsuite/systemtap.examples/general/grapher.stp32
-rw-r--r--testsuite/systemtap.examples/general/para-callgraph.meta4
-rw-r--r--testsuite/systemtap.examples/index.html20
-rw-r--r--testsuite/systemtap.examples/index.txt56
-rw-r--r--testsuite/systemtap.examples/io/ioblktime.meta13
-rwxr-xr-xtestsuite/systemtap.examples/io/ioblktime.stp29
-rwxr-xr-xtestsuite/systemtap.examples/io/traceio.stp33
-rw-r--r--testsuite/systemtap.examples/keyword-index.html52
-rw-r--r--testsuite/systemtap.examples/keyword-index.txt105
-rw-r--r--testsuite/systemtap.examples/network/dropwatch.meta13
-rwxr-xr-xtestsuite/systemtap.examples/network/dropwatch.stp30
-rwxr-xr-xtestsuite/systemtap.examples/network/nettop.stp10
-rwxr-xr-xtestsuite/systemtap.examples/network/tcp.stp13
-rw-r--r--testsuite/systemtap.examples/network/tcpdumplike.meta12
-rwxr-xr-xtestsuite/systemtap.examples/network/tcpdumplike.stp14
-rw-r--r--testsuite/systemtap.examples/process/errsnoop.meta7
-rwxr-xr-xtestsuite/systemtap.examples/process/errsnoop.stp44
-rwxr-xr-xtestsuite/systemtap.examples/process/proc_snoop.stp12
-rw-r--r--testsuite/systemtap.examples/process/sigmon.meta4
-rwxr-xr-xtestsuite/systemtap.examples/profiling/latencytap.stp2
-rwxr-xr-xtestsuite/systemtap.examples/profiling/timeout.stp4
26 files changed, 660 insertions, 95 deletions
diff --git a/testsuite/systemtap.examples/README b/testsuite/systemtap.examples/README
index e505bdfb..89586ece 100644
--- a/testsuite/systemtap.examples/README
+++ b/testsuite/systemtap.examples/README
@@ -1,57 +1,105 @@
-This directory contains example scripts.
+This text describes contribution procedures for adding scripts to
+systemtap.examples directory. Please read before submitting SystemTap
+examples. Discussions take place on the
+<systemtap@sources.redhat.com> mailing list.
-Each script should be checked in as executable.
+- general
-The first line should be
-#! /usr/bin/env stap
+ The script should do something that normal users of SystemTap might
+ like to do, such as show which processes have system calls that time
+ out or show which memory accesses cause page faults. Scripts that
+ check that some aspect of SystemTap operates correctly, but would
+ never be used by a regular user should go in one of the other
+ testsuite directories.
-There should be an accompanying ".meta" file describing what the
-script does and how to use it, and how the testsuite should compile
-and run it. The meta files are also used to create a txt and html
-index (by keyword and subsystem) of all the examples by the
-examples-index-gen.pl script.
+- copyright
-The meta file contains the following elements. Each element (key and
-value) are on one line. If a key can have a list of values, the list
-elements are separated by spaces.
+ You must designate the appropriate copyright holder for your
+ contribution. The copyright holder is assumed to agree with the
+ general licensing terms (GPLv2+).
+
+- coding style
-title: Descriptive title for the script (required)
-name: the file name for the script, e.g. iotime.stp (required)
-version: versioning if any fixes and developed can be identified (required)
-author: name of author(s), "anonymous" if unknown (required)
-exclusivearch: Stated if the script can only run on some arches
+ Abide by the general formatting of the code for SystemTap. The
+ code base generally follows the GNU standards in usermode code and
+ the Linux kernel standards in runtime code.
+
+ - Try to keep the lines shorter than 80 characters long.
+ - Make use of SystemTap functions to factor out common idioms in code.
+ - Use tapset probe points rather than raw function names.
+ - No probes by file and line number are allowed in examples.
+ - Avoid using guru mode (-g) in the examples.
+ - Minimize use of globals variables:
+ All associative arrays must be global in SystemTap.
+ Variables used only for the duration of a probe should be local.
+ - Make the file executable and use the following line at the
+ beginning of the script to select the proper interpreter:
+
+ #! /usr/bin/env stap
+
+- Describe the example
+
+ Each example script has a description in a .meta file that provide
+ an easy-to-parse format that describes various aspect of the example
+ script. The .meta file has the same base name as the example script.
+ The .meta file is parsed to generate a web page listing all the
+ available examples; the webpage is available at:
+ http://sourceware.org/systemtap/examples/. The .meta file also
+ describes how to run the compiled example script for testing. This
+ ensures that the example is frequently run to verified it works on a
+ wide range fo platforms.
+
+ The meta file contains the following elements. Each element (key and
+ value) are on one line. If a key can have a list of values, the list
+ elements are separated by spaces.
+
+ title: Descriptive title for the script (required)
+ name: the file name for the script, e.g. iotime.stp (required)
+ version: versioning if any fixes and developed can be identified (required)
+ author: name of author(s), "anonymous" if unknown (required)
+ exclusivearch: Stated if the script can only run on some arches
this concept borrowed from rpm, matches types for rpm:
x86 i386 x86_64 ppc ppc64, s390 (optional)
-requires: Some scripts may require software to be available. In some cases
- may need version numbering, e.g. kernel >= 2.6
- Can have multiple "requires:" tags. (optional)
-keywords: List of likely words to categorize the script (required)
- keywords are separated by spaces.
- #FIXME have list of keyword
-subsystem: List what part of the kernel the instrumentation probes (required)
- audit cpu blockio file filesystem locking memory numa network
- process scheduler or user-space (probes are in the user-space)
-application: when user-space probing becomes available (optional)
- a script might probe a particular application
- this tag indicates the applicaton
-status: describes the state of development for the script (required)
- proposed just an idea
- experimental an implemented idea, but use at own risk
- alpha
- beta
- production should be safe to use
-exit: how long do the script run? (required)
- fixed exits in a fixed amount of time
- user-controlled exits with "cntrl-c"
- event-ended exits with some arbitrary event
-output: what kind of output does the script generate? (required)
- trace histogram graph sorted batch timed
-scope: How much of the processes on the machine does the script watch?
- system-wide or pid
-arg_[0-9]+: Describe what the arguments into the script are. (optional)
-description: A text description what the script does. (required)
-test_check: How to check that the example compiles.
- (e.g. stap -p4 iotime.stp)
-test_installcheck: How to check that the example runs.
- (e.g. stap iotime.stp -c "sleep 1")
+ requires: Some scripts may require software to be available. In some cases
+ may need version numbering, e.g. kernel >= 2.6
+ Can have multiple "requires:" tags. (optional)
+ keywords: List of likely words to categorize the script (required)
+ keywords are separated by spaces.
+ #FIXME have list of keyword
+ subsystem: List what part of the kernel the instrumentation probes (required)
+ audit cpu blockio file filesystem locking memory numa network
+ process scheduler or user-space (probes are in the user-space)
+ application: when user-space probing becomes available (optional)
+ a script might probe a particular application
+ this tag indicates the applicaton
+ status: describes the state of development for the script (required)
+ proposed just an idea
+ experimental an implemented idea, but use at own risk
+ alpha
+ beta
+ production should be safe to use
+ exit: how long do the script run? (required)
+ fixed exits in a fixed amount of time
+ user-controlled exits with "cntrl-c"
+ event-ended exits with some arbitrary event
+ output: what kind of output does the script generate? (required)
+ trace histogram graph sorted batch timed
+ scope: How much of the processes on the machine does the script watch?
+ system-wide or pid
+ arg_[0-9]+: Describe what the arguments into the script are. (optional)
+ description: A text description what the script does. (required)
+ test_check: How to check that the example compiles.
+ (e.g. stap -p4 iotime.stp)
+ test_installcheck: How to check that the example runs.
+ (e.g. stap iotime.stp -c "sleep 1")
+
+
+- Review, revision, and submission of the example script
+
+ When you have a SystemTap script that should be included as an
+ example, submit it to the SystemTap mailing list,
+ systemtap@sources.redhat.com for review. Even if the script is not
+ ready for submission as an example, feel free to ask questions or
+ discuss the work-in-progress script with other people working with
+ SystemTap.
diff --git a/testsuite/systemtap.examples/general/ansi_colors.meta b/testsuite/systemtap.examples/general/ansi_colors.meta
new file mode 100644
index 00000000..2818c235
--- /dev/null
+++ b/testsuite/systemtap.examples/general/ansi_colors.meta
@@ -0,0 +1,13 @@
+title: Color Table for ansi_set_color2() and ansi_set_color3()
+name: ansi_colors.stp
+version: 1.0
+author: Eugene Teo
+keywords: format
+subsystem: none
+status: production
+exit: fixed
+output: text
+scope: system-wide
+description: The script prints a table showing the available color combinations for the ansi_set_color2() and ans_set_color3() functions in the ansi.stp tapset.
+test_check: stap -p4 ansi_colors.stp
+test_installcheck: stap ansi_colors.stp
diff --git a/testsuite/systemtap.examples/general/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp
index ae954e69..01e58b9c 100755
--- a/testsuite/systemtap.examples/general/ansi_colors.stp
+++ b/testsuite/systemtap.examples/general/ansi_colors.stp
@@ -1,21 +1,30 @@
-#! /usr/bin/env stap
+#!/usr/bin/env stap
+# ansi_colors.stp
+# Copyright (C) 2006-2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
probe begin {
- printf("a \\ b |");
- for (c = 40; c < 48; c++)
- printf(" %d ", c);
- printf("\12");
- for (l = 0; l < 71; l++)
- printf("-");
- printf("\12");
+ printf("fg,t \\ bg |");
+ for (c = 40; c < 48; c++)
+ printf(" %d ", c);
+ ansi_new_line()
+ for (l = 0; l < 75; l++)
+ printf("-");
+ ansi_new_line()
- for (r = 30; r < 38; r++)
- for (t = 0; t < 2; t++) {
- printf("%d |", r);
- for (c = 40; c < 48; c++)
- printf("\033[%d;%d%s %s \033[0;0m",
- r, c, !t ? "m" : ";1m", !t ? "Normal" : "Bold ");
- printf("\12");
- }
- exit();
+ for (r = 30; r < 38; r++)
+ for (t = 0; t < 2; t++) {
+ printf(" %2d,%1d |", r, t);
+ for (c = 40; c < 48; c++) {
+ ansi_set_color3(r, c, t)
+ printf(" %s ", !t ? "Normal" : "Bold ")
+ ansi_reset_color()
+ }
+ ansi_new_line()
+ }
+ exit();
}
diff --git a/testsuite/systemtap.examples/general/ansi_colors2.meta b/testsuite/systemtap.examples/general/ansi_colors2.meta
new file mode 100644
index 00000000..4ccaf4e3
--- /dev/null
+++ b/testsuite/systemtap.examples/general/ansi_colors2.meta
@@ -0,0 +1,13 @@
+title: Show Attribues in Table for ansi_set_color3()
+name: ansi_colors2.stp
+version: 1.0
+author: Eugene Teo
+keywords: format
+subsystem: none
+status: production
+exit: fixed
+output: text
+scope: system-wide
+description: The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset.
+test_check: stap -p4 ansi_colors2.stp
+test_installcheck: stap ansi_colors2.stp
diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp
new file mode 100755
index 00000000..fadcf011
--- /dev/null
+++ b/testsuite/systemtap.examples/general/ansi_colors2.stp
@@ -0,0 +1,31 @@
+#!/usr/bin/env stap
+# ansi_colors2.stp
+# Copyright (C) 2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+
+probe begin {
+ printf("fg,t \\ bg |");
+ for (c = 40; c < 48; c++)
+ printf(" %d ", c);
+ ansi_new_line()
+ for (l = 0; l < 75; l++)
+ printf("-");
+ ansi_new_line()
+
+ for (r = 30; r < 38; r++)
+ # this displays more attributes
+ for (t = 0; t < 8; !t ? ++t : t+=3) {
+ printf(" %2d,%1d |", r, t);
+ for (c = 40; c < 48; c++) {
+ ansi_set_color3(r, c, t)
+ printf(" Colors ")
+ ansi_reset_color()
+ }
+ ansi_new_line()
+ }
+ exit();
+}
diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp
new file mode 100644
index 00000000..4f326ec1
--- /dev/null
+++ b/testsuite/systemtap.examples/general/grapher.stp
@@ -0,0 +1,32 @@
+#! /usr/bin/stap
+
+probe begin
+{
+printf ("%%Title:CPU utilization\n");
+printf ("%%XAxisTitle:Time");
+printf ("%%YAxisTitle:Percent");
+printf ("%%DataSet:cpu 100 00ff00 bar");
+printf ("%%DataSet:kbd 100 ff0000 dot");
+}
+
+# CPU utilization
+probe begin { qnames["cpu"] ++; qsq_start ("cpu") }
+probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }}
+probe scheduler.cpu_off { if (!idle) qs_done ("cpu") }
+
+global qnames
+
+function qsq_util_reset(q) {
+ u=qsq_utilization (q, 100)
+ qsq_start (q)
+ return u
+}
+
+probe timer.ms(100) { # collect utilization percentages frequently
+ foreach (q in qnames)
+ printf("cpu %d %d\n", gettimeofday_ms(), qsq_util_reset(q))
+}
+
+probe kernel.function("kbd_event") {
+ printf("kbd %d %d\n", gettimeofday_ms(), 75)
+}
diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta
index 87af07cf..84d1c93f 100644
--- a/testsuite/systemtap.examples/general/para-callgraph.meta
+++ b/testsuite/systemtap.examples/general/para-callgraph.meta
@@ -3,5 +3,5 @@ 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 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/*"
+test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read")
+test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") -c "cat /proc/sys/vm/*"
diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html
index 7b76baa1..0df681ac 100644
--- a/testsuite/systemtap.examples/index.html
+++ b/testsuite/systemtap.examples/index.html
@@ -40,6 +40,12 @@
<h2>All Examples</h2>
<ul>
+<li><a href="general/ansi_colors.stp">general/ansi_colors.stp</a> - Color Table for ansi_set_color2() and ansi_set_color3()<br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+<p>The script prints a table showing the available color combinations for the ansi_set_color2() and ans_set_color3() functions in the ansi.stp tapset.</p></li>
+<li><a href="general/ansi_colors2.stp">general/ansi_colors2.stp</a> - Show Attribues in Table for ansi_set_color3()<br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+<p>The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset.</p></li>
<li><a href="general/graphs.stp">general/graphs.stp</a> - Graphing Disk and CPU Utilization<br>
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>
@@ -58,6 +64,9 @@ keywords: <a href="keyword-index.html#DISK">DISK</a> <br>
<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/ioblktime.stp">io/ioblktime.stp</a> - Average Time Block IO Requests Spend in Queue <br>
+keywords: <a href="keyword-index.html#IO">IO</a> <br>
+<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</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>
@@ -79,6 +88,9 @@ keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
<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/dropwatch.stp">network/dropwatch.stp</a> - Watch Where Socket Buffers are Freed in the Kernel<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <a href="keyword-index.html#BUFFER">BUFFER</a> <a href="keyword-index.html#FREE">FREE</a> <br>
+<p>Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.</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>
@@ -88,6 +100,12 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
<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="network/tcpdumplike.stp">network/tcpdumplike.stp</a> - Dump of Received TCP Packets<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br>
+<p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li>
+<li><a href="process/errsnoop.stp">process/errsnoop.stp</a> - tabulate system call errors<br>
+keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br>
+<p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</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>
@@ -103,7 +121,7 @@ keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
<li><a href="process/sigkill.stp">process/sigkill.stp</a> - Track SIGKILL Signals<br>
keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.</p></li>
-<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br>
+<li><a href="process/sigmon.stp">process/sigmon.stp</a> - Track a particular signal to a specific process<br>
keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
<p>The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.</p></li>
<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br>
diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt
index fdcd3b31..fa344933 100644
--- a/testsuite/systemtap.examples/index.txt
+++ b/testsuite/systemtap.examples/index.txt
@@ -1,6 +1,22 @@
SYSTEMTAP EXAMPLES INDEX
(see also keyword-index.txt)
+general/ansi_colors.stp - Color Table for ansi_set_color2() and ansi_set_color3()
+keywords: format
+
+ The script prints a table showing the available color combinations
+ for the ansi_set_color2() and ans_set_color3() functions in the
+ ansi.stp tapset.
+
+
+general/ansi_colors2.stp - Show Attribues in Table for ansi_set_color3()
+keywords: format
+
+ The script prints a table showing the available attributes (bold,
+ underline, and inverse) with color combinations for the
+ ans_set_color3() function in the ansi.stp tapset.
+
+
general/graphs.stp - Graphing Disk and CPU Utilization
keywords: disk cpu use graph
@@ -52,6 +68,19 @@ keywords: io backtrace
list from most common to least common backtrace.
+io/ioblktime.stp - Average Time Block IO Requests Spend in Queue
+keywords: io
+
+ The ioblktime.stp script tracks the amount of time that each block IO
+ requests spend waiting for completion. The script computes the
+ average time waiting time for block IO per device and prints list
+ every 10 seconds. In some cases there can be too many oustanding
+ block IO operations and the script may exceed the default number of
+ MAXMAPENTRIES allowed. In this case the allowed number can be
+ increased with "-DMAXMAPENTRIES=10000" option on the stap command
+ line.
+
+
io/iostats.stp - List Executables Reading and Writing the Most Data
keywords: io profiling
@@ -123,6 +152,13 @@ keywords: memory
determine where the page faults are occuring.
+network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
+keywords: network tracepoint buffer free
+
+ Every five seconds the dropwatch.stp script lists the number of
+ socket buffers freed at locations in the kernel.
+
+
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
keywords: network traffic per-process
@@ -153,6 +189,24 @@ keywords: network tcp socket
originator of the request.
+network/tcpdumplike.stp - Dump of Received TCP Packets
+keywords: network traffic
+
+ The tcpdumplike.stp prints out a line for each TCP packet received.
+ Each line includes the source and destination IP addresses, the
+ source and destination ports, and flags.
+
+
+process/errsnoop.stp - tabulate system call errors
+keywords: process syscall
+
+ The script prints a periodic tabular report about failing system
+ calls, by process and by syscall failure. The first optional
+ argument specifies the reporting interval (in seconds, default 5);
+ the second optional argument gives a screen height (number of lines
+ in the report, default 20).
+
+
process/futexes.stp - System-Wide Futex Contention
keywords: syscall locking futex
@@ -191,7 +245,7 @@ keywords: signals
that sent the signal.
-process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
+process/sigmon.stp - Track a particular signal to a specific process
keywords: signals
The script watches for a particular signal sent to a specific
diff --git a/testsuite/systemtap.examples/io/ioblktime.meta b/testsuite/systemtap.examples/io/ioblktime.meta
new file mode 100644
index 00000000..18a8b168
--- /dev/null
+++ b/testsuite/systemtap.examples/io/ioblktime.meta
@@ -0,0 +1,13 @@
+title: Average Time Block IO Requests Spend in Queue
+name: ioblktime.stp
+version: 1.0
+author: William Cohen
+keywords: io
+subsystem: kernel
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.
+test_check: stap -p4 ioblktime.stp
+test_installcheck: stap ioblktime.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp
new file mode 100755
index 00000000..d6267b3e
--- /dev/null
+++ b/testsuite/systemtap.examples/io/ioblktime.stp
@@ -0,0 +1,29 @@
+#! /usr/bin/env stap
+
+global req_time, etimes
+
+probe ioblock.request
+{
+ req_time[$bio] = gettimeofday_us()
+}
+
+probe ioblock.end
+{
+ t = gettimeofday_us()
+ s = req_time[$bio]
+ delete req_time[$bio]
+ if (s) {
+ etimes[devname, bio_rw_str(rw)] <<< t - s
+ }
+}
+
+probe timer.s(10), end {
+ ansi_clear_screen()
+ printf("%10s %3s %10s %10s %10s\n",
+ "device", "rw", "total (us)", "count", "avg (us)")
+ foreach ([dev,rw] in etimes - limit 20) {
+ printf("%10s %3s %10d %10d %10d\n", dev, rw,
+ @sum(etimes[dev,rw]), @count(etimes[dev,rw]), @avg(etimes[dev,rw]))
+ }
+ delete etimes
+}
diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp
index 9e2deec6..875000cb 100755
--- a/testsuite/systemtap.examples/io/traceio.stp
+++ b/testsuite/systemtap.examples/io/traceio.stp
@@ -1,6 +1,9 @@
#! /usr/bin/env stap
# traceio.stp
# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+# Copyright (C) 2009 Kai Meyer <kai@unixlords.com>
+# Fixed a bug that allows this to run longer
+# And added the humanreadable function
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -10,22 +13,32 @@
global reads, writes, total_io
probe vfs.read.return {
- reads[execname()] += $return
+ reads[pid(),execname()] += $return
+ total_io[pid(),execname()] += $return
}
probe vfs.write.return {
- writes[execname()] += $return
+ writes[pid(),execname()] += $return
+ total_io[pid(),execname()] += $return
+}
+
+function humanreadable(bytes) {
+ if (bytes > 1024*1024*1024) {
+ return sprintf("%d GiB", bytes/1024/1024/1024)
+ } else if (bytes > 1024*1024) {
+ return sprintf("%d MiB", bytes/1024/1024)
+ } else if (bytes > 1024) {
+ return sprintf("%d KiB", bytes/1024)
+ } else {
+ return sprintf("%d B", bytes)
+ }
}
probe timer.s(1) {
- foreach (p in reads)
- total_io[p] += reads[p]
- foreach (p in writes)
- total_io[p] += writes[p]
- foreach(p in total_io- limit 10)
- printf("%15s r: %8d KiB w: %8d KiB\n",
- p, reads[p]/1024,
- writes[p]/1024)
+ foreach([p,e] in total_io- limit 10)
+ printf("%8d %15s r: %12s w: %12s\n",
+ p, e, humanreadable(reads[p,e]),
+ humanreadable(writes[p,e]))
printf("\n")
# Note we don't zero out reads, writes and total_io,
# so the values are cumulative since the script started.
diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html
index b3ea0943..7edbec21 100644
--- a/testsuite/systemtap.examples/keyword-index.html
+++ b/testsuite/systemtap.examples/keyword-index.html
@@ -39,7 +39,7 @@
</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="#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>
+<p><tt><a href="#BACKTRACE">BACKTRACE</a> <a href="#BUFFER">BUFFER</a> <a href="#CALLGRAPH">CALLGRAPH</a> <a href="#CPU">CPU</a> <a href="#DISK">DISK</a> <a href="#FORMAT">FORMAT</a> <a href="#FREE">FREE</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="#PROCESS">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="#TRACEPOINT">TRACEPOINT</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>
@@ -52,6 +52,12 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BAC
keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li>
</ul>
+<h3><a name="BUFFER">BUFFER</a></h3>
+<ul>
+<li><a href="network/dropwatch.stp">network/dropwatch.stp</a> - Watch Where Socket Buffers are Freed in the Kernel<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <a href="keyword-index.html#BUFFER">BUFFER</a> <a href="keyword-index.html#FREE">FREE</a> <br>
+<p>Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.</p></li>
+</ul>
<h3><a name="CALLGRAPH">CALLGRAPH</a></h3>
<ul>
<li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Callgraph tracing with arguments<br>
@@ -73,6 +79,21 @@ keywords: <a href="keyword-index.html#DISK">DISK</a> <a href="keyword-index.html
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>
</ul>
+<h3><a name="FORMAT">FORMAT</a></h3>
+<ul>
+<li><a href="general/ansi_colors.stp">general/ansi_colors.stp</a> - Color Table for ansi_set_color2() and ansi_set_color3()<br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+<p>The script prints a table showing the available color combinations for the ansi_set_color2() and ans_set_color3() functions in the ansi.stp tapset.</p></li>
+<li><a href="general/ansi_colors2.stp">general/ansi_colors2.stp</a> - Show Attribues in Table for ansi_set_color3()<br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+<p>The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset.</p></li>
+</ul>
+<h3><a name="FREE">FREE</a></h3>
+<ul>
+<li><a href="network/dropwatch.stp">network/dropwatch.stp</a> - Watch Where Socket Buffers are Freed in the Kernel<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <a href="keyword-index.html#BUFFER">BUFFER</a> <a href="keyword-index.html#FREE">FREE</a> <br>
+<p>Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.</p></li>
+</ul>
<h3><a name="FUNCTIONS">FUNCTIONS</a></h3>
<ul>
<li><a href="profiling/functioncallcount.stp">profiling/functioncallcount.stp</a> - Count Times Functions Called<br>
@@ -102,6 +123,9 @@ keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-
<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/ioblktime.stp">io/ioblktime.stp</a> - Average Time Block IO Requests Spend in Queue <br>
+keywords: <a href="keyword-index.html#IO">IO</a> <br>
+<p>The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.</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>
@@ -138,6 +162,9 @@ keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
</ul>
<h3><a name="NETWORK">NETWORK</a></h3>
<ul>
+<li><a href="network/dropwatch.stp">network/dropwatch.stp</a> - Watch Where Socket Buffers are Freed in the Kernel<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <a href="keyword-index.html#BUFFER">BUFFER</a> <a href="keyword-index.html#FREE">FREE</a> <br>
+<p>Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.</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>
@@ -147,6 +174,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
<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="network/tcpdumplike.stp">network/tcpdumplike.stp</a> - Dump of Received TCP Packets<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br>
+<p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li>
</ul>
<h3><a name="PER-PROCESS">PER-PROCESS</a></h3>
<ul>
@@ -154,6 +184,12 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
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>
</ul>
+<h3><a name="PROCESS">PROCESS</a></h3>
+<ul>
+<li><a href="process/errsnoop.stp">process/errsnoop.stp</a> - tabulate system call errors<br>
+keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br>
+<p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</p></li>
+</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>
@@ -198,7 +234,7 @@ keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
<li><a href="process/sigkill.stp">process/sigkill.stp</a> - Track SIGKILL Signals<br>
keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
<p>The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.</p></li>
-<li><a href="process/syscalls_by_pid.stp">process/syscalls_by_pid.stp</a> - System-Wide Count of Syscalls by PID<br>
+<li><a href="process/sigmon.stp">process/sigmon.stp</a> - Track a particular signal to a specific process<br>
keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
<p>The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.</p></li>
</ul>
@@ -228,6 +264,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
<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>
+<li><a href="process/errsnoop.stp">process/errsnoop.stp</a> - tabulate system call errors<br>
+keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br>
+<p>The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).</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>
@@ -262,11 +301,20 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde
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>
</ul>
+<h3><a name="TRACEPOINT">TRACEPOINT</a></h3>
+<ul>
+<li><a href="network/dropwatch.stp">network/dropwatch.stp</a> - Watch Where Socket Buffers are Freed in the Kernel<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <a href="keyword-index.html#BUFFER">BUFFER</a> <a href="keyword-index.html#FREE">FREE</a> <br>
+<p>Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.</p></li>
+</ul>
<h3><a name="TRAFFIC">TRAFFIC</a></h3>
<ul>
<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/tcpdumplike.stp">network/tcpdumplike.stp</a> - Dump of Received TCP Packets<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br>
+<p>The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.</p></li>
</ul>
<h3><a name="USE">USE</a></h3>
<ul>
diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt
index 5f382e75..b53e776f 100644
--- a/testsuite/systemtap.examples/keyword-index.txt
+++ b/testsuite/systemtap.examples/keyword-index.txt
@@ -30,6 +30,15 @@ keywords: io scheduler backtrace
so is the total delay.
+= BUFFER =
+
+network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
+keywords: network tracepoint buffer free
+
+ Every five seconds the dropwatch.stp script lists the number of
+ socket buffers freed at locations in the kernel.
+
+
= CALLGRAPH =
general/para-callgraph.stp - Callgraph tracing with arguments
@@ -70,6 +79,33 @@ keywords: disk
ten entries during that period.
+= FORMAT =
+
+general/ansi_colors.stp - Color Table for ansi_set_color2() and ansi_set_color3()
+keywords: format
+
+ The script prints a table showing the available color combinations
+ for the ansi_set_color2() and ans_set_color3() functions in the
+ ansi.stp tapset.
+
+
+general/ansi_colors2.stp - Show Attribues in Table for ansi_set_color3()
+keywords: format
+
+ The script prints a table showing the available attributes (bold,
+ underline, and inverse) with color combinations for the
+ ans_set_color3() function in the ansi.stp tapset.
+
+
+= FREE =
+
+network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
+keywords: network tracepoint buffer free
+
+ Every five seconds the dropwatch.stp script lists the number of
+ socket buffers freed at locations in the kernel.
+
+
= FUNCTIONS =
profiling/functioncallcount.stp - Count Times Functions Called
@@ -125,6 +161,19 @@ keywords: io backtrace
list from most common to least common backtrace.
+io/ioblktime.stp - Average Time Block IO Requests Spend in Queue
+keywords: io
+
+ The ioblktime.stp script tracks the amount of time that each block IO
+ requests spend waiting for completion. The script computes the
+ average time waiting time for block IO per device and prints list
+ every 10 seconds. In some cases there can be too many oustanding
+ block IO operations and the script may exceed the default number of
+ MAXMAPENTRIES allowed. In this case the allowed number can be
+ increased with "-DMAXMAPENTRIES=10000" option on the stap command
+ line.
+
+
io/iostats.stp - List Executables Reading and Writing the Most Data
keywords: io profiling
@@ -220,6 +269,13 @@ keywords: memory
= NETWORK =
+network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
+keywords: network tracepoint buffer free
+
+ Every five seconds the dropwatch.stp script lists the number of
+ socket buffers freed at locations in the kernel.
+
+
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
keywords: network traffic per-process
@@ -250,6 +306,14 @@ keywords: network tcp socket
originator of the request.
+network/tcpdumplike.stp - Dump of Received TCP Packets
+keywords: network traffic
+
+ The tcpdumplike.stp prints out a line for each TCP packet received.
+ Each line includes the source and destination IP addresses, the
+ source and destination ports, and flags.
+
+
= PER-PROCESS =
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
@@ -261,6 +325,18 @@ keywords: network traffic per-process
interval.
+= PROCESS =
+
+process/errsnoop.stp - tabulate system call errors
+keywords: process syscall
+
+ The script prints a periodic tabular report about failing system
+ calls, by process and by syscall failure. The first optional
+ argument specifies the reporting interval (in seconds, default 5);
+ the second optional argument gives a screen height (number of lines
+ in the report, default 20).
+
+
= PROFILING =
io/iostats.stp - List Executables Reading and Writing the Most Data
@@ -373,7 +449,7 @@ keywords: signals
that sent the signal.
-process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
+process/sigmon.stp - Track a particular signal to a specific process
keywords: signals
The script watches for a particular signal sent to a specific
@@ -445,6 +521,16 @@ keywords: syscall read write time io
syscalls.
+process/errsnoop.stp - tabulate system call errors
+keywords: process syscall
+
+ The script prints a periodic tabular report about failing system
+ calls, by process and by syscall failure. The first optional
+ argument specifies the reporting interval (in seconds, default 5);
+ the second optional argument gives a screen height (number of lines
+ in the report, default 20).
+
+
process/futexes.stp - System-Wide Futex Contention
keywords: syscall locking futex
@@ -533,6 +619,15 @@ keywords: trace callgraph
the trigger.
+= TRACEPOINT =
+
+network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
+keywords: network tracepoint buffer free
+
+ Every five seconds the dropwatch.stp script lists the number of
+ socket buffers freed at locations in the kernel.
+
+
= TRAFFIC =
network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
@@ -544,6 +639,14 @@ keywords: network traffic per-process
interval.
+network/tcpdumplike.stp - Dump of Received TCP Packets
+keywords: network traffic
+
+ The tcpdumplike.stp prints out a line for each TCP packet received.
+ Each line includes the source and destination IP addresses, the
+ source and destination ports, and flags.
+
+
= USE =
general/graphs.stp - Graphing Disk and CPU Utilization
diff --git a/testsuite/systemtap.examples/network/dropwatch.meta b/testsuite/systemtap.examples/network/dropwatch.meta
new file mode 100644
index 00000000..176ba236
--- /dev/null
+++ b/testsuite/systemtap.examples/network/dropwatch.meta
@@ -0,0 +1,13 @@
+title: Watch Where Socket Buffers are Freed in the Kernel
+name: dropwatch.stp
+version: 1.0
+author: Neil Horman
+keywords: network tracepoint buffer free
+subsystem: network
+status: production
+exit: user-controlled
+output: timed
+scope: system-wide
+description: Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.
+test_check: stap -p4 dropwatch.stp
+test_installcheck: stap dropwatch.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/network/dropwatch.stp b/testsuite/systemtap.examples/network/dropwatch.stp
new file mode 100755
index 00000000..79d50a4e
--- /dev/null
+++ b/testsuite/systemtap.examples/network/dropwatch.stp
@@ -0,0 +1,30 @@
+#! /usr/bin/env stap
+
+############################################################
+# Dropwatch.stp
+# Author: Neil Horman <nhorman@redhat.com>
+# An example script to mimic the behavior of the dropwatch utility
+# http://fedorahosted.org/dropwatch
+############################################################
+
+# Array to hold the list of drop points we find
+global locations
+
+# Note when we turn the monitor on and off
+probe begin { printf("Monitoring for dropped packets\n") }
+probe end { printf("Stopping dropped packet monitor\n") }
+
+# increment a drop counter for every location we drop at
+probe kernel.trace("kfree_skb") { locations[$location] <<< 1 }
+
+# Every 5 seconds report our drop locations
+probe timer.sec(5)
+{
+ printf("\n")
+ foreach (l in locations-) {
+ printf("%d packets dropped at location %p\n",
+ @count(locations[l]), l)
+ }
+ delete locations
+}
+
diff --git a/testsuite/systemtap.examples/network/nettop.stp b/testsuite/systemtap.examples/network/nettop.stp
index 15b4d62a..e96548f1 100755
--- a/testsuite/systemtap.examples/network/nettop.stp
+++ b/testsuite/systemtap.examples/network/nettop.stp
@@ -1,6 +1,7 @@
#! /usr/bin/env stap
global ifxmit, ifrecv
+global ifmerged
probe netdev.transmit
{
@@ -18,7 +19,13 @@ function print_activity()
"PID", "UID", "DEV", "XMIT_PK", "RECV_PK",
"XMIT_KB", "RECV_KB", "COMMAND")
- foreach ([pid, dev, exec, uid] in ifrecv-) {
+ foreach ([pid, dev, exec, uid] in ifrecv) {
+ ifmerged[pid, dev, exec, uid] += @count(ifrecv[pid,dev,exec,uid]);
+ }
+ foreach ([pid, dev, exec, uid] in ifxmit) {
+ ifmerged[pid, dev, exec, uid] += @count(ifxmit[pid,dev,exec,uid]);
+ }
+ foreach ([pid, dev, exec, uid] in ifmerged-) {
n_xmit = @count(ifxmit[pid, dev, exec, uid])
n_recv = @count(ifrecv[pid, dev, exec, uid])
printf("%5d %5d %-7s %7d %7d %7d %7d %-15s\n",
@@ -32,6 +39,7 @@ function print_activity()
delete ifxmit
delete ifrecv
+ delete ifmerged
}
probe timer.ms(5000), end, error
diff --git a/testsuite/systemtap.examples/network/tcp.stp b/testsuite/systemtap.examples/network/tcp.stp
new file mode 100755
index 00000000..01db9d2d
--- /dev/null
+++ b/testsuite/systemtap.examples/network/tcp.stp
@@ -0,0 +1,13 @@
+#! /usr/bin/env stap
+
+//A simple TCP tapset example
+
+probe begin {
+ printf("Expected IP 7.91.205.21 .... %s\n", ip_ntop(123456789))
+ printf("Expected IP 58.222.104.177 .... %s\n", ip_ntop(987654321))
+ printf("Expected IP 9.3.191.111 ... %s\n", ip_ntop(151240559))
+}
+
+probe tcp.recvmsg {
+ printf("received a message from %s on port %d from port %d\n", saddr, dport, sport)
+}
diff --git a/testsuite/systemtap.examples/network/tcpdumplike.meta b/testsuite/systemtap.examples/network/tcpdumplike.meta
new file mode 100644
index 00000000..8fb9fccb
--- /dev/null
+++ b/testsuite/systemtap.examples/network/tcpdumplike.meta
@@ -0,0 +1,12 @@
+title: Dump of Received TCP Packets
+name: tcpdumplike.stp
+version: 1.0
+author: anonymous
+keywords: network traffic
+subsystem: network
+status: production
+exit: user-controlled
+output: timed
+scope: system-wide
+description: The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags.
+test_installcheck: stap tcpdumplike.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/network/tcpdumplike.stp b/testsuite/systemtap.examples/network/tcpdumplike.stp
new file mode 100755
index 00000000..de3899d6
--- /dev/null
+++ b/testsuite/systemtap.examples/network/tcpdumplike.stp
@@ -0,0 +1,14 @@
+#! /usr/bin/env stap
+
+// A TCP dump like example
+
+probe begin, timer.s(1) {
+ printf("-----------------------------------------------------------------\n")
+ printf(" Source IP Dest IP SPort DPort U A P R S F \n")
+ printf("-----------------------------------------------------------------\n")
+}
+
+probe tcp.receive {
+ printf(" %15s %15s %5d %5d %d %d %d %d %d %d\n",
+ saddr, daddr, sport, dport, urg, ack, psh, rst, syn, fin)
+}
diff --git a/testsuite/systemtap.examples/process/errsnoop.meta b/testsuite/systemtap.examples/process/errsnoop.meta
new file mode 100644
index 00000000..34b8cb7c
--- /dev/null
+++ b/testsuite/systemtap.examples/process/errsnoop.meta
@@ -0,0 +1,7 @@
+title: tabulate system call errors
+name: errsnoop.stp
+keywords: process syscall
+subsystem: general
+description: The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).
+test_check: stap -p4 errsnoop.stp
+test_installcheck: stap errsnoop.stp 1 10 -c "sleep 3"
diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp
new file mode 100755
index 00000000..a3f17b77
--- /dev/null
+++ b/testsuite/systemtap.examples/process/errsnoop.stp
@@ -0,0 +1,44 @@
+#!/bin/sh
+//usr/bin/env stap -DMAXMAPENTRIES=20480 $0 $@; exit $?
+# errsnoop.stp
+# Copyright (C) 2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# attack "stupid userspace" apps
+#
+
+global error, trace
+
+probe syscall.* {
+ # assume syscall don't nest
+ trace[tid()] = argstr
+}
+
+probe syscall.*.return {
+ errno = errno_p(returnval())
+ if (errno != 0) {
+ t = tid()
+ argstr = trace[t]
+ delete trace[t]
+
+ error[name, execname(), pid(), errno, argstr] <<< 1
+ }
+}
+
+probe timer.s(%( $# > 0 %? $1 %: 5 %)) {
+ ansi_clear_screen()
+ printf("%17s %15s %5s %4s %-12s %s\n",
+ "SYSCALL", "PROCESS", "PID", "HITS", "ERRSTR", "ARGSTR")
+ foreach([fn, comm, pid, errno, argstr] in error- limit %( $# > 1 %? $2 %: 20 %)) {
+ errstr = sprintf("%3d (%s)", errno, errno_str(errno))
+ printf("%17s %15s %5d %4d %-12s %s\n", fn, comm, pid,
+ @count(error[fn, comm, pid, errno, argstr]),
+# errstr, substr(argstr,0,22)) # within cols#80
+ errstr, argstr)
+
+ }
+ delete error
+}
diff --git a/testsuite/systemtap.examples/process/proc_snoop.stp b/testsuite/systemtap.examples/process/proc_snoop.stp
index 06425d45..9a3768c2 100755
--- a/testsuite/systemtap.examples/process/proc_snoop.stp
+++ b/testsuite/systemtap.examples/process/proc_snoop.stp
@@ -18,30 +18,30 @@ function id:string(task:long) {
task_execname(task))
}
-probe process.create {
+probe kprocess.create {
report(sprintf("create %s", id(task)))
}
-probe process.start {
+probe kprocess.start {
report("start")
}
-probe process.exec {
+probe kprocess.exec {
report(sprintf("exec %s", filename))
}
-probe process.exec_complete {
+probe kprocess.exec_complete {
if (success)
report("exec success")
else
report(sprintf("exec failed %d (%s)", errno, errno_str(errno)))
}
-probe process.exit {
+probe kprocess.exit {
report(sprintf("exit %d", code))
}
-probe process.release {
+probe kprocess.release {
report(sprintf("remove %s", id(task)))
}
diff --git a/testsuite/systemtap.examples/process/sigmon.meta b/testsuite/systemtap.examples/process/sigmon.meta
index 18834997..fe192248 100644
--- a/testsuite/systemtap.examples/process/sigmon.meta
+++ b/testsuite/systemtap.examples/process/sigmon.meta
@@ -1,5 +1,5 @@
-title: System-Wide Count of Syscalls by PID
-name: syscalls_by_pid.stp
+title: Track a particular signal to a specific process
+name: sigmon.stp
version: 1.0
author: IBM
keywords: signals
diff --git a/testsuite/systemtap.examples/profiling/latencytap.stp b/testsuite/systemtap.examples/profiling/latencytap.stp
index 28956129..d202ec81 100755
--- a/testsuite/systemtap.examples/profiling/latencytap.stp
+++ b/testsuite/systemtap.examples/profiling/latencytap.stp
@@ -23,7 +23,7 @@ function _get_sleep_time:long(rq_param:long, p_param:long)
function task_backtrace:string (task:long)
%{
_stp_stack_snprint_tsk(THIS->__retvalue, MAXSTRINGLEN,
- (struct task_struct *)THIS->task, 0, MAXTRACE);
+ (struct task_struct *)(unsigned long)THIS->task, 0, MAXTRACE);
%}
probe kernel.function("enqueue_task_fair") {
diff --git a/testsuite/systemtap.examples/profiling/timeout.stp b/testsuite/systemtap.examples/profiling/timeout.stp
index 48d6d21d..8054b364 100755
--- a/testsuite/systemtap.examples/profiling/timeout.stp
+++ b/testsuite/systemtap.examples/profiling/timeout.stp
@@ -90,8 +90,8 @@ probe syscall.exit {
}
probe timer.s(1) {
- printf("\033[2J\033[1;1H") /* clear screen */
- printf (" uid | poll select epoll itimer futex nanosle signal| process\n")
+ ansi_clear_screen()
+ printf (" pid | 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],