From 3e4444ed0b5367ee58c89685c2ee072abc185737 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 6 Feb 2009 17:44:23 -0500 Subject: [PATCH] Fold the systemtap.samples/iotask*.stp into systemtap.examples/io/iostats.stp. Regenerate the catalog information. --- testsuite/ChangeLog | 11 +++++ testsuite/systemtap.examples/index.html | 3 ++ testsuite/systemtap.examples/index.txt | 11 +++++ testsuite/systemtap.examples/io/iostats.meta | 13 ++++++ testsuite/systemtap.examples/io/iostats.stp | 44 +++++++++++++++++++ .../systemtap.examples/keyword-index.html | 6 +++ .../systemtap.examples/keyword-index.txt | 22 ++++++++++ testsuite/systemtap.samples/iotask.stp | 44 ------------------- testsuite/systemtap.samples/iotask2.stp | 42 ------------------ 9 files changed, 110 insertions(+), 86 deletions(-) create mode 100644 testsuite/systemtap.examples/io/iostats.meta create mode 100644 testsuite/systemtap.examples/io/iostats.stp delete mode 100644 testsuite/systemtap.samples/iotask.stp delete mode 100644 testsuite/systemtap.samples/iotask2.stp diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 7a005ffb2..a9fc0b1e9 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2009-02-06 Will Cohen + + * systemtap.samples/iotask.stp: + * systemtap.samples/iotask2.stp: Remove. + * systemtap.examples/io/iostats.stp: + * systemtap.examples/io/iostats.meta: New + * systemtap.examples/index.html: + * systemtap.examples/index.txt: + * systemtap.examples/keyword-index.html: + * systemtap.examples/keyword-index.txt: Regenerate. + 2009-02-06 Will Cohen * systemtap.samples/syscalls.stp: diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index e02ab8676..17c520ef9 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/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.

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

  • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index 0076afaae..7ae951db2 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -52,6 +52,17 @@ keywords: io backtrace list from most common to least common backtrace. +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. + + io/iotime.stp - Trace Time Spent in Read and Write for Files keywords: syscall read write time io diff --git a/testsuite/systemtap.examples/io/iostats.meta b/testsuite/systemtap.examples/io/iostats.meta new file mode 100644 index 000000000..a74c9fe4b --- /dev/null +++ b/testsuite/systemtap.examples/io/iostats.meta @@ -0,0 +1,13 @@ +title: List Executables Reading and Writing the Most Data +name: iostats.stp +version: 1.0 +author: anonymous +keywords: io profiling +subsystem: io +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: 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. +test_check: stap -p4 iostats.stp +test_installcheck: stap iostats.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/io/iostats.stp b/testsuite/systemtap.examples/io/iostats.stp new file mode 100644 index 000000000..90bb4f5be --- /dev/null +++ b/testsuite/systemtap.examples/io/iostats.stp @@ -0,0 +1,44 @@ +#! /usr/bin/env stap +global opens, reads, writes, totals + +probe begin { printf("starting probe\n") } + +probe syscall.open { + e=execname(); + opens[e] <<< 1 # statistics array +} + +probe syscall.read.return { + count = $return + if ( count >= 0 ) { + e=execname(); + reads[e] <<< count # statistics array + totals[e] += count + } +} + +probe syscall.write.return { + count = $return + if (count >= 0 ) { + e=execname(); + writes[e] <<< count # statistics array + totals[e] += count + } +} + +probe end { + printf("\n%16s %8s %8s %8s %8s %8s %8s %8s\n", + "", "", "", "read", "read", "", "write", "write") + printf("%16s %8s %8s %8s %8s %8s %8s %8s\n", + "name", "open", "read", "KB tot", "B avg", "write", "KB tot", "B avg") + foreach (name in totals- limit 20) { # sort by total io + printf("%16s %8d %8d %8d %8d %8d %8d %8d\n", + name, @count(opens[name]), + @count(reads[name]), + (@count(reads[name]) ? @sum(reads[name])>>10 : 0 ), + (@count(reads[name]) ? @avg(reads[name]) : 0 ), + @count(writes[name]), + (@count(writes[name]) ? @sum(writes[name])>>10 : 0 ), + (@count(writes[name]) ? @avg(writes[name]) : 0 )) + } +} diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 3156cc087..822131d55 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/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.

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

  • @@ -144,6 +147,9 @@ keywords: NETWORK PROFILING
      +
    • 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.

    • process/pf2.stp - Profile kernel functions
      keywords: PROFILING

      The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.

    • diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index a940ccfab..acc010c1a 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -125,6 +125,17 @@ keywords: io backtrace list from most common to least common backtrace. +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. + + io/iotime.stp - Trace Time Spent in Read and Write for Files keywords: syscall read write time io @@ -227,6 +238,17 @@ keywords: network traffic per-process = PROFILING = +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. + + process/pf2.stp - Profile kernel functions keywords: profiling diff --git a/testsuite/systemtap.samples/iotask.stp b/testsuite/systemtap.samples/iotask.stp deleted file mode 100644 index 1b4c72431..000000000 --- a/testsuite/systemtap.samples/iotask.stp +++ /dev/null @@ -1,44 +0,0 @@ -#! /usr/bin/env stap -# iotask.stp -# A reimplementation of user script: iotask.stp given at OLS 2005 -# in the current language. -# -# Will Cohen -# 9/22/2005 - -global names, opens -global reads, read_bytes -global writes, write_bytes - -probe kernel.function("sys_open") { - ++names[execname()]; ++opens[execname()]; -} - -probe kernel.function("sys_read") { - ++names[execname()]; ++reads[execname()]; - read_bytes[execname()] += $count; -} - -probe kernel.function("sys_write") { - ++names[execname()]; ++writes[execname()]; - write_bytes[execname()] += $count; -} - -probe begin { println( "starting probe" ); } - -probe end { - foreach( name in names){ - printf ("process: %s\n", name); - if (opens[name]) - printf ("opens=%d\n",opens[name]) - if (reads[name]){ - count = reads[name]; total=read_bytes[name]; - printf("reads=%d, sum=%d, avg=%d\n", count, total, total/count); - } - if (writes[name]){ - count = writes[name]; total=write_bytes[name]; - printf("writes=%d, sum=%d, avg=%d\n", count, total, total/count); - } - println(""); - } -} diff --git a/testsuite/systemtap.samples/iotask2.stp b/testsuite/systemtap.samples/iotask2.stp deleted file mode 100644 index cc4707b75..000000000 --- a/testsuite/systemtap.samples/iotask2.stp +++ /dev/null @@ -1,42 +0,0 @@ -global names, opens, reads, writes - -probe begin { println("starting probe") } - -probe timer.ms(10000) { - println("stopping probe after 10 seconds") - exit() -} - -probe kernel.function("sys_open") { - e=execname(); names[e]=1 - opens[e] ++ # simple integer array -} - -probe kernel.function("sys_read") { - e=execname(); names[e]=1 - reads[e] <<< $count # statistics array -} - -probe kernel.function("sys_write") { - e=execname(); names[e]=1 - writes[e] <<< $count # statistics array -} - - -probe end { - foreach (name+ in names) { # sort by name - printf("process: %s\n", name) - if (opens[name]) - printf("opens n=%d\n", opens[name]) - if (@count(reads[name])) - printf("reads n=%d, sum=%d, avg=%d\n", - @count(reads[name]), # extracting stat results - @sum(reads[name]), - @avg(reads[name])) - if (@count(writes[name])) - printf("writes n=%d, sum=%d, avg=%d\n", - @count(writes[name]), # extracting stat results - @sum(writes[name]), - @avg(writes[name])) - } -} -- 2.43.5