| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
| 3 |
]> |
| 4 |
|
| 5 |
|
| 6 |
<section id="timeoutssect"> |
| 7 |
<title>Monitoring Polling Applications</title> |
| 8 |
<indexterm> |
| 9 |
<primary>script examples</primary> |
| 10 |
<secondary>monitoring polling applications</secondary> |
| 11 |
</indexterm> |
| 12 |
|
| 13 |
<indexterm> |
| 14 |
<primary>examples of SystemTap scripts</primary> |
| 15 |
<secondary>monitoring polling applications</secondary> |
| 16 |
</indexterm> |
| 17 |
|
| 18 |
<indexterm> |
| 19 |
<primary>monitoring polling applications</primary> |
| 20 |
<secondary>examples of SystemTap scripts</secondary> |
| 21 |
</indexterm> |
| 22 |
|
| 23 |
<!-- |
| 24 |
<indexterm> |
| 25 |
<primary>counting function calls</primary> |
| 26 |
<secondary>examples of SystemTap scripts</secondary> |
| 27 |
</indexterm> |
| 28 |
--> |
| 29 |
|
| 30 |
<indexterm> |
| 31 |
<primary>polling applications, monitoring</primary> |
| 32 |
<secondary>examples of SystemTap scripts</secondary> |
| 33 |
</indexterm> |
| 34 |
|
| 35 |
<remark> |
| 36 |
uses systemtap/testsuite/systemtap.examples/profiling/timeout.stp |
| 37 |
</remark> |
| 38 |
|
| 39 |
|
| 40 |
<para> |
| 41 |
This section describes how to identify and monitor which applications are polling. Doing so allows you to track |
| 42 |
unnecessary or excessive polling, which can help you pinpoint areas for improvement in terms of CPU usage |
| 43 |
and power savings. |
| 44 |
</para> |
| 45 |
|
| 46 |
<formalpara id="timeouts"> |
| 47 |
<title>timeout.stp</title> |
| 48 |
<para> |
| 49 |
<programlisting><xi:include parse="text" href="../testsuite/systemtap.examples/profiling/timeout.stp" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting> |
| 50 |
</para> |
| 51 |
</formalpara> |
| 52 |
|
| 53 |
<para> |
| 54 |
<xref linkend="timeouts"/> tracks how many times each |
| 55 |
of the following system calls completed |
| 56 |
due to time expiring rather than due to an actual event |
| 57 |
occurring: |
| 58 |
</para> |
| 59 |
|
| 60 |
<itemizedlist> |
| 61 |
<listitem><para><command>poll</command></para></listitem> |
| 62 |
<listitem><para><command>select</command></para></listitem> |
| 63 |
<listitem><para><command>epoll</command></para></listitem> |
| 64 |
<listitem><para><command>itimer</command></para></listitem> |
| 65 |
<listitem><para><command>futex</command></para></listitem> |
| 66 |
<listitem><para><command>nanosleep</command></para></listitem> |
| 67 |
<listitem><para><command>signal</command></para></listitem> |
| 68 |
</itemizedlist> |
| 69 |
|
| 70 |
|
| 71 |
<indexterm> |
| 72 |
<primary>script examples</primary> |
| 73 |
<secondary>timer.s(), sample usage</secondary> |
| 74 |
</indexterm> |
| 75 |
|
| 76 |
<indexterm> |
| 77 |
<primary>examples of SystemTap scripts</primary> |
| 78 |
<secondary>timer.s(), sample usage</secondary> |
| 79 |
</indexterm> |
| 80 |
|
| 81 |
<indexterm> |
| 82 |
<primary>timer.s(), sample usage</primary> |
| 83 |
<secondary>examples of SystemTap scripts</secondary> |
| 84 |
</indexterm> |
| 85 |
|
| 86 |
<example id="timeoutsoutput"> |
| 87 |
<title><xref linkend="timeouts"/> Sample Output</title> |
| 88 |
<screen> uid | poll select epoll itimer futex nanosle signal| process |
| 89 |
28937 | 148793 0 0 4727 37288 0 0| firefox |
| 90 |
22945 | 0 56949 0 1 0 0 0| scim-bridge |
| 91 |
0 | 0 0 0 36414 0 0 0| swapper |
| 92 |
4275 | 23140 0 0 1 0 0 0| mixer_applet2 |
| 93 |
4191 | 0 14405 0 0 0 0 0| scim-launcher |
| 94 |
22941 | 7908 1 0 62 0 0 0| gnome-terminal |
| 95 |
4261 | 0 0 0 2 0 7622 0| escd |
| 96 |
3695 | 0 0 0 0 0 7622 0| gdm-binary |
| 97 |
3483 | 0 7206 0 0 0 0 0| dhcdbd |
| 98 |
4189 | 6916 0 0 2 0 0 0| scim-panel-gtk |
| 99 |
1863 | 5767 0 0 0 0 0 0| iscsid |
| 100 |
2562 | 0 2881 0 1 0 1438 0| pcscd |
| 101 |
4257 | 4255 0 0 1 0 0 0| gnome-power-man |
| 102 |
4278 | 3876 0 0 60 0 0 0| multiload-apple |
| 103 |
4083 | 0 1331 0 1728 0 0 0| Xorg |
| 104 |
3921 | 1603 0 0 0 0 0 0| gam_server |
| 105 |
4248 | 1591 0 0 0 0 0 0| nm-applet |
| 106 |
3165 | 0 1441 0 0 0 0 0| xterm |
| 107 |
29548 | 0 1440 0 0 0 0 0| httpd |
| 108 |
1862 | 0 0 0 0 0 1438 0| iscsid</screen> |
| 109 |
</example> |
| 110 |
<para> |
| 111 |
You can increase the sample time by editing the second probe (<command>timer.s(1)</command>). |
| 112 |
The output of <xref linkend="timeouts"/> contains the name and UID of the top 20 polling applications, |
| 113 |
along with how many times each application performed each polling system call (over time). |
| 114 |
<xref linkend="timeoutsoutput"/> contains an excerpt of the script. |
| 115 |
In this particular example firefox is doing an excessive amount of |
| 116 |
polling due to a plugin module. |
| 117 |
</para> |
| 118 |
</section> |
| 119 |
|