diff options
author | Dave Brolley <brolley@redhat.com> | 2009-04-06 11:40:01 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-04-06 11:40:01 -0400 |
commit | 25ca9e9568b33bb244cfb77d924bd0b0ccbab6a0 (patch) | |
tree | 6b6fbc681a5438788e19ed8879e150a72affbfc9 | |
parent | faf38cd9bd782cf460b2b46f29a6922205b0eab1 (diff) | |
parent | a03c97419b5192fd594afb1f84e9ae4d0801e3a9 (diff) | |
download | systemtap-steved-25ca9e9568b33bb244cfb77d924bd0b0ccbab6a0.tar.gz systemtap-steved-25ca9e9568b33bb244cfb77d924bd0b0ccbab6a0.tar.xz systemtap-steved-25ca9e9568b33bb244cfb77d924bd0b0ccbab6a0.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
28 files changed, 354 insertions, 56 deletions
diff --git a/man/stapprobes.iosched.3stap.in b/man/stapprobes.iosched.3stap.in index e08dce8c..873251ac 100644 --- a/man/stapprobes.iosched.3stap.in +++ b/man/stapprobes.iosched.3stap.in @@ -96,5 +96,5 @@ Fires when a request is completed .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.netdev.3stap.in b/man/stapprobes.netdev.3stap.in index c25fbd44..9b2e57ed 100644 --- a/man/stapprobes.netdev.3stap.in +++ b/man/stapprobes.netdev.3stap.in @@ -74,4 +74,4 @@ Fires when the network device wants to transmit a buffer .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.nfs.3stap.in b/man/stapprobes.nfs.3stap.in index b6a81cde..579af533 100644 --- a/man/stapprobes.nfs.3stap.in +++ b/man/stapprobes.nfs.3stap.in @@ -1232,5 +1232,5 @@ Fires whenever nfs client renames a file on server .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.nfsd.3stap.in b/man/stapprobes.nfsd.3stap.in index d3aea639..239d3b94 100644 --- a/man/stapprobes.nfsd.3stap.in +++ b/man/stapprobes.nfsd.3stap.in @@ -509,5 +509,5 @@ Fires whenever server receives NFS operation from client .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.pagefault.3stap.in b/man/stapprobes.pagefault.3stap.in index b1c53a19..7d4f266e 100644 --- a/man/stapprobes.pagefault.3stap.in +++ b/man/stapprobes.pagefault.3stap.in @@ -36,5 +36,5 @@ Fires when there is a pagefault .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.process.3stap.in b/man/stapprobes.process.3stap.in index 3b5e751d..aa8089e8 100644 --- a/man/stapprobes.process.3stap.in +++ b/man/stapprobes.process.3stap.in @@ -102,5 +102,5 @@ process waits in a zombie state. .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.rpc.3stap.in b/man/stapprobes.rpc.3stap.in index a2622fe5..6061b206 100644 --- a/man/stapprobes.rpc.3stap.in +++ b/man/stapprobes.rpc.3stap.in @@ -579,5 +579,5 @@ Fires when a task is to be delayed .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.scsi.3stap.in b/man/stapprobes.scsi.3stap.in index b595105a..afe16541 100644 --- a/man/stapprobes.scsi.3stap.in +++ b/man/stapprobes.scsi.3stap.in @@ -147,5 +147,5 @@ block device I/O requests .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.signal.3stap.in b/man/stapprobes.signal.3stap.in index f42a7781..9b7ccd5f 100644 --- a/man/stapprobes.signal.3stap.in +++ b/man/stapprobes.signal.3stap.in @@ -505,5 +505,5 @@ Fires when flush all pending signals for a task .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.tcp.3stap.in b/man/stapprobes.tcp.3stap.in index 3e607b69..88603f58 100644 --- a/man/stapprobes.tcp.3stap.in +++ b/man/stapprobes.tcp.3stap.in @@ -98,5 +98,5 @@ Fires when returning from tcp.disconnect .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/man/stapprobes.udp.3stap.in b/man/stapprobes.udp.3stap.in index 3fbfd3e7..dae11578 100644 --- a/man/stapprobes.udp.3stap.in +++ b/man/stapprobes.udp.3stap.in @@ -98,5 +98,5 @@ Fires when returning from udp.disconnect .SH SEE ALSO .IR stap (1), -.IR stapprobes (3stap), +.IR stapprobes (3stap) diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c index 694cb27e..b9796241 100644 --- a/runtime/staprun/relay.c +++ b/runtime/staprun/relay.c @@ -185,7 +185,7 @@ static void *reader_thread(void *data) dbug(3, "cpu=%d poll=%d errno=%d\n", cpu, rc, errno); if (errno != EINTR) { _perr("poll error"); - return(NULL); + goto error_out; } } while ((rc = read(relay_fd[cpu], buf, sizeof(buf))) > 0) { @@ -198,17 +198,24 @@ static void *reader_thread(void *data) remove_file = 1; if (open_outfile(fnum, cpu, remove_file) < 0) { perr("Couldn't open file for cpu %d, exiting.", cpu); - return(NULL); + goto error_out; } wsize = rc; } if (write(out_fd[cpu], buf, rc) != rc) { - perr("Couldn't write to output %d for cpu %d, exiting.", out_fd[cpu], cpu); - return(NULL); + if (errno != EPIPE) + perr("Couldn't write to output %d for cpu %d, exiting.", out_fd[cpu], cpu); + goto error_out; } } } while (!stop_threads); - dbug(3, "exiting thread %d\n", cpu); + dbug(3, "exiting thread for cpu %d\n", cpu); + return(NULL); + +error_out: + /* Signal the main thread that we need to quit */ + kill(getpid(), SIGTERM); + dbug(2, "exiting thread for cpu %d after error\n", cpu); return(NULL); } diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c index 469a5831..33d2daf3 100644 --- a/runtime/staprun/relay_old.c +++ b/runtime/staprun/relay_old.c @@ -239,14 +239,15 @@ static int process_subbufs(struct _stp_buf_info *info, scb->rmfile = 1; if (open_oldoutfile(scb->fnum, cpu, scb->rmfile) < 0) { perr("Couldn't open file for cpu %d, exiting.", cpu); - exit(1); + return -1; } scb->wsize = len; } if (len) { if (fwrite_unlocked (subbuf_ptr, len, 1, percpu_tmpfile[cpu]) != 1) { - _perr("Couldn't write to output file for cpu %d, exiting:", cpu); - exit(1); + if (errno != EPIPE) + _perr("Couldn't write to output file for cpu %d, exiting:", cpu); + return -1; } } subbufs_consumed++; @@ -281,14 +282,17 @@ static void *reader_thread(void *data) if (rc < 0) { if (errno != EINTR) { _perr("poll error"); - exit(1); + break; } err("WARNING: poll warning: %s\n", strerror(errno)); rc = 0; } rc = read(proc_fd[cpu], &status[cpu].info, sizeof(struct _stp_buf_info)); - subbufs_consumed = process_subbufs(&status[cpu].info, &scb); + rc = process_subbufs(&status[cpu].info, &scb); + if (rc < 0) + break; + subbufs_consumed = rc; if (subbufs_consumed) { if (subbufs_consumed > status[cpu].max_backlog) status[cpu].max_backlog = subbufs_consumed; @@ -301,6 +305,10 @@ static void *reader_thread(void *data) if (status[cpu].info.flushing) pthread_exit(NULL); } while (1); + + /* Signal the main thread that we need to quit */ + kill(getpid(), SIGTERM); + pthread_exit(NULL); } /** diff --git a/tapset/ansi.stp b/tapset/ansi.stp new file mode 100644 index 00000000..0152fb37 --- /dev/null +++ b/tapset/ansi.stp @@ -0,0 +1,70 @@ +# ANSI escape sequences tapset +# 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. +# +# Based on some previous work done by Masami Hiramatsu for stapgames. +# Reference: http://en.wikipedia.org/wiki/ANSI_escape_code +# + +function ansi_clear_screen() { + print("\033[1;1H\033[J") +} + +# Foreground colors | Background colors +# Black 30 | Black 40 +# Blue 34 | Red 41 +# Green 32 | Green 42 +# Cyan 36 | Yellow 43 +# Red 31 | Blue 44 +# Purple 35 | Magenta 45 +# Brown 33 | Cyan 46 +# Light Gray 37 | White 47 +function ansi_set_color(fg:long) { + printf("\033[%dm", fg) +} + +function ansi_set_color2(fg:long, bg:long) { + printf("\033[%d;%dm", bg, fg) +} + +# All attributes off 0 +# Intensity: Bold 1 +# Underline: Single 4 +# Blink: Slow 5 +# Blink: Rapid 6 +# Image: Negative 7 +function ansi_set_color3(fg:long, bg:long, attr:long) { + attr_str = attr ? sprintf(";%dm", attr) : "m" + printf("\033[%d;%d%s", bg, fg, attr_str) +} + +function ansi_reset_color() { + ansi_set_color3(0, 0, 0) +} + +function ansi_new_line() { + printf("\12") +} + +function ansi_cursor_move(x:long, y:long) { + printf("\033[%d;%dH", y, x) +} + +function ansi_cursor_hide() { + print("\033[>5I") +} + +function ansi_cursor_save() { + print("\033[s") +} + +function ansi_cursor_restore() { + print("\033[u") +} + +function ansi_cursor_show() { + print("\033[>5h") +} diff --git a/tapsets.cxx b/tapsets.cxx index 1b55684b..f6d73714 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -4906,8 +4906,9 @@ dwarf_var_expanding_visitor::visit_target_symbol (target_symbol *e) literal_number* ln_zero = new literal_number (0); ln_zero->tok = e->tok; provide (ln_zero); - q.sess.print_warning ("Bad variable being substituted with literal 0", - e->tok); + if (!q.sess.suppress_warnings) + q.sess.print_warning ("Bad $context variable being substituted with literal 0", + e->tok); } delete fdecl; delete ec; @@ -7499,6 +7500,10 @@ uprobe_derived_probe::join_group (systemtap_session& s) s.uprobe_derived_probes = new uprobe_derived_probe_group (); s.uprobe_derived_probes->enroll (this); task_finder_derived_probe_group::create_session_group (s); + + // Ask buildrun.cxx to build extra module if needed, and + // signal staprun to load that module + s.need_uprobes = true; } @@ -7531,8 +7536,6 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) if (probes.empty()) return; s.op->newline() << "/* ---- user probes ---- */"; - s.need_uprobes = true; // Ask buildrun.cxx to build extra module if needed - // If uprobes isn't in the kernel, pull it in from the runtime. s.op->newline() << "#if defined(CONFIG_UPROBES) || defined(CONFIG_UPROBES_MODULE)"; s.op->newline() << "#include <linux/uprobes.h>"; 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..3287458a 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,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="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..d538d760 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,16 @@ keywords: network tcp socket originator of the request. +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..2254fd25 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> @@ -157,6 +166,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 +246,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> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index d3a9617f..8fd8e0d8 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. @@ -274,6 +292,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 +488,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 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/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/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], |