From 8e6c3aa3d61109b0276e96cdbc9ffdde60a5ac0a Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:46:43 +0800 Subject: New ANSI escape sequences tapset This adds a new tapset for ANSI escape sequences. It is based on an existing tapset that was written by Masami Hiramatsu for the stapgames project. This also adds a version of ansi_color.stp script that displays other attributes other than the bold effect. --- .../systemtap.examples/general/ansi_colors2.stp | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 testsuite/systemtap.examples/general/ansi_colors2.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp new file mode 100644 index 00000000..5f1b102e --- /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 +# +# 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); + ansi_new_line() + for (l = 0; l < 71; 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("%d |", r); + for (c = 40; c < 48; c++) { + ansi_set_color3(r, c, t) + printf(" Colors ") + ansi_reset_color() + } + ansi_new_line() + } + exit(); +} -- cgit From a8e88602f1c7cbe302542d5af427d354d7d457ba Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:54:23 +0800 Subject: Update scripts to use the new ANSI tapset This updates the example scripts to use the new ANSI escape sequences tapset. It also adds the copyright header that was missing in ansi_colors.stp for a long time. --- .../systemtap.examples/general/ansi_colors.stp | 43 +++++++++++++--------- testsuite/systemtap.examples/io/ioblktime.stp | 2 +- testsuite/systemtap.examples/profiling/timeout.stp | 2 +- 3 files changed, 28 insertions(+), 19 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp index ae954e69..02c7c847 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 +# +# 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("a \\ b |"); + for (c = 40; c < 48; c++) + printf(" %d ", c); + ansi_new_line() + for (l = 0; l < 71; 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("%d |", r); + 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/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/profiling/timeout.stp b/testsuite/systemtap.examples/profiling/timeout.stp index 48d6d21d..7af4a88f 100755 --- a/testsuite/systemtap.examples/profiling/timeout.stp +++ b/testsuite/systemtap.examples/profiling/timeout.stp @@ -90,7 +90,7 @@ probe syscall.exit { } probe timer.s(1) { - printf("\033[2J\033[1;1H") /* clear screen */ + ansi_clear_screen() printf (" uid | poll select epoll itimer futex nanosle signal| process\n") foreach (p in timeout_count- limit 20) { printf ("%5d |%7d %7d %7d %7d %7d %7d %7d| %-.38s\n", p, -- cgit From d1ec6e13b6f971ea23fb3203460384836c04b3c0 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:56:19 +0800 Subject: Make ansi_colors2.stp script executable --- testsuite/systemtap.examples/general/ansi_colors2.stp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testsuite/systemtap.examples/general/ansi_colors2.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp old mode 100644 new mode 100755 -- cgit From cc20d8532b08f7755642ecb30f22126f7ac332c2 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 13:47:57 -0400 Subject: new process/errsnoop.stp sample script --- testsuite/systemtap.examples/index.html | 5 ++- testsuite/systemtap.examples/index.txt | 18 +++++++-- testsuite/systemtap.examples/keyword-index.html | 13 ++++++- testsuite/systemtap.examples/keyword-index.txt | 30 +++++++++++++-- testsuite/systemtap.examples/process/errsnoop.meta | 7 ++++ testsuite/systemtap.examples/process/errsnoop.stp | 43 ++++++++++++++++++++++ 6 files changed, 105 insertions(+), 11 deletions(-) create mode 100644 testsuite/systemtap.examples/process/errsnoop.meta create mode 100644 testsuite/systemtap.examples/process/errsnoop.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 0f4b2572..9880c5b6 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -60,7 +60,7 @@ keywords: IO 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 MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.

+

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

    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.

  • @@ -91,6 +91,9 @@ keywords: NETWORK network/tcp_connections.stp - Track Creation of Incoming TCP Connections
    keywords: NETWORK TCP SOCKET

    The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.

    +
  • process/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

    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.

  • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index e31baf4f..96ac5ab0 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -56,10 +56,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 +166,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/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 75768709..78d467cd 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -39,7 +39,7 @@

    Examples by Keyword

    -

    BACKTRACE CALLGRAPH CPU DISK FUNCTIONS FUTEX GRAPH INTERRUPT IO LOCKING MEMORY NETWORK PER-PROCESS PROFILING READ SCHEDULER SIGNALS SIMPLE SLEEP SOCKET SYSCALL TCP TIME TRACE TRAFFIC USE WAIT4 WRITE

    +

    BACKTRACE CALLGRAPH CPU DISK FUNCTIONS FUTEX GRAPH INTERRUPT IO LOCKING MEMORY NETWORK PER-PROCESS PROCESS PROFILING READ SCHEDULER SIGNALS SIMPLE SLEEP SOCKET SYSCALL TCP TIME TRACE TRAFFIC USE WAIT4 WRITE

    BACKTRACE

    • interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
      @@ -104,7 +104,7 @@ keywords: IO 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 MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line.

    • +

      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

      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.

    • @@ -157,6 +157,12 @@ keywords: NETWORK NETWORK TRAFFIC PER-PROCESS

      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.

    +

    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
      @@ -231,6 +237,9 @@ keywords: NETWORK io/iotime.stp - Trace Time Spent in Read and Write for Files
      keywords: SYSCALL READ WRITE TIME IO

      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.

    • +
    • 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

      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.

    • diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index d3a9617f..17334252 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -129,10 +129,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 +274,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 +470,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/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 100644 index 00000000..d9fba3b7 --- /dev/null +++ b/testsuite/systemtap.examples/process/errsnoop.stp @@ -0,0 +1,43 @@ +#!/usr/bin/env stap +# errsnoop.stp +# Copyright (C) 2009 Red Hat, Inc., Eugene Teo +# +# 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 +} -- cgit From 0e0b566a5c6de7e824067963f3c516d09d9962d3 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 3 Apr 2009 14:38:19 -0400 Subject: Describe the ansi_colors.stp and ansi_colors2.stp. Label tables appropriately. --- testsuite/systemtap.examples/general/ansi_colors.meta | 13 +++++++++++++ testsuite/systemtap.examples/general/ansi_colors.stp | 6 +++--- testsuite/systemtap.examples/general/ansi_colors2.meta | 13 +++++++++++++ testsuite/systemtap.examples/general/ansi_colors2.stp | 6 +++--- testsuite/systemtap.examples/index.html | 6 ++++++ testsuite/systemtap.examples/index.txt | 16 ++++++++++++++++ testsuite/systemtap.examples/keyword-index.html | 11 ++++++++++- testsuite/systemtap.examples/keyword-index.txt | 18 ++++++++++++++++++ 8 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 testsuite/systemtap.examples/general/ansi_colors.meta create mode 100644 testsuite/systemtap.examples/general/ansi_colors2.meta (limited to 'testsuite/systemtap.examples') 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 02c7c847..01e58b9c 100755 --- a/testsuite/systemtap.examples/general/ansi_colors.stp +++ b/testsuite/systemtap.examples/general/ansi_colors.stp @@ -8,17 +8,17 @@ # probe begin { - printf("a \\ b |"); + printf("fg,t \\ bg |"); for (c = 40; c < 48; c++) printf(" %d ", c); ansi_new_line() - for (l = 0; l < 71; l++) + 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); + printf(" %2d,%1d |", r, t); for (c = 40; c < 48; c++) { ansi_set_color3(r, c, t) printf(" %s ", !t ? "Normal" : "Bold ") 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 index 5f1b102e..fadcf011 100755 --- a/testsuite/systemtap.examples/general/ansi_colors2.stp +++ b/testsuite/systemtap.examples/general/ansi_colors2.stp @@ -8,18 +8,18 @@ # probe begin { - printf("a \\ b |"); + printf("fg,t \\ bg |"); for (c = 40; c < 48; c++) printf(" %d ", c); ansi_new_line() - for (l = 0; l < 71; l++) + 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("%d |", r); + printf(" %2d,%1d |", r, t); for (c = 40; c < 48; c++) { ansi_set_color3(r, c, t) printf(" Colors ") diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 9880c5b6..3287458a 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -40,6 +40,12 @@

      All Examples

        +
      • 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

        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.

      • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index 96ac5ab0..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 diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 78d467cd..2254fd25 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -39,7 +39,7 @@

      Examples by Keyword

      -

      BACKTRACE CALLGRAPH CPU DISK FUNCTIONS FUTEX GRAPH INTERRUPT IO LOCKING MEMORY NETWORK PER-PROCESS PROCESS PROFILING READ SCHEDULER SIGNALS SIMPLE SLEEP SOCKET SYSCALL TCP TIME TRACE TRAFFIC USE WAIT4 WRITE

      +

      BACKTRACE CALLGRAPH CPU DISK FORMAT FUNCTIONS FUTEX GRAPH INTERRUPT IO LOCKING MEMORY NETWORK PER-PROCESS PROCESS PROFILING READ SCHEDULER SIGNALS SIMPLE SLEEP SOCKET SYSCALL TCP TIME TRACE TRAFFIC USE WAIT4 WRITE

      BACKTRACE

      • interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
        @@ -73,6 +73,15 @@ keywords: DISK DISK

        Get the status of reading/writing disk every 5 seconds, output top 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
        diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 17334252..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 -- cgit From a53e0eeb262399f79c0b1b219c7d5f96c2c10fb4 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 3 Apr 2009 14:41:14 -0400 Subject: Correct column heading from uid to pid. --- testsuite/systemtap.examples/profiling/timeout.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/profiling/timeout.stp b/testsuite/systemtap.examples/profiling/timeout.stp index 7af4a88f..8054b364 100755 --- a/testsuite/systemtap.examples/profiling/timeout.stp +++ b/testsuite/systemtap.examples/profiling/timeout.stp @@ -91,7 +91,7 @@ probe syscall.exit { probe timer.s(1) { ansi_clear_screen() - printf (" uid | poll select epoll itimer futex nanosle signal| process\n") + 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], -- cgit From 4e1801d37ecda01c75181a345dcd07a23cd64da0 Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Sat, 4 Apr 2009 21:36:52 +0200 Subject: Make examples executable --- testsuite/systemtap.examples/network/tcp.stp | 0 testsuite/systemtap.examples/process/errsnoop.stp | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testsuite/systemtap.examples/network/tcp.stp mode change 100644 => 100755 testsuite/systemtap.examples/process/errsnoop.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/tcp.stp b/testsuite/systemtap.examples/network/tcp.stp old mode 100644 new mode 100755 diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp old mode 100644 new mode 100755 -- cgit From a03c97419b5192fd594afb1f84e9ae4d0801e3a9 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Sun, 5 Apr 2009 11:52:44 +0800 Subject: Amend process/errsnoop.stp shebang --- testsuite/systemtap.examples/process/errsnoop.stp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp index d9fba3b7..a3f17b77 100755 --- a/testsuite/systemtap.examples/process/errsnoop.stp +++ b/testsuite/systemtap.examples/process/errsnoop.stp @@ -1,4 +1,5 @@ -#!/usr/bin/env stap +#!/bin/sh +//usr/bin/env stap -DMAXMAPENTRIES=20480 $0 $@; exit $? # errsnoop.stp # Copyright (C) 2009 Red Hat, Inc., Eugene Teo # -- cgit From 3dd58c2ac312fc16aa38124987081adbd6697629 Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Wed, 8 Apr 2009 16:57:39 +0200 Subject: Fix stats for processes that only transmitted data without receiving --- testsuite/systemtap.examples/network/nettop.stp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/nettop.stp b/testsuite/systemtap.examples/network/nettop.stp index 15b4d62a..b84e4882 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 { @@ -19,6 +20,12 @@ function print_activity() "XMIT_KB", "RECV_KB", "COMMAND") foreach ([pid, dev, exec, uid] in ifrecv-) { + ifmerged[pid, dev, exec, uid] = 1; + } + foreach ([pid, dev, exec, uid] in ifxmit-) { + ifmerged[pid, dev, exec, uid] = 1; + } + 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 -- cgit From cfde3cb1fdda81a5156df2f39201518d815c2710 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 8 Apr 2009 12:29:29 -0400 Subject: tweak nettop.stp demo to sort by accumulated counts despite merging --- testsuite/systemtap.examples/network/nettop.stp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/nettop.stp b/testsuite/systemtap.examples/network/nettop.stp index b84e4882..e96548f1 100755 --- a/testsuite/systemtap.examples/network/nettop.stp +++ b/testsuite/systemtap.examples/network/nettop.stp @@ -19,11 +19,11 @@ function print_activity() "PID", "UID", "DEV", "XMIT_PK", "RECV_PK", "XMIT_KB", "RECV_KB", "COMMAND") - foreach ([pid, dev, exec, uid] in ifrecv-) { - ifmerged[pid, dev, exec, uid] = 1; + 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] = 1; + 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]) -- cgit From 5e868ddd8263d2f7b61a702891252cc2bacb1c07 Mon Sep 17 00:00:00 2001 From: Andre Detsch Date: Tue, 14 Apr 2009 14:23:59 -0300 Subject: Add new TCP and IP functions This patch adds some basic functions to the IP and TCP tapsets. Mainly, it's possible to get the iphdr and tcphdr from a sk_buff structure. As a consequence, a TCP probe called tcp.receive() was created and is probed every time a TCP packet is received, and a lot of useful fields is available, as the TCP flags. Also a small example that works like tcpdump for received TCP packets was created. This patch was tested on x86 and ppc machines, on 2.6.18 kernel and also on mainline one. Signed-off-by: Breno Leitao Signed-off-by: Andre Detsch Signed-off-by: Josh Stone --- testsuite/systemtap.examples/network/tcpdumplike.stp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 testsuite/systemtap.examples/network/tcpdumplike.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/tcpdumplike.stp b/testsuite/systemtap.examples/network/tcpdumplike.stp new file mode 100644 index 00000000..4026e7a7 --- /dev/null +++ b/testsuite/systemtap.examples/network/tcpdumplike.stp @@ -0,0 +1,12 @@ +// 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) +} -- cgit From b9c1e0228f6c629e278820caf40870cdad285441 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 14 Apr 2009 11:00:05 -0700 Subject: Make tcpdumplike.stp executable --- testsuite/systemtap.examples/network/tcpdumplike.stp | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 testsuite/systemtap.examples/network/tcpdumplike.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/tcpdumplike.stp b/testsuite/systemtap.examples/network/tcpdumplike.stp old mode 100644 new mode 100755 index 4026e7a7..533c71b9 --- a/testsuite/systemtap.examples/network/tcpdumplike.stp +++ b/testsuite/systemtap.examples/network/tcpdumplike.stp @@ -1,3 +1,5 @@ +#! /usr/bin/env stap + // A TCP dump like example probe begin, timer.s(1) { -- cgit From 1f65cc4ffd1bd362b10d7f07d1cb9c4e7de68027 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 14 Apr 2009 12:34:12 -0700 Subject: PR9953: split up the two process.* tapsets The overlapping process.* tapsets are now separated. Those probe points documented in stapprobes(3stap) remain the same. Those that were formerly in stapprobes.process(3stap) have been renamed to kprocess, to reflect their kernel perspective on processes. --- testsuite/systemtap.examples/process/proc_snoop.stp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'testsuite/systemtap.examples') 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))) } -- cgit From 7a51212ca1895b85f400fafe0e5198525996af1d Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 14 Apr 2009 17:37:19 -0400 Subject: Minor formatting to avoid line wrap, added tcpdumplike.meta file, and regenerated index files. --- testsuite/systemtap.examples/index.html | 3 +++ testsuite/systemtap.examples/index.txt | 8 ++++++++ testsuite/systemtap.examples/keyword-index.html | 6 ++++++ testsuite/systemtap.examples/keyword-index.txt | 16 ++++++++++++++++ testsuite/systemtap.examples/network/tcpdumplike.meta | 12 ++++++++++++ testsuite/systemtap.examples/network/tcpdumplike.stp | 10 +++++----- 6 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 testsuite/systemtap.examples/network/tcpdumplike.meta (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 3287458a..a03b8dcc 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -97,6 +97,9 @@ keywords: NETWORK network/tcp_connections.stp - Track Creation of Incoming TCP Connections
        keywords: NETWORK TCP SOCKET

        The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.

      • +
      • 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).

      • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index d538d760..d24232e7 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -182,6 +182,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. + + process/errsnoop.stp - tabulate system call errors keywords: process syscall diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 2254fd25..e65ed19d 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -159,6 +159,9 @@ keywords: NETWORK network/tcp_connections.stp - Track Creation of Incoming TCP Connections
        keywords: NETWORK TCP SOCKET

        The tcp_connections.stp script prints information for each new incoming TCP connection accepted by the computer. The information includes the UID, the command accepting the connection, the PID of the command, the port the connection is on, and the IP address of the originator of the request.

        +
      • 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

        @@ -288,6 +291,9 @@ keywords: TRACE network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
        keywords: NETWORK TRAFFIC PER-PROCESS

        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.

        +
      • 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

        diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 8fd8e0d8..40b5276f 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -281,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 @@ -597,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/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 index 533c71b9..de3899d6 100755 --- a/testsuite/systemtap.examples/network/tcpdumplike.stp +++ b/testsuite/systemtap.examples/network/tcpdumplike.stp @@ -3,12 +3,12 @@ // 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"); + 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) + printf(" %15s %15s %5d %5d %d %d %d %d %d %d\n", + saddr, daddr, sport, dport, urg, ack, psh, rst, syn, fin) } -- cgit