summaryrefslogtreecommitdiffstats
path: root/SystemTap_Beginners_Guide/arrayops-readvalues.html
diff options
Diffstat (limited to 'SystemTap_Beginners_Guide/arrayops-readvalues.html')
-rw-r--r--SystemTap_Beginners_Guide/arrayops-readvalues.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/SystemTap_Beginners_Guide/arrayops-readvalues.html b/SystemTap_Beginners_Guide/arrayops-readvalues.html
index 72adba13..2e0b4029 100644
--- a/SystemTap_Beginners_Guide/arrayops-readvalues.html
+++ b/SystemTap_Beginners_Guide/arrayops-readvalues.html
@@ -1,12 +1,12 @@
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.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.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="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"> 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.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="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">
3 ⁠</a>3.5.2. Reading Values From Arrays</h3></div></div></div><a id="idm214007122672" class="indexterm"></a><a id="idm214021151248" class="indexterm"></a><a id="idm214026354064" class="indexterm"></a><div class="para"> 3 ⁠</a>3.5.2. Reading Values From Arrays</h3></div></div></div><a id="idm47723002762912" class="indexterm"></a><a id="idm47723002689584" class="indexterm"></a><a id="idm47723002688176" 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">array_name</em>[<em class="replaceable">index_expression</em>]</code> statement as an element in a mathematical expression. For example: 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">array_name</em>[<em class="replaceable">index_expression</em>]</code> statement as an element in a mathematical expression. For example:
5 </div><a id="idm214008389216" class="indexterm"></a><a id="idm214013738384" class="indexterm"></a><a id="idm213974826416" class="indexterm"></a><a id="idm213978768000" class="indexterm"></a><a id="idm214018085024" class="indexterm"></a><a id="idm214014325792" class="indexterm"></a><a id="idm214013762272" class="indexterm"></a><a id="idm213967858112" class="indexterm"></a><a id="idm214007079440" class="indexterm"></a><a id="idm214013748832" class="indexterm"></a><div class="example"><a id="arrayreadingvaluesfrom"> 5 </div><a id="idm47722994337744" class="indexterm"></a><a id="idm47722995866944" class="indexterm"></a><a id="idm47722954359728" class="indexterm"></a><a id="idm47722995314624" class="indexterm"></a><a id="idm47722988872704" class="indexterm"></a><a id="idm47722960492048" class="indexterm"></a><a id="idm47722999309040" class="indexterm"></a><a id="idm47722951207472" class="indexterm"></a><a id="idm47722997585648" class="indexterm"></a><a id="idm47722997583792" class="indexterm"></a><div class="example"><a id="arrayreadingvaluesfrom">
6 ⁠</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><div class="para"> 6 ⁠</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><div class="para">
7 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 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>.
8 </div><div class="para"> 8 </div><div class="para">
9 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 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.
10 </div><a id="idm214013869552" class="indexterm"></a><a id="idm214012682608" class="indexterm"></a><a id="idm214012575008" class="indexterm"></a><a id="idm214014378656" 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 </div><a id="idm47723002750272" class="indexterm"></a><a id="idm47723003722848" class="indexterm"></a><a id="idm47722997943104" class="indexterm"></a><a id="idm47723001901568" 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">
11 If the <code class="command"><em class="replaceable">index_expression</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 If the <code class="command"><em class="replaceable">index_expression</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.
12 </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 12 </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