summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.examples')
-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/index.html14
-rw-r--r--testsuite/systemtap.examples/index.txt42
-rwxr-xr-xtestsuite/systemtap.examples/io/ioblktime.stp2
-rw-r--r--testsuite/systemtap.examples/keyword-index.html28
-rw-r--r--testsuite/systemtap.examples/keyword-index.txt64
-rwxr-xr-xtestsuite/systemtap.examples/network/nettop.stp10
-rwxr-xr-x[-rw-r--r--]testsuite/systemtap.examples/network/tcp.stp0
-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
-rwxr-xr-xtestsuite/systemtap.examples/profiling/timeout.stp4
17 files changed, 315 insertions, 38 deletions
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/index.html b/testsuite/systemtap.examples/index.html
index 0f4b2572..a03b8dcc 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>
@@ -60,7 +66,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BAC
<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 compute 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>
+<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>
@@ -91,6 +97,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>
diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt
index e31baf4f..d24232e7 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
@@ -56,10 +72,10 @@ 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 compute 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
+ 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.
@@ -166,6 +182,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
diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp
index 5ff59cf7..d6267b3e 100755
--- a/testsuite/systemtap.examples/io/ioblktime.stp
+++ b/testsuite/systemtap.examples/io/ioblktime.stp
@@ -18,7 +18,7 @@ probe ioblock.end
}
probe timer.s(10), end {
- printf("\033[2J\033[1;1H") /* clear screen */
+ ansi_clear_screen()
printf("%10s %3s %10s %10s %10s\n",
"device", "rw", "total (us)", "count", "avg (us)")
foreach ([dev,rw] in etimes - limit 20) {
diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html
index 75768709..e65ed19d 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="#CALLGRAPH">CALLGRAPH</a> <a href="#CPU">CPU</a> <a href="#DISK">DISK</a> <a href="#FORMAT">FORMAT</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="#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>
@@ -73,6 +73,15 @@ 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="FUNCTIONS">FUNCTIONS</a></h3>
<ul>
<li><a href="profiling/functioncallcount.stp">profiling/functioncallcount.stp</a> - Count Times Functions Called<br>
@@ -104,7 +113,7 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BAC
<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 compute 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>
+<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>
@@ -150,6 +159,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>
@@ -157,6 +169,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>
@@ -231,6 +249,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>
@@ -270,6 +291,9 @@ keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.ht
<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 d3a9617f..40b5276f 100644
--- a/testsuite/systemtap.examples/keyword-index.txt
+++ b/testsuite/systemtap.examples/keyword-index.txt
@@ -70,6 +70,24 @@ 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.
+
+
= FUNCTIONS =
profiling/functioncallcount.stp - Count Times Functions Called
@@ -129,10 +147,10 @@ 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 compute 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
+ 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.
@@ -263,6 +281,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
@@ -274,6 +300,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
@@ -458,6 +496,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
@@ -557,6 +605,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/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
index 01db9d2d..01db9d2d 100644..100755
--- a/testsuite/systemtap.examples/network/tcp.stp
+++ b/testsuite/systemtap.examples/network/tcp.stp
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/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],