summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.examples')
-rw-r--r--testsuite/systemtap.examples/index.html3
-rw-r--r--testsuite/systemtap.examples/index.txt11
-rw-r--r--testsuite/systemtap.examples/io/iostats.meta13
-rw-r--r--testsuite/systemtap.examples/io/iostats.stp44
-rw-r--r--testsuite/systemtap.examples/keyword-index.html6
-rw-r--r--testsuite/systemtap.examples/keyword-index.txt22
6 files changed, 99 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html
index e02ab867..17c520ef 100644
--- a/testsuite/systemtap.examples/index.html
+++ b/testsuite/systemtap.examples/index.html
@@ -58,6 +58,9 @@ keywords: <a href="keyword-index.html#DISK">DISK</a> <br>
<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br>
keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
<p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li>
+<li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br>
+keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li>
<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br>
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <br>
<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li>
diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt
index 0076afaa..7ae951db 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 00000000..a74c9fe4
--- /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 00000000..90bb4f5b
--- /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 3156cc08..822131d5 100644
--- a/testsuite/systemtap.examples/keyword-index.html
+++ b/testsuite/systemtap.examples/keyword-index.html
@@ -102,6 +102,9 @@ keywords: <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <a href="keyword-
<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br>
keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#BACKTRACE">BACKTRACE</a> <br>
<p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li>
+<li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br>
+keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li>
<li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br>
keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#READ">READ</a> <a href="keyword-index.html#WRITE">WRITE</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#IO">IO</a> <br>
<p>The script watches each open, close, read, and write syscalls on the system. For each file the scripts observes opened it accumulates the amount of wall clock time spend in read and write operations and the number of bytes read and written. When a file is closed the script prints out a pair of lines for the file. Both lines begin with a timestamp in microseconds, the PID number, and the executable name in parenthesese. The first line with the "access" keyword lists the file name, the attempted number of bytes for the read and write operations. The second line with the "iotime" keyword list the file name and the number of microseconds accumulated in the read and write syscalls.</p></li>
@@ -144,6 +147,9 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
</ul>
<h3><a name="PROFILING">PROFILING</a></h3>
<ul>
+<li><a href="io/iostats.stp">io/iostats.stp</a> - List Executables Reading and Writing the Most Data<br>
+keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
+<p> The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written.</p></li>
<li><a href="process/pf2.stp">process/pf2.stp</a> - Profile kernel functions<br>
keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
<p>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.</p></li>
diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt
index a940ccfa..acc010c1 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