diff options
Diffstat (limited to 'SystemTap_Beginners_Guide/futexcontentionsect.html')
| -rw-r--r-- | SystemTap_Beginners_Guide/futexcontentionsect.html | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/SystemTap_Beginners_Guide/futexcontentionsect.html b/SystemTap_Beginners_Guide/futexcontentionsect.html index b7af5eea..3a0f43dd 100644 --- a/SystemTap_Beginners_Guide/futexcontentionsect.html +++ b/SystemTap_Beginners_Guide/futexcontentionsect.html | |||
| @@ -1,13 +1,15 @@ | |||
| 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.4. Identifying Contended User-Space Locks</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="publican v4.1.3" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="SystemTap-SystemTap_Beginners_Guide-2.7-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="useful-systemtap-scripts.html" title="Chapter 5. Useful SystemTap Scripts" /><link rel="prev" href="syscallsbyprocpidsect.html" title="5.3.6. Tracking System Call Volume Per Process" /><link rel="next" href="errors.html" title="Chapter 6. Understanding SystemTap Errors" /></head><body><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img alt="Product Site" src="Common_Content/images//image_left.png" /></a><a class="right" href="https://fedorahosted.org/publican"><img alt="Documentation Site" src="Common_Content/images//image_right.png" /></a></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="syscallsbyprocpidsect.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="errors.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="futexcontentionsect"> | 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.4. Identifying Contended User-Space Locks</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="useful-systemtap-scripts.html" title="Chapter 5. Useful SystemTap Scripts" /><link rel="prev" href="syscallsbyprocpidsect.html" title="5.3.6. Tracking System Call Volume Per Process" /><link rel="next" href="errors.html" title="Chapter 6. Understanding SystemTap Errors" /></head><body><p id="title"></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="syscallsbyprocpidsect.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="errors.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="futexcontentionsect"> |
| 3 | </a>5.4. Identifying Contended User-Space Locks</h2></div></div></div><a id="idm47748224431248" class="indexterm"></a><a id="idm47748219947904" class="indexterm"></a><a id="idm47748219946528" class="indexterm"></a><a id="idm47748220346032" class="indexterm"></a><div class="para"> | 3 | </a>5.4. Identifying Contended User-Space Locks</h2></div></div></div><a id="idm140174734604448" class="indexterm"></a><a id="idm140174733328096" class="indexterm"></a><a id="idm140174742940144" class="indexterm"></a><a id="idm140174740013840" class="indexterm"></a><div class="para">This section describes how to identify contended |
| 4 | This section describes how to identify contended user-space locks throughout the system within a specific time period. The ability to identify contended user-space locks can help you investigate poor program performance that you suspect may be caused by <code class="command">futex</code> contentions. | 4 | user-space locks throughout the system within a specific time |
| 5 | </div><a id="idm47748231006800" class="indexterm"></a><a id="idm47748218192640" class="indexterm"></a><a id="idm47748226934416" class="indexterm"></a><a id="idm47748182282176" class="indexterm"></a><a id="idm47748186362800" class="indexterm"></a><div class="para"> | 5 | period. The ability to identify contended user-space locks can help |
| 6 | Simply put, <code class="command">futex</code> contention occurs when multiple processes are trying to access the same lock variable at the same time. This can result in a poor performance because the lock serializes execution; one process obtains the lock while the other processes must wait for the lock variable to become available again. | 6 | you investigate poor program performance that you suspect may be |
| 7 | </div><a id="idm47748222332240" class="indexterm"></a><a id="idm47748224632912" class="indexterm"></a><a id="idm47748183237648" class="indexterm"></a><div class="para"> | 7 | caused by <code class="command">futex</code> contentions.</div><a id="idm140174731491552" class="indexterm"></a><a id="idm140174730498240" class="indexterm"></a><a id="idm140174733109712" class="indexterm"></a><a id="idm140174736452288" class="indexterm"></a><a id="idm140174739126240" class="indexterm"></a><div class="para">Simply put, <code class="command">futex</code> contention occurs |
| 8 | The <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> script probes the <code class="command">futex</code> system call to show lock contention. | 8 | when multiple processes are trying to access the same lock |
| 9 | </div><div class="para"><div xmlns:d="http://docbook.org/ns/docbook" class="title">futexes.stp</div> | 9 | variable at the same time. This can result in a poor |
| 10 | 10 | performance because the lock serializes execution; one process obtains | |
| 11 | the lock while the other processes must wait for the lock | ||
| 12 | variable to become available again.</div><a id="idm140174743368592" class="indexterm"></a><a id="idm140174733587520" class="indexterm"></a><a id="idm140174737441024" class="indexterm"></a><div class="para">The <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> script probes the <code class="command">futex</code> system call to show lock contention.</div><div class="para"><div xmlns:d="http://docbook.org/ns/docbook" class="title">futexes.stp</div> | ||
| 11 | <pre class="programlisting">#! /usr/bin/env stap | 13 | <pre class="programlisting">#! /usr/bin/env stap |
| 12 | 14 | ||
| 13 | # This script tries to identify contended user-space locks by hooking | 15 | # This script tries to identify contended user-space locks by hooking |
| @@ -34,19 +36,7 @@ probe end { | |||
| 34 | @avg(lock_waits[pid,lock])) | 36 | @avg(lock_waits[pid,lock])) |
| 35 | } | 37 | } |
| 36 | </pre> | 38 | </pre> |
| 37 | </div><div class="para"> | 39 | </div><div class="para"><a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> needs to be manually stopped; upon exit, it prints the following information:</div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para">Name and ID of the process responsible for a contention</div></li><li class="listitem"><div class="para">The location of the contested lock variable</div></li><li class="listitem"><div class="para">How many times the lock variable was contended</div></li><li class="listitem"><div class="para">Average time of contention throughout the probe</div></li></ul></div><div class="para"><a class="xref" href="futexcontentionsect.html#futexcontentionoutput">Example 5.19, “futexes.stp Sample Output”</a> contains an excerpt from the output of <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> upon exiting the script (after approximately 20 seconds).</div><div class="example"><a id="futexcontentionoutput"> |
| 38 | <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> needs to be manually stopped; upon exit, it prints the following information: | ||
| 39 | </div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para"> | ||
| 40 | Name and ID of the process responsible for a contention | ||
| 41 | </div></li><li class="listitem"><div class="para"> | ||
| 42 | The location of the contested lock variable | ||
| 43 | </div></li><li class="listitem"><div class="para"> | ||
| 44 | How many times the lock variable was contended | ||
| 45 | </div></li><li class="listitem"><div class="para"> | ||
| 46 | Average time of contention throughout the probe | ||
| 47 | </div></li></ul></div><div class="para"> | ||
| 48 | <a class="xref" href="futexcontentionsect.html#futexcontentionoutput">Example 5.19, “futexes.stp Sample Output”</a> contains an excerpt from the output of <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> upon exiting the script (after approximately 20 seconds). | ||
| 49 | </div><div class="example"><a id="futexcontentionoutput"> | ||
| 50 | </a><p class="title"><strong>Example 5.19. <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> Sample Output</strong></p><div class="example-contents"><pre class="screen">[...] | 40 | </a><p class="title"><strong>Example 5.19. <a class="xref" href="futexcontentionsect.html#futexcontention">futexes.stp</a> Sample Output</strong></p><div class="example-contents"><pre class="screen">[...] |
| 51 | automount[2825] lock 0x00bc7784 contended 18 times, 999931 avg us | 41 | automount[2825] lock 0x00bc7784 contended 18 times, 999931 avg us |
| 52 | synergyc[3686] lock 0x0861e96c contended 192 times, 101991 avg us | 42 | synergyc[3686] lock 0x0861e96c contended 192 times, 101991 avg us |
