diff options
Diffstat (limited to 'SystemTap_Beginners_Guide/arrayops-readvalues.html')
| -rw-r--r-- | SystemTap_Beginners_Guide/arrayops-readvalues.html | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/SystemTap_Beginners_Guide/arrayops-readvalues.html b/SystemTap_Beginners_Guide/arrayops-readvalues.html index b983a457..195e7b9e 100644 --- a/SystemTap_Beginners_Guide/arrayops-readvalues.html +++ b/SystemTap_Beginners_Guide/arrayops-readvalues.html | |||
| @@ -1,11 +1,10 @@ | |||
| 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"> | 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.2. Reading Values From Arrays</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="arrayoperators.html" title="3.5. Array Operations in SystemTap" /><link rel="next" href="arrayops-increment.html" title="3.5.3. Incrementing Associated Values" /></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="arrayoperators.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="arrayops-increment.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="arrayops-readvalues"></a>3.5.2. Reading Values From Arrays</h3></div></div></div><a id="idm246928031056" class="indexterm"></a><a id="idm246928029648" class="indexterm"></a><a id="idm246881985072" class="indexterm"></a><div class="para"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>3.5.2. Reading Values From Arrays</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 name="generator" content="publican 2.8" /><meta name="package" content="Systemtap-SystemTap_Beginners_Guide-2.2-en-US-2.2-2" /><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="arrayoperators.html" title="3.5. Array Operations in SystemTap" /><link rel="next" href="arrayops-increment.html" title="3.5.3. Incrementing Associated Values" /></head><body><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="https://fedorahosted.org/publican"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="arrayoperators.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="arrayops-increment.html"><strong>Next</strong></a></li></ul><div class="section" id="arrayops-readvalues"><div class="titlepage"><div><div><h3 class="title" id="arrayops-readvalues">3.5.2. Reading Values From Arrays</h3></div></div></div><a id="idp25483008" class="indexterm"></a><a id="idp62873600" class="indexterm"></a><a id="idp63954480" class="indexterm"></a><div class="para"> | ||
| 4 | You can also read values from an array the same way you would read the value of a variable. To do so, include the <code class="command"><em class="replaceable"><code>array_name</code></em>[<em class="replaceable"><code>index_expression</code></em>]</code> statement as an element in a mathematical expression. For example: | 3 | You can also read values from an array the same way you would read the value of a variable. To do so, include the <code class="command"><em class="replaceable"><code>array_name</code></em>[<em class="replaceable"><code>index_expression</code></em>]</code> statement as an element in a mathematical expression. For example: |
| 5 | </div><a id="idp61830224" class="indexterm"></a><a id="idp40868848" class="indexterm"></a><a id="idp37246112" class="indexterm"></a><a id="idp28309904" class="indexterm"></a><a id="idp15095008" class="indexterm"></a><a id="idp21587008" class="indexterm"></a><a id="idp36652592" class="indexterm"></a><a id="idp38184336" class="indexterm"></a><a id="idp40872224" class="indexterm"></a><a id="idp28945808" class="indexterm"></a><div class="example" id="arrayreadingvaluesfrom"><h6>Example 3.15. Using Array Values in Simple Computations</h6><div class="example-contents"><pre class="screen">delta = gettimeofday_s() - foo[tid()]</pre></div></div><br class="example-break" /><div class="para"> | 4 | </div><a id="idm246922845056" class="indexterm"></a><a id="idm246895706512" class="indexterm"></a><a id="idm246895673760" class="indexterm"></a><a id="idm246913095776" class="indexterm"></a><a id="idm246929876656" class="indexterm"></a><a id="idm246913183344" class="indexterm"></a><a id="idm246912183136" class="indexterm"></a><a id="idm246912181280" class="indexterm"></a><a id="idm246877800016" class="indexterm"></a><a id="idm246922933136" class="indexterm"></a><div class="example"><a id="arrayreadingvaluesfrom"></a><p class="title"><strong>Example 3.15. Using Array Values in Simple Computations</strong></p><div class="example-contents"><pre class="screen">delta = gettimeofday_s() - foo[tid()]</pre></div></div><br class="example-break" /><div class="para"> |
| 6 | This example assumes that the array <code class="command">foo</code> was built using the construct in <a class="xref" href="arrayoperators.html#arrays-timestampprocessname">Example 3.14, “Associating Timestamps to Process Names”</a> (from <a class="xref" href="arrayoperators.html#arrayops-assignvalue">Section 3.5.1, “Assigning an Associated Value”</a>). This sets a timestamp that will serve as a <span class="emphasis"><em>reference point</em></span>, to be used in computing for <code class="literal">delta</code>. | 5 | This example assumes that the array <code class="command">foo</code> was built using the construct in <a class="xref" href="arrayoperators.html#arrays-timestampprocessname">Example 3.14, “Associating Timestamps to Process Names”</a> (from <a class="xref" href="arrayoperators.html#arrayops-assignvalue">Section 3.5.1, “Assigning an Associated Value”</a>). This sets a timestamp that will serve as a <span class="emphasis"><em>reference point</em></span>, to be used in computing for <code class="literal">delta</code>. |
| 7 | </div><div class="para"> | 6 | </div><div class="para"> |
| 8 | The construct in <a class="xref" href="arrayops-readvalues.html#arrayreadingvaluesfrom">Example 3.15, “Using Array Values in Simple Computations”</a> computes a value for the variable <code class="literal">delta</code> by subtracting the associated value of the key <code class="literal">tid()</code> from the current <code class="command">gettimeofday_s()</code>. The construct does this by <span class="emphasis"><em>reading</em></span> the value of <code class="literal">tid()</code> from the array. This particular construct is useful for determining the time between two events, such as the start and completion of a read operation. | 7 | The construct in <a class="xref" href="arrayops-readvalues.html#arrayreadingvaluesfrom">Example 3.15, “Using Array Values in Simple Computations”</a> computes a value for the variable <code class="literal">delta</code> by subtracting the associated value of the key <code class="literal">tid()</code> from the current <code class="command">gettimeofday_s()</code>. The construct does this by <span class="emphasis"><em>reading</em></span> the value of <code class="literal">tid()</code> from the array. This particular construct is useful for determining the time between two events, such as the start and completion of a read operation. |
| 9 | </div><a id="idp63403824" class="indexterm"></a><a id="idp63973616" class="indexterm"></a><a id="idp22033808" class="indexterm"></a><a id="idp23925328" class="indexterm"></a><div class="note"><div class="admonition_header"><h2>Note</h2></div><div class="admonition"><div class="para"> | 8 | </div><a id="idm246914364576" class="indexterm"></a><a id="idm246871566976" class="indexterm"></a><a id="idm246877324992" class="indexterm"></a><a id="idm246929487520" class="indexterm"></a><div xmlns:d="http://docbook.org/ns/docbook" class="note"><div class="admonition_header"><p><strong>Note</strong></p></div><div class="admonition"><div class="para"> |
| 10 | If the <code class="command"><em class="replaceable"><code>index_expression</code></em></code> cannot find the unique key, it returns a value of 0 (for numerical operations, such as <a class="xref" href="arrayops-readvalues.html#arrayreadingvaluesfrom">Example 3.15, “Using Array Values in Simple Computations”</a>) or a null/empty string value (for string operations) by default. | 9 | If the <code class="command"><em class="replaceable"><code>index_expression</code></em></code> cannot find the unique key, it returns a value of 0 (for numerical operations, such as <a class="xref" href="arrayops-readvalues.html#arrayreadingvaluesfrom">Example 3.15, “Using Array Values in Simple Computations”</a>) or a null/empty string value (for string operations) by default. |
| 11 | </div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="arrayoperators.html"><strong>Prev</strong>3.5. Array Operations in SystemTap</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-increment.html"><strong>Next</strong>3.5.3. Incrementing Associated Values</a></li></ul></body></html> | 10 | </div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="arrayoperators.html"><strong>Prev</strong>3.5. Array Operations in SystemTap</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-increment.html"><strong>Next</strong>3.5.3. Incrementing Associated Values</a></li></ul></body></html> \ No newline at end of file |
