diff options
author | ddomingo <ddomingo@redhat.com> | 2008-12-04 14:43:33 +1000 |
---|---|---|
committer | ddomingo <ddomingo@redhat.com> | 2008-12-04 14:43:33 +1000 |
commit | 882f2f0d6f0680990be5debde222cfd326afe0b8 (patch) | |
tree | 85c5eb2ba261e0b54dcd88b4dab35ba5ff11f14c /doc/SystemTap_Beginners_Guide/en-US | |
parent | 4df910b8d9b1aa0a79db34189f5233b1507ebc4b (diff) | |
download | systemtap-steved-882f2f0d6f0680990be5debde222cfd326afe0b8.tar.gz systemtap-steved-882f2f0d6f0680990be5debde222cfd326afe0b8.tar.xz systemtap-steved-882f2f0d6f0680990be5debde222cfd326afe0b8.zip |
more edits
Diffstat (limited to 'doc/SystemTap_Beginners_Guide/en-US')
3 files changed, 24 insertions, 51 deletions
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml b/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml index c053c329..9c5e5a9f 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Array-Operations.xml @@ -178,7 +178,18 @@ delta = gettimeofday_s() - foo[tid()] </screen> </example> -<para>In <xref linkend="arrayreadingvaluesfrom"/>, the first statement sets a timestamp associated with the returned value of the handler function <command>tid()</command> as a <emphasis>reference point</emphasis>. The second statement computes a value for the variable <command>delta</command> by subtracting the associated value the reference point from the current <command>gettimeofday_s()</command>. Note that the first statement writes the value of <command>gettimeofday_s()</command> into the appropriate key of array <literal>foo</literal>, while in the second statement the value of <command>foo[tid()]</command> is <emphasis>read</emphasis> from the array in order to compute for <literal>delta</literal>.</para> +<para> + In <xref linkend="arrayreadingvaluesfrom"/>, the first statement sets a timestamp associated + with the returned value of the handler function <command>tid()</command> as a + <emphasis>reference point</emphasis>. + The second statement computes a value for the variable + <command>delta</command> by subtracting the associated value the reference point from the + current <command>gettimeofday_s()</command>. Note that the first statement writes the value + of <command>gettimeofday_s()</command> into the appropriate key of array + <literal>foo</literal>, while in the second statement the value of + <command>foo[tid()]</command> is <emphasis>read</emphasis> from the array in order to compute + for <literal>delta</literal>. +</para> <indexterm> <primary>reading values from arrays</primary> diff --git a/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml b/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml index fa81d7fc..36423fb4 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Arrays.xml @@ -13,7 +13,10 @@ <primary>associative arrays</primary> <secondary>introduction</secondary> </indexterm> -<para>SystemTap also supports the use of associative arrays. While an ordinary variable represents a single value, associative arrays can represent a list of values. Simply put, an associative array is a collection of unique keys; each key in the array has a value associated with it. Illustrating this visually would be similar to creating a two-column table: the first column would have the unique key, while the second column would have each key's associated value. Each unique key and its associated value is referred to as a <emphasis>key pair</emphasis>.</para> + +<para>SystemTap also supports the use of associative arrays. While an ordinary variable represents a single value, associative arrays can represent a list of values. Simply put, an associative array is a collection of unique keys; each key in the array has a value associated with it.</para> + +<!--<para>SystemTap also supports the use of associative arrays. While an ordinary variable represents a single value, associative arrays can represent a list of values. Simply put, an associative array is a collection of unique keys; each key in the array has a value associated with it. Illustrating this visually would be similar to creating a two-column table: the first column would have the unique key, while the second column would have each key's associated value. Each unique key and its associated value is referred to as a <emphasis>key pair</emphasis>.</para>--> <!-- next 2 indexterms for key pairs --> @@ -156,62 +159,19 @@ foo["harry"] = 25 </screen> </example> -<important> - <title>Important</title> - <para>All associate arrays must be declared as <command>global</command>, regardless of whether the associate array is used in one or multiple probes. </para> -</important> - - -<section id="tuples"> - <title>Array Slots</title> -<!-- next 2 indexterms for slots --> - -<indexterm> -<primary>arrays</primary> -<secondary>introduction</secondary> -<tertiary>slots</tertiary> -</indexterm> - -<indexterm> -<primary>associative arrays</primary> -<secondary>introduction</secondary> -<tertiary>slots</tertiary> -</indexterm> - -<indexterm> -<primary>slots</primary> -<secondary>introduction</secondary> -<tertiary>arrays</tertiary> -</indexterm> -<para>Another important point to remember in arrays is that each element therein (i.e. the indexed expression) exists in a <emphasis>slot</emphasis>. A key pair's slot is defined by the order in which each pair's unique key is defined. In our sample array <command>foo</command> in <xref linkend="arraysimplestexample"/>, the key pair that uses the unique key <command>tom</command> is in the first slot, since <command>tom</command> was the first unique key to be defined. <command>dick</command> is in the second slot, and so on.</para> - -<!-- -<para>The sequence in which each key pair appears in an array (as defined by each pair's slot) is referred to as a <emphasis>tuple</emphasis>. Tuples allow us to refer to key pairs in an array by the order in which they appear in the sequence.</para>--> - -<para>For example, the array statements in <xref linkend="arraysimplestexample"/> set 23 as the associated value of the unique key <command>tom</command>. Given the same array <command>foo</command>, we can increment the associated value of <command>tom</command> by 1 using the operator <command>++</command>, like so:</para> +<para>You can specify up to 5 index expressons in an array statement, each one delimited by a comma (<command>,</command>). This is useful if you wish to perform the same operation to a set of key pairs. For example, to increase the associated value of all the key pairs defined by <xref linkend="arraysimplestexample"/>, you can use the following statement:</para> <screen> -foo["tom"] ++ +foo["tom","dick","harry"] ++ </screen> -<para>The above statement will increase the associated value of unique key <command>tom</command> to 24. Now, looking back at <xref linkend="arraysimplestexample"/>, we know that <command>dick</command> was the first unique key to be defined. As such, we can perform the same operation (i.e. incrementing associated value by 1) to <command>dick</command> using the following statement:</para> - -<screen> -foo[2] ++ -</screen> +<important> + <title>Important</title> + <para>All associate arrays must be declared as <command>global</command>, regardless of whether the associate array is used in one or multiple probes. </para> +</important> -<note> - <title>Note</title> - <para>You can specify up to 5 index expressons in an array statement, each one delimited by a comma (<command>,</command>). This is useful if you wish to perform the same operation to a set of key pairs. For example, to increase the associated value of all the key pairs defined by <xref linkend="arraysimplestexample"/>, you can use the following statement:</para> - -<screen> -foo["tom",2,"harry"] ++ -</screen> -</note> -</section> -<xi:include href="Array-Operations.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <!-- <varlistentry> <term></term> diff --git a/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml b/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml index 4e63ac4e..4e61e247 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml @@ -156,6 +156,8 @@ <xi:include href="Scripts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="ScriptConstructs.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="Arrays.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> +<xi:include href="Array-Operations.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> + <!-- <section id="understanding-scripts"> <title>SystemTap Scripts</title> |