diff options
-rw-r--r-- | doc/SystemTap_Beginners_Guide/Makefile | 2 | ||||
-rw-r--r-- | testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.txt | 12 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.txt | 12 | ||||
-rw-r--r-- | testsuite/systemtap.examples/profiling/timeout.meta | 13 | ||||
-rw-r--r-- | testsuite/systemtap.examples/profiling/timeout.stp | 102 |
8 files changed, 155 insertions, 1 deletions
diff --git a/doc/SystemTap_Beginners_Guide/Makefile b/doc/SystemTap_Beginners_Guide/Makefile index 3dbded40..32dc0d50 100644 --- a/doc/SystemTap_Beginners_Guide/Makefile +++ b/doc/SystemTap_Beginners_Guide/Makefile @@ -19,4 +19,4 @@ pre:: post:: rm -rf en-US/extras/testsuite sed -i -e 's/<productname>Fedora/<productname>Red Hat Enterprise Linux/g' en-US/Book_Info.xml; - sed -i -e 's/<productnumber>10/<productnumber>5/g' en-US/Book_Info.xml;
\ No newline at end of file + sed -i -e 's/<productnumber>10/<productnumber>5/g' en-US/Book_Info.xml; diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 322ddfbe..680a5ce7 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2009-01-28 Will Cohen <wcohen@redhat.com> + + * systemtap.examples/profiling/timeout.meta: + * systemtap.examples/profiling/timeout.stp: New. + * systemtap.examples/index.html: + * systemtap.examples/index.txt: + * systemtap.examples/keyword-index.html: + * systemtap.examples/keyword-index.txt: Regenerate. + 2009-01-22 Stan Cox <scox@redhat.com> * systemtap.base/static_uprobes.exp: Test dtrace. diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 52bc294b..b67aa226 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -112,6 +112,9 @@ keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword- <li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br> keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br> <p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li> +<li><a href="profiling/timeout.stp">profiling/timeout.stp</a> - Show Processes Doing Polling Operations<br> +keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br> +<p>The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes.</p></li> </ul> </td> </tr> diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index fce068b8..f45f4c43 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -211,3 +211,15 @@ keywords: profiling user-space and kernel-space. +profiling/timeout.stp - Show Processes Doing Polling Operations +keywords: profiling + + The timeout.stp script is based on a blog entry + (http://udrepper.livejournal.com/19041.html) mentioning a need for a + tool to help developers find applications that are polling. The + timeout.stp script monitors systemcall used for polling and records + the systemcalls that timed out rather than returned because some + action occurred. The script updates the screen once a second with the + top twenty processes. + + diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index 61112579..34dedc9a 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -141,6 +141,9 @@ keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword- <li><a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile kernel functions<br> keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br> <p>The thread-times.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top twenty processes with samples broken down into percentage total time spent in user-space and kernel-space.</p></li> +<li><a href="profiling/timeout.stp">profiling/timeout.stp</a> - Show Processes Doing Polling Operations<br> +keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <br> +<p>The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes.</p></li> </ul> <h3><a name="READ">READ</a></h3> <ul> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 8cafd43f..bf35f139 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -222,6 +222,18 @@ keywords: profiling user-space and kernel-space. +profiling/timeout.stp - Show Processes Doing Polling Operations +keywords: profiling + + The timeout.stp script is based on a blog entry + (http://udrepper.livejournal.com/19041.html) mentioning a need for a + tool to help developers find applications that are polling. The + timeout.stp script monitors systemcall used for polling and records + the systemcalls that timed out rather than returned because some + action occurred. The script updates the screen once a second with the + top twenty processes. + + = READ = io/iotime.stp - Trace Time Spent in Read and Write for Files diff --git a/testsuite/systemtap.examples/profiling/timeout.meta b/testsuite/systemtap.examples/profiling/timeout.meta new file mode 100644 index 00000000..aa683c0a --- /dev/null +++ b/testsuite/systemtap.examples/profiling/timeout.meta @@ -0,0 +1,13 @@ +title: Show Processes Doing Polling Operations +name: timeout.stp +version: 1.0 +author: Uli Drepper and William Cohen +keywords: profiling +subsystem: kernel +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: The timeout.stp script is based on a blog entry (http://udrepper.livejournal.com/19041.html) mentioning a need for a tool to help developers find applications that are polling. The timeout.stp script monitors systemcall used for polling and records the systemcalls that timed out rather than returned because some action occurred. The script updates the screen once a second with the top twenty processes. +test_check: stap -p4 timeout.stp +test_installcheck: stap timeout.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/profiling/timeout.stp b/testsuite/systemtap.examples/profiling/timeout.stp new file mode 100644 index 00000000..48d6d21d --- /dev/null +++ b/testsuite/systemtap.examples/profiling/timeout.stp @@ -0,0 +1,102 @@ +#! /usr/bin/env stap +# Copyright (C) 2009 Red Hat, Inc. +# Written by Ulrich Drepper <drepper@redhat.com> +# Modified by William Cohen <wcohen@redhat.com> + +global process, timeout_count, to +global poll_timeout, epoll_timeout, select_timeout, itimer_timeout +global nanosleep_timeout, futex_timeout, signal_timeout + +probe syscall.poll, syscall.epoll_wait { + if (timeout) to[pid()]=timeout +} + +probe syscall.poll.return { + p = pid() + if ($return == 0 && to[p] > 0 ) { + poll_timeout[p]++ + timeout_count[p]++ + process[p] = execname() + delete to[p] + } +} + +probe syscall.epoll_wait.return { + p = pid() + if ($return == 0 && to[p] > 0 ) { + epoll_timeout[p]++ + timeout_count[p]++ + process[p] = execname() + delete to[p] + } +} + +probe syscall.select.return { + if ($return == 0) { + p = pid() + select_timeout[p]++ + timeout_count[p]++ + process[p] = execname() + } +} + +probe syscall.futex.return { + if (errno_str($return) == "ETIMEDOUT") { + p = pid() + futex_timeout[p]++ + timeout_count[p]++ + process[p] = execname() + } +} + +probe syscall.nanosleep.return { + if ($return == 0) { + p = pid() + nanosleep_timeout[p]++ + timeout_count[p]++ + process[p] = execname() + } +} + +probe kernel.function("it_real_fn") { + p = pid() + itimer_timeout[p]++ + timeout_count[p]++ + process[p] = execname() +} + +probe syscall.rt_sigtimedwait.return { + if (errno_str($return) == "EAGAIN") { + p = pid() + signal_timeout[p]++ + timeout_count[p]++ + process[p] = execname() + } +} + +probe syscall.exit { + p = pid() + if (p in process) { + delete process[p] + delete timeout_count[p] + delete poll_timeout[p] + delete epoll_timeout[p] + delete select_timeout[p] + delete itimer_timeout[p] + delete futex_timeout[p] + delete nanosleep_timeout[p] + delete signal_timeout[p] + } +} + +probe timer.s(1) { + printf("\033[2J\033[1;1H") /* 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, + poll_timeout[p], select_timeout[p], + epoll_timeout[p], itimer_timeout[p], + futex_timeout[p], nanosleep_timeout[p], + signal_timeout[p], process[p]) + } +} |