diff options
Diffstat (limited to 'SystemTap_Beginners_Guide/timeoutssect.html')
| -rw-r--r-- | SystemTap_Beginners_Guide/timeoutssect.html | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/SystemTap_Beginners_Guide/timeoutssect.html b/SystemTap_Beginners_Guide/timeoutssect.html index a2ac094c..78b56ece 100644 --- a/SystemTap_Beginners_Guide/timeoutssect.html +++ b/SystemTap_Beginners_Guide/timeoutssect.html | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">5.3.4. Monitoring Polling Applications</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="not publican" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="mainsect-profiling.html" title="5.3. Profiling" /><link rel="prev" href="threadtimessect.html" title="5.3.3. Determining Time Spent in Kernel and User Space" /><link rel="next" href="topsyssect.html" title="5.3.5. Tracking Most Frequently Used System Calls" /></head><body><p id="title"></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="threadtimessect.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="topsyssect.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="timeoutssect"> | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">5.3.4. Monitoring Polling Applications</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="not publican" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="mainsect-profiling.html" title="5.3. Profiling" /><link rel="prev" href="threadtimessect.html" title="5.3.3. Determining Time Spent in Kernel and User Space" /><link rel="next" href="topsyssect.html" title="5.3.5. Tracking Most Frequently Used System Calls" /></head><body><p id="title"></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="threadtimessect.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="topsyssect.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="timeoutssect"> |
| 3 | </a>5.3.4. Monitoring Polling Applications</h3></div></div></div><a id="idm46926933762144" class="indexterm"></a><a id="idm46926929106320" class="indexterm"></a><a id="idm46926928800208" class="indexterm"></a><a id="idm46926932891968" class="indexterm"></a><div class="para"> | 3 | </a>5.3.4. Monitoring Polling Applications</h3></div></div></div><a id="idm140217032561392" class="indexterm"></a><a id="idm140217034260992" class="indexterm"></a><a id="idm140217036558832" class="indexterm"></a><a id="idm140217043144704" class="indexterm"></a><div class="para"> |
| 4 | This section describes how to identify and monitor which applications are polling. Doing so allows you to track | 4 | This section describes how to identify and monitor which applications are polling. Doing so allows you to track |
| 5 | unnecessary or excessive polling, which can help you pinpoint areas for improvement in terms of CPU usage | 5 | unnecessary or excessive polling, which can help you pinpoint areas for improvement in terms of CPU usage |
| 6 | and power savings. | 6 | and power savings. |
| @@ -19,80 +19,72 @@ probe syscall.poll, syscall.epoll_wait { | |||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | probe syscall.poll.return { | 21 | probe syscall.poll.return { |
| 22 | p = pid() | 22 | if ($return == 0 && to[pid()] > 0 ) { |
| 23 | if ($return == 0 && to[p] > 0 ) { | 23 | poll_timeout[pid()]++ |
| 24 | poll_timeout[p]++ | 24 | timeout_count[pid()]++ |
| 25 | timeout_count[p]++ | 25 | process[pid()] = execname() |
| 26 | process[p] = execname() | 26 | delete to[pid()] |
| 27 | delete to[p] | ||
| 28 | } | 27 | } |
| 29 | } | 28 | } |
| 30 | 29 | ||
| 31 | probe syscall.epoll_wait.return { | 30 | probe syscall.epoll_wait.return { |
| 32 | p = pid() | 31 | if ($return == 0 && to[pid()] > 0 ) { |
| 33 | if ($return == 0 && to[p] > 0 ) { | 32 | epoll_timeout[pid()]++ |
| 34 | epoll_timeout[p]++ | 33 | timeout_count[pid()]++ |
| 35 | timeout_count[p]++ | ||
| 36 | process[p] = execname() | 34 | process[p] = execname() |
| 37 | delete to[p] | 35 | delete to[pid()] |
| 38 | } | 36 | } |
| 39 | } | 37 | } |
| 40 | 38 | ||
| 41 | probe syscall.select.return { | 39 | probe syscall.select.return { |
| 42 | if ($return == 0) { | 40 | if ($return == 0) { |
| 43 | p = pid() | 41 | select_timeout[pid()]++ |
| 44 | select_timeout[p]++ | 42 | timeout_count[pid()]++ |
| 45 | timeout_count[p]++ | 43 | process[pid()] = execname() |
| 46 | process[p] = execname() | ||
| 47 | } | 44 | } |
| 48 | } | 45 | } |
| 49 | 46 | ||
| 50 | probe syscall.futex.return { | 47 | probe syscall.futex.return { |
| 51 | if (errno_str($return) == "ETIMEDOUT") { | 48 | if (errno_str($return) == "ETIMEDOUT") { |
| 52 | p = pid() | 49 | futex_timeout[pid()]++ |
| 53 | futex_timeout[p]++ | 50 | timeout_count[pid()]++ |
| 54 | timeout_count[p]++ | 51 | process[pid()] = execname() |
| 55 | process[p] = execname() | ||
| 56 | } | 52 | } |
| 57 | } | 53 | } |
| 58 | 54 | ||
| 59 | probe syscall.nanosleep.return { | 55 | probe syscall.nanosleep.return { |
| 60 | if ($return == 0) { | 56 | if ($return == 0) { |
| 61 | p = pid() | 57 | nanosleep_timeout[pid()]++ |
| 62 | nanosleep_timeout[p]++ | 58 | timeout_count[pid()]++ |
| 63 | timeout_count[p]++ | 59 | process[pid()] = execname() |
| 64 | process[p] = execname() | ||
| 65 | } | 60 | } |
| 66 | } | 61 | } |
| 67 | 62 | ||
| 68 | probe kernel.function("it_real_fn") { | 63 | probe kernel.function("it_real_fn") { |
| 69 | p = pid() | 64 | itimer_timeout[pid()]++ |
| 70 | itimer_timeout[p]++ | 65 | timeout_count[pid()]++ |
| 71 | timeout_count[p]++ | 66 | process[pid()] = execname() |
| 72 | process[p] = execname() | ||
| 73 | } | 67 | } |
| 74 | 68 | ||
| 75 | probe syscall.rt_sigtimedwait.return { | 69 | probe syscall.rt_sigtimedwait.return { |
| 76 | if (errno_str($return) == "EAGAIN") { | 70 | if (errno_str($return) == "EAGAIN") { |
| 77 | p = pid() | 71 | signal_timeout[pid()]++ |
| 78 | signal_timeout[p]++ | 72 | timeout_count[pid()]++ |
| 79 | timeout_count[p]++ | 73 | process[pid()] = execname() |
| 80 | process[p] = execname() | ||
| 81 | } | 74 | } |
| 82 | } | 75 | } |
| 83 | 76 | ||
| 84 | probe syscall.exit { | 77 | probe syscall.exit { |
| 85 | p = pid() | 78 | if (pid() in process) { |
| 86 | if (p in process) { | 79 | delete process[pid()] |
| 87 | delete process[p] | 80 | delete timeout_count[pid()] |
| 88 | delete timeout_count[p] | 81 | delete poll_timeout[pid()] |
| 89 | delete poll_timeout[p] | 82 | delete epoll_timeout[pid()] |
| 90 | delete epoll_timeout[p] | 83 | delete select_timeout[pid()] |
| 91 | delete select_timeout[p] | 84 | delete itimer_timeout[pid()] |
| 92 | delete itimer_timeout[p] | 85 | delete futex_timeout[pid()] |
| 93 | delete futex_timeout[p] | 86 | delete nanosleep_timeout[pid()] |
| 94 | delete nanosleep_timeout[p] | 87 | delete signal_timeout[pid()] |
| 95 | delete signal_timeout[p] | ||
| 96 | } | 88 | } |
| 97 | } | 89 | } |
| 98 | 90 | ||
| @@ -113,7 +105,7 @@ probe timer.s(1) { | |||
| 113 | of the following system calls completed | 105 | of the following system calls completed |
| 114 | due to time expiring rather than due to an actual event | 106 | due to time expiring rather than due to an actual event |
| 115 | occurring: | 107 | occurring: |
| 116 | </div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para"><code class="command">poll</code></div></li><li class="listitem"><div class="para"><code class="command">select</code></div></li><li class="listitem"><div class="para"><code class="command">epoll</code></div></li><li class="listitem"><div class="para"><code class="command">itimer</code></div></li><li class="listitem"><div class="para"><code class="command">futex</code></div></li><li class="listitem"><div class="para"><code class="command">nanosleep</code></div></li><li class="listitem"><div class="para"><code class="command">signal</code></div></li></ul></div><a id="idm46926930658304" class="indexterm"></a><a id="idm46926930469184" class="indexterm"></a><a id="idm46926930780416" class="indexterm"></a><div class="example"><a id="timeoutsoutput"> | 108 | </div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para"><code class="command">poll</code></div></li><li class="listitem"><div class="para"><code class="command">select</code></div></li><li class="listitem"><div class="para"><code class="command">epoll</code></div></li><li class="listitem"><div class="para"><code class="command">itimer</code></div></li><li class="listitem"><div class="para"><code class="command">futex</code></div></li><li class="listitem"><div class="para"><code class="command">nanosleep</code></div></li><li class="listitem"><div class="para"><code class="command">signal</code></div></li></ul></div><a id="idm140217034287952" class="indexterm"></a><a id="idm140217042699536" class="indexterm"></a><a id="idm140217035250592" class="indexterm"></a><div class="example"><a id="timeoutsoutput"> |
| 117 | </a><p class="title"><strong>Example 5.16. <a class="xref" href="timeoutssect.html#timeouts">timeout.stp</a> Sample Output</strong></p><div class="example-contents"><pre class="screen"> uid | poll select epoll itimer futex nanosle signal| process | 109 | </a><p class="title"><strong>Example 5.16. <a class="xref" href="timeoutssect.html#timeouts">timeout.stp</a> Sample Output</strong></p><div class="example-contents"><pre class="screen"> uid | poll select epoll itimer futex nanosle signal| process |
| 118 | 28937 | 148793 0 0 4727 37288 0 0| firefox | 110 | 28937 | 148793 0 0 4727 37288 0 0| firefox |
| 119 | 22945 | 0 56949 0 1 0 0 0| scim-bridge | 111 | 22945 | 0 56949 0 1 0 0 0| scim-bridge |
