From 67f8611b9ed9e40a7be946601293ac5b42c52686 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 17 Mar 2009 16:45:30 -0400 Subject: Replace systemtap.samples/ioblocktest.stp with ioblktime.stp. --- testsuite/systemtap.examples/index.html | 3 +++ testsuite/systemtap.examples/index.txt | 13 +++++++++++ testsuite/systemtap.examples/io/ioblktime.meta | 13 +++++++++++ testsuite/systemtap.examples/io/ioblktime.stp | 29 +++++++++++++++++++++++++ testsuite/systemtap.examples/keyword-index.html | 3 +++ testsuite/systemtap.examples/keyword-index.txt | 13 +++++++++++ 6 files changed, 74 insertions(+) create mode 100644 testsuite/systemtap.examples/io/ioblktime.meta create mode 100755 testsuite/systemtap.examples/io/ioblktime.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 7b76baa1..0f4b2572 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -58,6 +58,9 @@ keywords: DISK
  • io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
    keywords: IO BACKTRACE

    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.

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

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

  • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index fdcd3b31..e31baf4f 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -52,6 +52,19 @@ keywords: io backtrace list from most common to least common backtrace. +io/ioblktime.stp - Average Time Block IO Requests Spend in Queue +keywords: io + + The ioblktime.stp script tracks the amount of time that each block IO + requests spend waiting for completion. The script 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. + + io/iostats.stp - List Executables Reading and Writing the Most Data keywords: io profiling diff --git a/testsuite/systemtap.examples/io/ioblktime.meta b/testsuite/systemtap.examples/io/ioblktime.meta new file mode 100644 index 00000000..18a8b168 --- /dev/null +++ b/testsuite/systemtap.examples/io/ioblktime.meta @@ -0,0 +1,13 @@ +title: Average Time Block IO Requests Spend in Queue +name: ioblktime.stp +version: 1.0 +author: William Cohen +keywords: io +subsystem: kernel +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. +test_check: stap -p4 ioblktime.stp +test_installcheck: stap ioblktime.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp new file mode 100755 index 00000000..5ff59cf7 --- /dev/null +++ b/testsuite/systemtap.examples/io/ioblktime.stp @@ -0,0 +1,29 @@ +#! /usr/bin/env stap + +global req_time, etimes + +probe ioblock.request +{ + req_time[$bio] = gettimeofday_us() +} + +probe ioblock.end +{ + t = gettimeofday_us() + s = req_time[$bio] + delete req_time[$bio] + if (s) { + etimes[devname, bio_rw_str(rw)] <<< t - s + } +} + +probe timer.s(10), end { + printf("\033[2J\033[1;1H") /* clear screen */ + printf("%10s %3s %10s %10s %10s\n", + "device", "rw", "total (us)", "count", "avg (us)") + foreach ([dev,rw] in etimes - limit 20) { + printf("%10s %3s %10d %10d %10d\n", dev, rw, + @sum(etimes[dev,rw]), @count(etimes[dev,rw]), @avg(etimes[dev,rw])) + } + delete etimes +} diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index b3ea0943..75768709 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -102,6 +102,9 @@ keywords: INTERRUPT io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
    keywords: IO BACKTRACE

    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.

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

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

  • diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 5f382e75..d3a9617f 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -125,6 +125,19 @@ keywords: io backtrace list from most common to least common backtrace. +io/ioblktime.stp - Average Time Block IO Requests Spend in Queue +keywords: io + + The ioblktime.stp script tracks the amount of time that each block IO + requests spend waiting for completion. The script 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. + + io/iostats.stp - List Executables Reading and Writing the Most Data keywords: io profiling -- cgit From 52064a4bd37f8d81e1f488fe9d32fe6ccee63bd7 Mon Sep 17 00:00:00 2001 From: Breno Leitao Date: Fri, 20 Mar 2009 11:40:04 -0400 Subject: Added functions to grab IP source and destination from a socket, and functions to grab TCP source and destination port from a socket. Also, used this function inside some TCP probe functions, as recvmsg, to provide a richer set of fields. --- testsuite/systemtap.examples/network/tcp.stp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 testsuite/systemtap.examples/network/tcp.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/tcp.stp b/testsuite/systemtap.examples/network/tcp.stp new file mode 100644 index 00000000..ebe72a1c --- /dev/null +++ b/testsuite/systemtap.examples/network/tcp.stp @@ -0,0 +1,11 @@ +//A simple TCP tapset example + +probe begin { + printf("Expected IP 7.91.205.21 .... %s\n", ip_ntop(123456789)) + printf("Expected IP 58.222.104.177 .... %s\n", ip_ntop(987654321)) + printf("Expected IP 9.3.191.111 ... %s\n", ip_ntop(151240559)) +} + +probe tcp.recvmsg { + printf("received a message from %s on port %d from port %d\n", saddr, dport, sport) +} -- cgit From b29c53ec642a8b07633c8602b3bfc428ce2c4cd4 Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Sat, 28 Mar 2009 23:10:20 +0100 Subject: Add header --- testsuite/systemtap.examples/network/tcp.stp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/tcp.stp b/testsuite/systemtap.examples/network/tcp.stp index ebe72a1c..01db9d2d 100644 --- a/testsuite/systemtap.examples/network/tcp.stp +++ b/testsuite/systemtap.examples/network/tcp.stp @@ -1,3 +1,5 @@ +#! /usr/bin/env stap + //A simple TCP tapset example probe begin { -- cgit 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 From 2d45e339f3287cf0b4805ea91b3aa9f17b6d4752 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 15 Apr 2009 18:43:23 +0200 Subject: graphing widget and test harness --- testsuite/systemtap.examples/general/grapher.stp | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 testsuite/systemtap.examples/general/grapher.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp new file mode 100644 index 00000000..04463979 --- /dev/null +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -0,0 +1,32 @@ +#! /usr/bin/stap + +probe begin +{ +printf ("%s\n", "%Title:CPU utilization"); +printf ("%s\n", "%XAxisTitle:Time"); +printf ("%s\n", "%YAxisTitle:Percent"); +printf ("%s\n", "%DataSet:cpu 100 00ff00 bar"); +printf ("%s\n", "%DataSet:kbd 100 ff0000 dot"); +} + +# CPU utilization +probe begin { qnames["cpu"] ++; qsq_start ("cpu") } +probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }} +probe scheduler.cpu_off { if (!idle) qs_done ("cpu") } + +global qnames + +function qsq_util_reset(q) { + u=qsq_utilization (q, 100) + qsq_start (q) + return u +} + +probe timer.ms(100) { # collect utilization percentages frequently + foreach (q in qnames) + printf("cpu %d %d\n", gettimeofday_ms(), qsq_util_reset(q)) +} + +probe kernel.function("kbd_event") { + printf("kbd %d %d\n", gettimeofday_ms(), 75) +} -- cgit From 0e4901b0e6524c4ed5f9b5f3ab0f2a1d1dbd86d6 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 17 Apr 2009 15:41:48 -0400 Subject: Add dropwatch.stp example. --- testsuite/systemtap.examples/index.html | 3 ++ testsuite/systemtap.examples/index.txt | 7 +++++ testsuite/systemtap.examples/keyword-index.html | 23 ++++++++++++++- testsuite/systemtap.examples/keyword-index.txt | 34 ++++++++++++++++++++++ .../systemtap.examples/network/dropwatch.meta | 13 +++++++++ testsuite/systemtap.examples/network/dropwatch.stp | 30 +++++++++++++++++++ 6 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 testsuite/systemtap.examples/network/dropwatch.meta create mode 100644 testsuite/systemtap.examples/network/dropwatch.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index a03b8dcc..a2dc7d5c 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -88,6 +88,9 @@ keywords: MEMORY
      • memory/pfaults.stp - Generate Log of Major and Minor Page Faults
        keywords: MEMORY

        The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.

      • +
      • network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
        +keywords: NETWORK TRACEPOINT BUFFER FREE
        +

        Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.

      • network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
        keywords: NETWORK TRAFFIC PER-PROCESS

        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.

      • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index d24232e7..2f85628a 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -152,6 +152,13 @@ keywords: memory determine where the page faults are occuring. +network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel +keywords: network tracepoint buffer free + + Every five seconds the dropwatch.stp script lists the number of + socket buffers freed at locations in the kernel. + + network/nettop.stp - Periodic Listing of Processes Using Network Interfaces keywords: network traffic per-process diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index e65ed19d..473c0091 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 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 BUFFER CALLGRAPH CPU DISK FORMAT FREE FUNCTIONS FUTEX GRAPH INTERRUPT IO LOCKING MEMORY NETWORK PER-PROCESS PROCESS PROFILING READ SCHEDULER SIGNALS SIMPLE SLEEP SOCKET SYSCALL TCP TIME TRACE TRACEPOINT TRAFFIC USE WAIT4 WRITE

      BACKTRACE

      • interrupt/scf.stp - Tally Backtraces for Inter-Processor Interrupt (IPI)
        @@ -52,6 +52,12 @@ keywords: IO IO SCHEDULER BACKTRACE

        The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.

      +

      BUFFER

      +

      CALLGRAPH

      • general/para-callgraph.stp - Callgraph tracing with arguments
        @@ -82,6 +88,12 @@ keywords: FORMAT
        keywords: FORMAT

        The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset.

      +

      FREE

      +

      FUNCTIONS

      NETWORK

        +
      • network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel
        +keywords: NETWORK TRACEPOINT BUFFER FREE
        +

        Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel.

      • network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
        keywords: NETWORK TRAFFIC PER-PROCESS

        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.

      • @@ -286,6 +301,12 @@ keywords: SYSCALL TRACE CALLGRAPH

        Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger.

      +

      TRACEPOINT

      +

      TRAFFIC

      • network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
        diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 40b5276f..1d5add5f 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -30,6 +30,15 @@ keywords: io scheduler backtrace so is the total delay. += BUFFER = + +network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel +keywords: network tracepoint buffer free + + Every five seconds the dropwatch.stp script lists the number of + socket buffers freed at locations in the kernel. + + = CALLGRAPH = general/para-callgraph.stp - Callgraph tracing with arguments @@ -88,6 +97,15 @@ keywords: format ans_set_color3() function in the ansi.stp tapset. += FREE = + +network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel +keywords: network tracepoint buffer free + + Every five seconds the dropwatch.stp script lists the number of + socket buffers freed at locations in the kernel. + + = FUNCTIONS = profiling/functioncallcount.stp - Count Times Functions Called @@ -251,6 +269,13 @@ keywords: memory = NETWORK = +network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel +keywords: network tracepoint buffer free + + Every five seconds the dropwatch.stp script lists the number of + socket buffers freed at locations in the kernel. + + network/nettop.stp - Periodic Listing of Processes Using Network Interfaces keywords: network traffic per-process @@ -594,6 +619,15 @@ keywords: trace callgraph the trigger. += TRACEPOINT = + +network/dropwatch.stp - Watch Where Socket Buffers are Freed in the Kernel +keywords: network tracepoint buffer free + + Every five seconds the dropwatch.stp script lists the number of + socket buffers freed at locations in the kernel. + + = TRAFFIC = network/nettop.stp - Periodic Listing of Processes Using Network Interfaces diff --git a/testsuite/systemtap.examples/network/dropwatch.meta b/testsuite/systemtap.examples/network/dropwatch.meta new file mode 100644 index 00000000..176ba236 --- /dev/null +++ b/testsuite/systemtap.examples/network/dropwatch.meta @@ -0,0 +1,13 @@ +title: Watch Where Socket Buffers are Freed in the Kernel +name: dropwatch.stp +version: 1.0 +author: Neil Horman +keywords: network tracepoint buffer free +subsystem: network +status: production +exit: user-controlled +output: timed +scope: system-wide +description: Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel. +test_check: stap -p4 dropwatch.stp +test_installcheck: stap dropwatch.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/network/dropwatch.stp b/testsuite/systemtap.examples/network/dropwatch.stp new file mode 100644 index 00000000..bba7ecd2 --- /dev/null +++ b/testsuite/systemtap.examples/network/dropwatch.stp @@ -0,0 +1,30 @@ +#!/usr/bin/stap + +############################################################ +# Dropwatch.stp +# Author: Neil Horman +# An example script to mimic the behavior of the dropwatch utility +# http://fedorahosted.org/dropwatch +############################################################ + +# Array to hold the list of drop points we find +global locations + +# Note when we turn the monitor on and off +probe begin { printf("Monitoring for dropped packets\n") } +probe end { printf("Stopping dropped packet monitor\n") } + +# increment a drop counter for every location we drop at +probe kernel.trace("kfree_skb") { locations[$location] <<< 1 } + +# Every 5 seconds report our drop locations +probe timer.sec(5) +{ + printf("\n") + foreach (l in locations-) { + printf("%d packets dropped at location %p\n", + @count(locations[l]), l) + } + delete locations +} + -- cgit From 7c806934696e39dc9ee488ee00d2ffde18ce1ba0 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 17 Apr 2009 15:53:38 -0400 Subject: Make dropwatch.stp executable and have correct interpreter. --- testsuite/systemtap.examples/network/dropwatch.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 testsuite/systemtap.examples/network/dropwatch.stp (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/network/dropwatch.stp b/testsuite/systemtap.examples/network/dropwatch.stp old mode 100644 new mode 100755 index bba7ecd2..79d50a4e --- a/testsuite/systemtap.examples/network/dropwatch.stp +++ b/testsuite/systemtap.examples/network/dropwatch.stp @@ -1,4 +1,4 @@ -#!/usr/bin/stap +#! /usr/bin/env stap ############################################################ # Dropwatch.stp -- cgit From 764b562f42c6ac7f02e0911cab47f87c827bf3bd Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 20 Apr 2009 12:56:51 +0200 Subject: fix a bug with %% in format strings * translate.cxx (c_unparser::visit_print_format): Always use _stp_printf if a format string contains "%%". Previously a format string with no arguments would always be printed with _stp_print. * testsuite/systemtap.printf/basic6.stp: New test for %% in format strings. * testsuite/systemtap.printf/basic6.exp: test driver * testsuite/systemtap.examples/grapher.stp: Remove workaround for "%%" literal problem. --- testsuite/systemtap.examples/general/grapher.stp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp index 04463979..4f326ec1 100644 --- a/testsuite/systemtap.examples/general/grapher.stp +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -2,11 +2,11 @@ probe begin { -printf ("%s\n", "%Title:CPU utilization"); -printf ("%s\n", "%XAxisTitle:Time"); -printf ("%s\n", "%YAxisTitle:Percent"); -printf ("%s\n", "%DataSet:cpu 100 00ff00 bar"); -printf ("%s\n", "%DataSet:kbd 100 ff0000 dot"); +printf ("%%Title:CPU utilization\n"); +printf ("%%XAxisTitle:Time"); +printf ("%%YAxisTitle:Percent"); +printf ("%%DataSet:cpu 100 00ff00 bar"); +printf ("%%DataSet:kbd 100 ff0000 dot"); } # CPU utilization -- cgit From 7e88d7860607485539602a4e9002d1f275f1e8d2 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 11:26:37 +0200 Subject: Make latencytap.stp compile on i386. Still needs a .meta file to catch any breakage in the future. * testsuite/systemtap.examples/profiling/latencytap.stp (task_backtrace): Cast task to unsigned long first. --- testsuite/systemtap.examples/profiling/latencytap.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/profiling/latencytap.stp b/testsuite/systemtap.examples/profiling/latencytap.stp index 28956129..d202ec81 100755 --- a/testsuite/systemtap.examples/profiling/latencytap.stp +++ b/testsuite/systemtap.examples/profiling/latencytap.stp @@ -23,7 +23,7 @@ function _get_sleep_time:long(rq_param:long, p_param:long) function task_backtrace:string (task:long) %{ _stp_stack_snprint_tsk(THIS->__retvalue, MAXSTRINGLEN, - (struct task_struct *)THIS->task, 0, MAXTRACE); + (struct task_struct *)(unsigned long)THIS->task, 0, MAXTRACE); %} probe kernel.function("enqueue_task_fair") { -- cgit From 3a748561b96b9f67cf37731055a665cb491b48ab Mon Sep 17 00:00:00 2001 From: Sunzen Wang Date: Wed, 22 Apr 2009 13:52:15 +0200 Subject: Correct sigmon.meta example title and name. * testsuite/systemtap.examples/process/sigmon.meta: Correct title and name. * testsuite/systemtap.examples/index.html: Regenerated. * testsuite/systemtap.examples/index.txt: Likewise. * testsuite/systemtap.examples/keyword-index.html: Likewise. * testsuite/systemtap.examples/keyword-index.txt: Likewise. --- testsuite/systemtap.examples/index.html | 2 +- testsuite/systemtap.examples/index.txt | 2 +- testsuite/systemtap.examples/keyword-index.html | 2 +- testsuite/systemtap.examples/keyword-index.txt | 2 +- testsuite/systemtap.examples/process/sigmon.meta | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index a2dc7d5c..0df681ac 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -121,7 +121,7 @@ keywords: SIGNALS
      • process/sigkill.stp - Track SIGKILL Signals
        keywords: SIGNALS

        The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.

      • -
      • process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
        +
      • process/sigmon.stp - Track a particular signal to a specific process
        keywords: SIGNALS

        The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.

      • process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
        diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index 2f85628a..fa344933 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -245,7 +245,7 @@ keywords: signals that sent the signal. -process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +process/sigmon.stp - Track a particular signal to a specific process keywords: signals The script watches for a particular signal sent to a specific diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 473c0091..7edbec21 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -234,7 +234,7 @@ keywords: SIGNALS
      • process/sigkill.stp - Track SIGKILL Signals
        keywords: SIGNALS

        The script traces any SIGKILL signals. When that SIGKILL signal is sent to a process, the script prints out the signal name, the desination executable and process ID, the executable name user ID that sent the signal.

      • -
      • process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
        +
      • process/sigmon.stp - Track a particular signal to a specific process
        keywords: SIGNALS

        The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.

      diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 1d5add5f..b53e776f 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -449,7 +449,7 @@ keywords: signals that sent the signal. -process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID +process/sigmon.stp - Track a particular signal to a specific process keywords: signals The script watches for a particular signal sent to a specific diff --git a/testsuite/systemtap.examples/process/sigmon.meta b/testsuite/systemtap.examples/process/sigmon.meta index 18834997..fe192248 100644 --- a/testsuite/systemtap.examples/process/sigmon.meta +++ b/testsuite/systemtap.examples/process/sigmon.meta @@ -1,5 +1,5 @@ -title: System-Wide Count of Syscalls by PID -name: syscalls_by_pid.stp +title: Track a particular signal to a specific process +name: sigmon.stp version: 1.0 author: IBM keywords: signals -- cgit From 3b735623b8c878f52e0945074b4be4cdcd0bc257 Mon Sep 17 00:00:00 2001 From: Key Meyer Date: Mon, 27 Apr 2009 18:36:32 -0400 Subject: traceio sample: tolerate more than a few hundred processes ... rather than exiting with MAXACTIONS exceeded --- testsuite/systemtap.examples/io/traceio.stp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index 9e2deec6..a5d79fde 100755 --- a/testsuite/systemtap.examples/io/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -10,22 +10,20 @@ global reads, writes, total_io probe vfs.read.return { - reads[execname()] += $return + reads[pid(),execname()] += $return + total_io[pid(),execname()] += $return } probe vfs.write.return { - writes[execname()] += $return + writes[pid(),execname()] += $return + total_io[pid(),execname()] += $return } probe timer.s(1) { - foreach (p in reads) - total_io[p] += reads[p] - foreach (p in writes) - total_io[p] += writes[p] - foreach(p in total_io- limit 10) - printf("%15s r: %8d KiB w: %8d KiB\n", - p, reads[p]/1024, - writes[p]/1024) + foreach([p,e] in total_io- limit 10) + printf("%8d %15s r: %8d MiB w: %8d MiB\n", + p, e, reads[p,e]/1024/1024, + writes[p,e]/1024/1024) printf("\n") # Note we don't zero out reads, writes and total_io, # so the values are cumulative since the script started. -- cgit From 676c0d81a7d650c8c4e25a7a2495d2b19b50b2b8 Mon Sep 17 00:00:00 2001 From: Key Meyer Date: Mon, 27 Apr 2009 19:12:14 -0400 Subject: traceio: add human-readable byte-count output --- testsuite/systemtap.examples/io/traceio.stp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index a5d79fde..875000cb 100755 --- a/testsuite/systemtap.examples/io/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -1,6 +1,9 @@ #! /usr/bin/env stap # traceio.stp # Copyright (C) 2007 Red Hat, Inc., Eugene Teo +# Copyright (C) 2009 Kai Meyer +# Fixed a bug that allows this to run longer +# And added the humanreadable function # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -19,11 +22,23 @@ probe vfs.write.return { total_io[pid(),execname()] += $return } +function humanreadable(bytes) { + if (bytes > 1024*1024*1024) { + return sprintf("%d GiB", bytes/1024/1024/1024) + } else if (bytes > 1024*1024) { + return sprintf("%d MiB", bytes/1024/1024) + } else if (bytes > 1024) { + return sprintf("%d KiB", bytes/1024) + } else { + return sprintf("%d B", bytes) + } +} + probe timer.s(1) { foreach([p,e] in total_io- limit 10) - printf("%8d %15s r: %8d MiB w: %8d MiB\n", - p, e, reads[p,e]/1024/1024, - writes[p,e]/1024/1024) + printf("%8d %15s r: %12s w: %12s\n", + p, e, humanreadable(reads[p,e]), + humanreadable(writes[p,e])) printf("\n") # Note we don't zero out reads, writes and total_io, # so the values are cumulative since the script started. -- cgit From ea7d087ab3866eb99c19444b237c9586e8dc9b17 Mon Sep 17 00:00:00 2001 From: Ananth N Mavinakayanahalli Date: Thu, 30 Apr 2009 17:00:38 +0530 Subject: PR10007: Avoid probing syscall entry points in the testsuite. While there, fix minor issues with the s390x syscall tapset. --- testsuite/systemtap.examples/general/para-callgraph.meta | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta index 87af07cf..84d1c93f 100644 --- a/testsuite/systemtap.examples/general/para-callgraph.meta +++ b/testsuite/systemtap.examples/general/para-callgraph.meta @@ -3,5 +3,5 @@ name: para-callgraph.stp keywords: trace callgraph subsystem: general description: Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger. -test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -c "cat /proc/sys/vm/*" +test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") +test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") -c "cat /proc/sys/vm/*" -- cgit From f622867ed110ab8686b573ec086b24e5486de10b Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 11 May 2009 17:39:43 -0400 Subject: Provide more details in testsuite.examples/README on how to submit examples. --- testsuite/systemtap.examples/README | 146 ++++++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 49 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/README b/testsuite/systemtap.examples/README index e505bdfb..89586ece 100644 --- a/testsuite/systemtap.examples/README +++ b/testsuite/systemtap.examples/README @@ -1,57 +1,105 @@ -This directory contains example scripts. +This text describes contribution procedures for adding scripts to +systemtap.examples directory. Please read before submitting SystemTap +examples. Discussions take place on the + mailing list. -Each script should be checked in as executable. +- general -The first line should be -#! /usr/bin/env stap + The script should do something that normal users of SystemTap might + like to do, such as show which processes have system calls that time + out or show which memory accesses cause page faults. Scripts that + check that some aspect of SystemTap operates correctly, but would + never be used by a regular user should go in one of the other + testsuite directories. -There should be an accompanying ".meta" file describing what the -script does and how to use it, and how the testsuite should compile -and run it. The meta files are also used to create a txt and html -index (by keyword and subsystem) of all the examples by the -examples-index-gen.pl script. +- copyright -The meta file contains the following elements. Each element (key and -value) are on one line. If a key can have a list of values, the list -elements are separated by spaces. + You must designate the appropriate copyright holder for your + contribution. The copyright holder is assumed to agree with the + general licensing terms (GPLv2+). + +- coding style -title: Descriptive title for the script (required) -name: the file name for the script, e.g. iotime.stp (required) -version: versioning if any fixes and developed can be identified (required) -author: name of author(s), "anonymous" if unknown (required) -exclusivearch: Stated if the script can only run on some arches + Abide by the general formatting of the code for SystemTap. The + code base generally follows the GNU standards in usermode code and + the Linux kernel standards in runtime code. + + - Try to keep the lines shorter than 80 characters long. + - Make use of SystemTap functions to factor out common idioms in code. + - Use tapset probe points rather than raw function names. + - No probes by file and line number are allowed in examples. + - Avoid using guru mode (-g) in the examples. + - Minimize use of globals variables: + All associative arrays must be global in SystemTap. + Variables used only for the duration of a probe should be local. + - Make the file executable and use the following line at the + beginning of the script to select the proper interpreter: + + #! /usr/bin/env stap + +- Describe the example + + Each example script has a description in a .meta file that provide + an easy-to-parse format that describes various aspect of the example + script. The .meta file has the same base name as the example script. + The .meta file is parsed to generate a web page listing all the + available examples; the webpage is available at: + http://sourceware.org/systemtap/examples/. The .meta file also + describes how to run the compiled example script for testing. This + ensures that the example is frequently run to verified it works on a + wide range fo platforms. + + The meta file contains the following elements. Each element (key and + value) are on one line. If a key can have a list of values, the list + elements are separated by spaces. + + title: Descriptive title for the script (required) + name: the file name for the script, e.g. iotime.stp (required) + version: versioning if any fixes and developed can be identified (required) + author: name of author(s), "anonymous" if unknown (required) + exclusivearch: Stated if the script can only run on some arches this concept borrowed from rpm, matches types for rpm: x86 i386 x86_64 ppc ppc64, s390 (optional) -requires: Some scripts may require software to be available. In some cases - may need version numbering, e.g. kernel >= 2.6 - Can have multiple "requires:" tags. (optional) -keywords: List of likely words to categorize the script (required) - keywords are separated by spaces. - #FIXME have list of keyword -subsystem: List what part of the kernel the instrumentation probes (required) - audit cpu blockio file filesystem locking memory numa network - process scheduler or user-space (probes are in the user-space) -application: when user-space probing becomes available (optional) - a script might probe a particular application - this tag indicates the applicaton -status: describes the state of development for the script (required) - proposed just an idea - experimental an implemented idea, but use at own risk - alpha - beta - production should be safe to use -exit: how long do the script run? (required) - fixed exits in a fixed amount of time - user-controlled exits with "cntrl-c" - event-ended exits with some arbitrary event -output: what kind of output does the script generate? (required) - trace histogram graph sorted batch timed -scope: How much of the processes on the machine does the script watch? - system-wide or pid -arg_[0-9]+: Describe what the arguments into the script are. (optional) -description: A text description what the script does. (required) -test_check: How to check that the example compiles. - (e.g. stap -p4 iotime.stp) -test_installcheck: How to check that the example runs. - (e.g. stap iotime.stp -c "sleep 1") + requires: Some scripts may require software to be available. In some cases + may need version numbering, e.g. kernel >= 2.6 + Can have multiple "requires:" tags. (optional) + keywords: List of likely words to categorize the script (required) + keywords are separated by spaces. + #FIXME have list of keyword + subsystem: List what part of the kernel the instrumentation probes (required) + audit cpu blockio file filesystem locking memory numa network + process scheduler or user-space (probes are in the user-space) + application: when user-space probing becomes available (optional) + a script might probe a particular application + this tag indicates the applicaton + status: describes the state of development for the script (required) + proposed just an idea + experimental an implemented idea, but use at own risk + alpha + beta + production should be safe to use + exit: how long do the script run? (required) + fixed exits in a fixed amount of time + user-controlled exits with "cntrl-c" + event-ended exits with some arbitrary event + output: what kind of output does the script generate? (required) + trace histogram graph sorted batch timed + scope: How much of the processes on the machine does the script watch? + system-wide or pid + arg_[0-9]+: Describe what the arguments into the script are. (optional) + description: A text description what the script does. (required) + test_check: How to check that the example compiles. + (e.g. stap -p4 iotime.stp) + test_installcheck: How to check that the example runs. + (e.g. stap iotime.stp -c "sleep 1") + + +- Review, revision, and submission of the example script + + When you have a SystemTap script that should be included as an + example, submit it to the SystemTap mailing list, + systemtap@sources.redhat.com for review. Even if the script is not + ready for submission as an example, feel free to ask questions or + discuss the work-in-progress script with other people working with + SystemTap. -- cgit