diff options
Diffstat (limited to 'SystemTap_Beginners_Guide/arrayops-increment.html')
| -rw-r--r-- | SystemTap_Beginners_Guide/arrayops-increment.html | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/SystemTap_Beginners_Guide/arrayops-increment.html b/SystemTap_Beginners_Guide/arrayops-increment.html index 27a80dc4..24eebb69 100644 --- a/SystemTap_Beginners_Guide/arrayops-increment.html +++ b/SystemTap_Beginners_Guide/arrayops-increment.html | |||
| @@ -1,11 +1,13 @@ | |||
| 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">3.5.3. Incrementing Associated Values</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.0.0" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="SystemTap-SystemTap_Beginners_Guide-2.6-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="arrayoperators.html" title="3.5. Array Operations in SystemTap" /><link rel="prev" href="arrayops-readvalues.html" title="3.5.2. Reading Values From Arrays" /><link rel="next" href="arrayops-foreach.html" title="3.5.4. Processing Multiple Elements in an Array" /></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="arrayops-readvalues.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="arrayops-foreach.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="arrayops-increment"></a>3.5.3. Incrementing Associated Values</h3></div></div></div><a id="idm47951455956224" class="indexterm"></a><a id="idm47951455954672" class="indexterm"></a><a id="idm47951455953120" class="indexterm"></a><div class="para"> | 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">3.5.3. Incrementing Associated Values</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.6-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="arrayoperators.html" title="3.5. Array Operations in SystemTap" /><link rel="prev" href="arrayops-readvalues.html" title="3.5.2. Reading Values From Arrays" /><link rel="next" href="arrayops-foreach.html" title="3.5.4. Processing Multiple Elements in an Array" /></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="arrayops-readvalues.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="arrayops-foreach.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="arrayops-increment"> | 
| 3 | </a>3.5.3. Incrementing Associated Values</h3></div></div></div><a id="idm214008390576" class="indexterm"></a><a id="idm214012070256" class="indexterm"></a><a id="idm213973597664" class="indexterm"></a><div class="para"> | ||
| 3 | Use <code class="command">++</code> to increment the associated value of a unique key in an array, as in: | 4 | Use <code class="command">++</code> to increment the associated value of a unique key in an array, as in: | 
| 4 | </div><pre class="screen"><em class="replaceable"><code>array_name</code></em>[<em class="replaceable"><code>index_expression</code></em>] ++</pre><div class="para"> | 5 | </div><pre class="screen"><em class="replaceable">array_name</em>[<em class="replaceable">index_expression</em>] ++</pre><div class="para"> | 
| 5 | Again, you can also use a handler function for your <code class="command"><em class="replaceable"><code>index_expression</code></em></code>. For example, if you wanted to tally how many times a specific process performed a read to the virtual file system (using the event <code class="command">vfs.read</code>), you can use the following probe: | 6 | Again, you can also use a handler function for your <code class="command"><em class="replaceable">index_expression</em></code>. For example, if you wanted to tally how many times a specific process performed a read to the virtual file system (using the event <code class="command">vfs.read</code>), you can use the following probe: | 
| 6 | </div><a id="idm47951460559856" class="indexterm"></a><a id="idm47951455970192" class="indexterm"></a><a id="idm47951455968144" class="indexterm"></a><a id="idm47951415716928" class="indexterm"></a><a id="idm47951460749184" class="indexterm"></a><div class="example"><a id="simplesimplevfsread"></a><p class="title"><strong>Example 3.16. vfsreads.stp</strong></p><div class="example-contents"><pre class="programlisting">probe vfs.read | 7 | </div><a id="idm214012423392" class="indexterm"></a><a id="idm214015255312" class="indexterm"></a><a id="idm214026397152" class="indexterm"></a><a id="idm214015968768" class="indexterm"></a><a id="idm213970540176" class="indexterm"></a><div class="example"><a id="simplesimplevfsread"> | 
| 8 | </a><p class="title"><strong>Example 3.16. vfsreads.stp</strong></p><div class="example-contents"><pre class="programlisting">probe vfs.read | ||
| 7 | { | 9 | { | 
| 8 | reads[execname()] ++ | 10 | reads[execname()] ++ | 
| 9 | }</pre></div></div><br class="example-break" /><div class="para"> | 11 | }</pre></div></div><div class="para"> | 
| 10 | In <a class="xref" href="arrayops-increment.html#simplesimplevfsread">Example 3.16, “vfsreads.stp”</a>, the first time that the probe returns the process name <code class="command">gnome-terminal</code> (that is, the first time <code class="command">gnome-terminal</code> performs a VFS read), that process name is set as the unique key <code class="literal">gnome-terminal</code> with an associated value of 1. The next time that the probe returns the process name <code class="command">gnome-terminal</code>, SystemTap increments the associated value of <code class="literal">gnome-terminal</code> by 1. SystemTap performs this operation for <span class="emphasis"><em>all</em></span> process names as the probe returns them. | 12 | In <a class="xref" href="arrayops-increment.html#simplesimplevfsread">Example 3.16, “vfsreads.stp”</a>, the first time that the probe returns the process name <code class="command">gnome-terminal</code> (that is, the first time <code class="command">gnome-terminal</code> performs a VFS read), that process name is set as the unique key <code class="literal">gnome-terminal</code> with an associated value of 1. The next time that the probe returns the process name <code class="command">gnome-terminal</code>, SystemTap increments the associated value of <code class="literal">gnome-terminal</code> by 1. SystemTap performs this operation for <span class="emphasis"><em>all</em></span> process names as the probe returns them. | 
| 11 | </div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="arrayops-readvalues.html"><strong>Prev</strong>3.5.2. Reading Values From Arrays</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="arrayops-foreach.html"><strong>Next</strong>3.5.4. Processing Multiple Elements in an Array</a></li></ul></body></html> \ No newline at end of file | 13 | </div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="arrayops-readvalues.html"><strong>Prev</strong>3.5.2. Reading Values From Arrays</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="arrayops-foreach.html"><strong>Next</strong>3.5.4. Processing Multiple Elements in an Array</a></li></ul></body></html> \ No newline at end of file | 
