summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorddomingo <ddomingo@redhat.com>2008-11-27 08:18:03 +1000
committerddomingo <ddomingo@redhat.com>2008-11-27 08:18:03 +1000
commitc41e99c8f098302a9ed2eb4fcac6ff5e7cd79cab (patch)
treed946c8afe19c62e7c68d4a237bc34e5513dfc2e9 /doc
parenteca9d638143b8e7e3a7ab877ea2d9b47736e5879 (diff)
downloadsystemtap-steved-c41e99c8f098302a9ed2eb4fcac6ff5e7cd79cab.tar.gz
systemtap-steved-c41e99c8f098302a9ed2eb4fcac6ff5e7cd79cab.tar.xz
systemtap-steved-c41e99c8f098302a9ed2eb4fcac6ff5e7cd79cab.zip
added index
Diffstat (limited to 'doc')
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml101
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Installation.xml121
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Introduction.xml53
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml200
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Scripts.xml453
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml57
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml85
7 files changed, 1034 insertions, 36 deletions
diff --git a/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml b/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml
index 3ff3c2d8..c4b643d3 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml
@@ -4,12 +4,38 @@
<section id="cross-compiling">
<title>Generating Instrumentation for Other Computers</title>
-
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>building kernel modules from SystemTap scripts</secondary>
+</indexterm>
+<indexterm>
+ <primary>cross-instrumentation</primary>
+ <secondary>generating instrumentation from SystemTap scripts</secondary>
+</indexterm>
<remark>
cross-compiling script from here:
http://sources.redhat.com/ml/systemtap/2008-q3/msg00310.html
</remark>
-
+
+<indexterm>
+<primary>kernel modules from SystemTap scripts, building</primary>
+</indexterm>
+<indexterm>
+ <primary>building kernel modules from SystemTap scripts</primary>
+</indexterm>
+<indexterm>
+ <primary>instrumentation modules from SystemTap scripts, building</primary>
+</indexterm>
+<indexterm>
+ <primary>building instrumentation modules from SystemTap scripts</primary>
+</indexterm>
+<indexterm>
+ <primary>compiling instrumentation/kernel modules from SystemTap scripts</primary>
+</indexterm>
+
+<indexterm>
+<primary>cross-compiling</primary>
+</indexterm>
<remark>
above; add short description, significance, howto, script (test first)
</remark>
@@ -29,6 +55,14 @@
<para>
To work around this, you can resort to <firstterm>cross-instrumentation</firstterm>. Cross-instrumentation is the process of generating SystemTap instrumentation module from a SystemTap script on one computer to be used on another computer. This process offers the following benefits:
</para>
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>advantages of</secondary>
+</indexterm>
+
+<indexterm>
+<primary>advantages of cross-instrumentation</primary>
+</indexterm>
<itemizedlist>
<listitem>
@@ -73,6 +107,15 @@
<itemizedlist>
<listitem>
<para>
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>instrumentation module</secondary>
+</indexterm>
+
+<indexterm>
+<primary>instrumentation module</primary>
+<secondary>cross-instrumentation</secondary>
+</indexterm>
<emphasis>instrumentation module</emphasis> &mdash; the
kernel module built from a SystemTap script; i.e. the
<emphasis>SystemTap module</emphasis> is built on the <emphasis>host
@@ -84,6 +127,15 @@
<listitem>
<para>
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>host system</secondary>
+</indexterm>
+
+<indexterm>
+<primary>host system</primary>
+<secondary>cross-instrumentation</secondary>
+</indexterm>
<emphasis>host system</emphasis> &mdash; the system on
which you compile the instrumentation modules (from SystemTap
scripts), to be loaded on <emphasis>target
@@ -93,6 +145,16 @@
<listitem>
<para>
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>target system</secondary>
+</indexterm>
+
+<indexterm>
+<primary>target system</primary>
+<secondary>cross-instrumentation</secondary>
+</indexterm>
+
<emphasis>target system</emphasis> &mdash; the system for which you
are building the <emphasis>instrumentation module</emphasis> (from
SystemTap scripts).
@@ -101,6 +163,15 @@
<listitem>
<para>
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>target kernel</secondary>
+</indexterm>
+
+<indexterm>
+<primary>target kernel</primary>
+<secondary>cross-instrumentation</secondary>
+</indexterm>
<emphasis>target kernel</emphasis> &mdash; the kernel of
the <emphasis>target system</emphasis>. This is the kernel on which
you wish to load/run the <emphasis>instrumentation
@@ -120,7 +191,22 @@
<procedure id="preppingxcompile">
<title>Configuring a Host System and Target Systems</title>
+<indexterm>
+<primary>cross-instrumentation</primary>
+<secondary>configuration</secondary>
+<tertiary>host system and target system</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>host system and target system</primary>
+<secondary>cross-instrumentation</secondary>
+<tertiary>configuration</tertiary>
+</indexterm>
+<indexterm>
+ <primary>target system and host system</primary>
+ <secondary>configuration</secondary>
+</indexterm>
<step>
<para>
Install the <filename>systemtap-runtime</filename> RPM on each
@@ -188,6 +274,17 @@ stap -r <replaceable>kernel_version</replaceable> <replaceable>script</replaceab
<note>
<title>Note</title>
+<indexterm>
+<primary>uname -m</primary>
+</indexterm>
+
+<indexterm>
+<primary>determining architecture notation</primary>
+</indexterm>
+
+<indexterm>
+ <primary>architecture notation, determining</primary>
+</indexterm>
<para>
To determine the architecture notation of a running kernel, run
<command>uname -m</command>.
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Installation.xml b/doc/SystemTap_Beginners_Guide/en-US/Installation.xml
index 568cb74c..1ff2ff29 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Installation.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Installation.xml
@@ -12,7 +12,14 @@
<remark>
notes in ~/Desktop/SystemTap/aug21chatlog and ~/Desktop/SystemTap/noted_wcohenmeeting
</remark>
-
+<indexterm>
+<primary>Installation</primary>
+<secondary>Setup and Installation</secondary>
+</indexterm>
+
+<indexterm>
+<primary>Setup and Installation</primary>
+</indexterm>
<para> To deploy SystemTap, you need to install the SystemTap packages along
with the corresponding set of <filename>-devel</filename>,
<filename>-debuginfo</filename> and <filename>-debuginfo-common</filename>
@@ -38,7 +45,26 @@
<para>To deploy Systemtap, you will need to to install the following RPMs:
</para>
+<indexterm>
+<primary>Installation</primary>
+<secondary>systemtap package</secondary>
+</indexterm>
+
+<indexterm>
+<primary>systemtap package</primary>
+</indexterm>
+
+
+<!-- next 2 indexterms for systemtap-runtime package -->
+
+<indexterm>
+<primary>Installation</primary>
+<secondary>systemtap-runtime package</secondary>
+</indexterm>
+<indexterm>
+<primary>systemtap-runtime package</primary>
+</indexterm>
<itemizedlist>
<listitem><para><filename>systemtap</filename></para></listitem>
<listitem><para><filename>systemtap-runtime</filename></para></listitem>
@@ -51,7 +77,28 @@
<section id="install-kinfo">
<title>Installing Required Kernel Information RPMs</title>
+<indexterm>
+<primary>Installation</primary>
+<secondary>required packages</secondary>
+</indexterm>
+<indexterm>
+<primary>required packages</primary>
+</indexterm>
+<indexterm>
+ <primary>packages required to run SystemTap</primary>
+</indexterm>
+<indexterm>
+ <primary>RPMs required to run SystemTap</primary>
+</indexterm>
+<indexterm>
+ <primary>Installation</primary>
+ <secondary>kernel information packages</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>kernel information packages</primary>
+</indexterm>
<para> SystemTap needs information about the kernel in order to place instrumentation in it (i.e. probe it). This information also allows SystemTap to generate the code for the instrumentation. This information is contained in the matching <filename>-devel</filename> and <filename>-debuginfo</filename> packages for your kernel. The necessary <filename>-devel</filename> and
<filename>-debuginfo</filename> packages for the ordinary "vanilla" kernel
are as follows:
@@ -69,8 +116,21 @@
and <filename>kernel-PAE-devel</filename>.
</para>
+<indexterm>
+<primary>Installation</primary>
+<secondary>kernel version, determining the</secondary>
+</indexterm>
-
+<indexterm>
+<primary>kernel version, determining the</primary>
+</indexterm>
+
+<indexterm>
+<primary>determining the kernel version</primary>
+</indexterm>
+<indexterm>
+ <primary>uname -r</primary>
+</indexterm>
<para> To determine what kernel your system is currently using, use:</para>
<screen>
@@ -103,7 +163,26 @@ uname -r
<xref linkend="stapprep"/> (e.g. <computeroutput>2.6.18-92.el5</computeroutput>) if you wish
to probe a kernel that is not currently loaded.
</para>
+<indexterm>
+ <primary>Installation</primary>
+ <secondary>stapprep.sh</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>stapprep.sh</primary>
+</indexterm>
+
+
+<!-- next 2 indexterms for installation script -->
+<indexterm>
+ <primary>Installation</primary>
+ <secondary>installation script</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>installation script</primary>
+</indexterm>
<note>
<title>Note</title>
<para>Running <xref linkend="stapprep"/> as root will display the required kernel packages <emphasis>and</emphasis> install them as well, provided that <command>yum</command> and <command>yum-utils</command> are configured properly.</para>
@@ -120,7 +199,9 @@ uname -r
<para> The script <xref linkend="stapprep"/> can be used by normal users to determine what supporting kernel RPMs need to be installed on the machine to use SystemTap with a particular kernel. The script run without any arguments detemines the RPMs needed for the currently running kernel. The script can also accept one argument, the output <command>uname -r</command>, to determine the related RPMs required for a kernel that may not be currently running on the machine.
</para>-->
-
+<indexterm>
+<primary>script for installing kernel information packages</primary>
+</indexterm>
<formalpara id="stapprep">
<title>stapprep.sh</title>
<para>
@@ -141,7 +222,26 @@ search the /etc/yum.repo.d/ directory for debuginfo repositories -->
<para>
If you do not have <command>yum</command> and <command>yum-utils</command> installed (and you are unable to install them), you will have to manually download and install the required kernel information packages. To generate the URL from which to download the required packages, use the following script:
</para>
-
+<indexterm condition="fedora">
+<primary>Installation</primary>
+<secondary>fedoradebugurl.sh</secondary>
+</indexterm>
+
+<indexterm condition="fedora">
+<primary>fedoradebugurl.sh</primary>
+</indexterm>
+
+
+<!-- next 2 indexterms for rheldebugurl.sh -->
+
+<indexterm condition="RedHat">
+<primary>Installation</primary>
+<secondary>rheldebugurl.sh</secondary>
+</indexterm>
+
+<indexterm condition="RedHat">
+<primary>rheldebugurl.sh</primary>
+</indexterm>
<formalpara condition="RedHat">
<title>rheldebugurl.sh</title>
<para>
@@ -168,7 +268,18 @@ Once you have manually downloaded the required packages to the machine, install
<section id="testing">
<title>Initial Testing</title>
-
+<indexterm>
+<primary>Installation</primary>
+<secondary>initial testing</secondary>
+</indexterm>
+
+<indexterm>
+<primary>initial testing</primary>
+</indexterm>
+
+<indexterm>
+<primary>testing, initial</primary>
+</indexterm>
<para>If you are currently using the kernel you wish to probe with
SystemTap, you can immediately test whether the deployment was
successful. If not, you will need to reboot and load the appropriate
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml b/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml
index 47a11476..78ee1083 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml
@@ -4,6 +4,17 @@
<chapter id="introduction">
<title>Introduction</title>
+ <indexterm>
+ <primary>Introduction</primary>
+ <secondary>performance monitoring</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>performance monitoring</primary>
+ <secondary>Introduction</secondary>
+ </indexterm>
+<!-- next 2 indexterms for documentation goals -->
+
<para>
SystemTap is a tracing and probing tool that allows users to study and monitor the activities of the operating system (particularly, the kernel) in fine detail. It provides information similar to the output of tools like <command>netstat</command>, <command>ps</command>, <command>top</command>, and <command>iostat</command>; however, SystemTap is designed to provide more filtering and analysis options for collected information.
</para>
@@ -25,6 +36,27 @@
-->
<section id="goals">
<title>Documentation Goals</title>
+
+<indexterm>
+<primary>Introduction</primary>
+<secondary>documentation goals</secondary>
+</indexterm>
+
+<indexterm>
+<primary>documentation goals</primary>
+<secondary>Introduction</secondary>
+</indexterm>
+<indexterm>
+<primary>Introduction</primary>
+<secondary>goals, documentation</secondary>
+</indexterm>
+
+<indexterm>
+<primary>goals, documentation</primary>
+<secondary>Introduction</secondary>
+</indexterm>
+
+
<para>SystemTap provides the infrastructure to monitor the running Linux kernel for detailed analysis. This can assist administrators and developers in identifying the underlying cause of a bug or performance problem.</para>
<para>Without SystemTap, monitoring the activity of a running kernel would require a tedious instrument, recompile, install, and reboot sequence. SystemTap is designed to eliminate this, allowing users to gather the same information by simply running user-written SystemTap scripts.</para>
@@ -60,7 +92,15 @@
<remark>
** Short summary; when is SystemTap suitable vs other popular monitoring tools (e.g. top, Oprofile, /proc)
</remark>
-
+<indexterm>
+<primary>Introduction</primary>
+<secondary>capabilities of SystemTap</secondary>
+</indexterm>
+
+<indexterm>
+<primary>capabilities of SystemTap</primary>
+<secondary>Introduction</secondary>
+</indexterm>
<para>SystemTap was originally developed as a working &PROD; version of old Linux probing tools such as <application>dprobes</application> and the Linux Trace Toolkit. SystemTap aims to supplement the existing suite of Linux monitoring tools by providing users with the infrastructure to track kernel activity. In addition, SystemTap combines this capability with two things:</para>
<!--
@@ -93,6 +133,17 @@
<para>TBD</para>
</formalpara>
-->
+<indexterm>
+ <primary>Introduction</primary>
+ <secondary>limitations of SystemTap</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>limitations of SystemTap</primary>
+ <secondary>Introduction</secondary>
+</indexterm>
+
+
<formalpara>
<title>Limitations</title>
<para>The current iteration of SystemTap allows for a multitude of options when probing kernel-space events. However, SystemTap's ability to probe user-space events is quite limited. At present, the developmental efforts of the SystemTap community are geared towards improving SystemTap's user-space probing capabilities.</para>
diff --git a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
index 1cda95a4..e0917280 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml
@@ -4,15 +4,84 @@
<section id="scriptconstructions">
<title>Basic SystemTap Handler Constructs</title>
-
+<indexterm>
+<primary>handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+</indexterm>
+
+<!-- next 2 indexterms for syntax and format -->
+
+<indexterm>
+<primary>handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>syntax and format</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>syntax and format</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>syntax and format</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
<para>SystemTap supports the use of several basic constructs in handlers. The syntax for most of these handler constructs are mostly based on C and <command>awk</command> syntax. This section describes several of the most useful SystemTap handler constructs, which should provide you with enough information to write simple yet useful SystemTap scripts.</para>
<section id="variablesconstructs">
<title>Variables</title>
-
+<!-- next 3 indexterms for variables -->
+<indexterm>
+<primary>handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>variables</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>variables</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>variables</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
+
+<indexterm>
+ <primary>format and syntax</primary>
+ <secondary>SystemTap handler constructs</secondary>
+ <tertiary>handlers</tertiary>
+</indexterm>
<para>Variables can be used freely throughout a handler; simply choose a name, assign it to a function, and use it in an expression. SystemTap automatically identifies whether a variable should be identified as a string or integer, based on the function it is assigned to. For instance, if you use set the variable <command>foo</command> to <command>gettimeofday_s()</command> (as in <command>foo = gettimeofday_s()</command>), then <command>foo</command> can be used as an integer argument (<command>%d</command>) in <command>printf()</command>.</para>
+<!-- next 2 indexterms for <command>global</command> -->
+
+<indexterm>
+<primary>handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary><command>global</command></tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary><command>global</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>global</command></primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
<para>Note, however, that by default variables are only local to the probe they are used in. This means that variables are initialized, used and disposed at each probe handler invocation. To share a variable between probes, declare the variable name first using <command>global</command> outside of any probe. Consider the following example:</para>
<example id="timerjiffies">
@@ -30,6 +99,10 @@ probe timer.ms(12345)
}
</programlisting>
</example>
+
+<indexterm>
+<primary><command>CONFIG_HZ, computing for</command></primary>
+</indexterm>
<para><xref linkend="timerjiffies"/> attempts to compute the <command>CONFIG_HZ</command> setting of the kernel using timers that count jiffies and milliseconds, then computing accordingly. The <command>global</command> statement allows the script to use the variables <command>count_jiffies</command> and <command>count_ms</command> (set in their own respective probes) to be shared with <command>probe timer.ms(12345)</command>.</para>
@@ -50,6 +123,15 @@ probe timer.jiffies(100) { count_jiffies ++ }
</section>
<section id="handlerconditionalstatements">
<title>Conditional Statements</title>
+<indexterm>
+<primary>handlers</primary>
+<secondary>conditional statements</secondary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>conditional statements</secondary>
+</indexterm>
<para>
In some cases, the output of a SystemTap script may be too big. To address this, you need to further refine the script's logic in order to delimit the output into something more relevant or useful to your probe.
</para>
@@ -62,6 +144,25 @@ You can do this by using <emphasis>conditionals</emphasis> in handlers. SystemTa
<varlistentry>
<term>If/Else Statements</term>
<listitem>
+<!-- next 3 indexterms for if/else -->
+<indexterm>
+<primary>handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>if/else</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>if/else</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>if/else</primary>
+<secondary>conditional statements</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
+
<para>Format:</para>
<programlisting>
if (<replaceable>condition</replaceable>)
@@ -95,6 +196,25 @@ probe end
<varlistentry>
<term>While Loops</term>
<listitem>
+<!-- next 2 indexterms for while loops -->
+
+<indexterm>
+<primary>handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>while loops</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>while loops</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>while loops</primary>
+<secondary>conditional statements</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
<para>Format:</para>
<programlisting>
while (<replaceable>condition</replaceable>) {<replaceable>statement</replaceable>}
@@ -119,6 +239,25 @@ printf("goodbye world\n")
<varlistentry>
<term>For Loops</term>
<listitem>
+<!-- next 2 indexterms for for loops -->
+
+<indexterm>
+<primary>handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>for loops</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>for loops</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>for loops</primary>
+<secondary>conditional statements</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
<para>Format:</para>
<programlisting>
for (<replaceable>argument1</replaceable>; <replaceable>argument2</replaceable>; <replaceable>argument3</replaceable>) {<replaceable>statement</replaceable>}
@@ -144,6 +283,26 @@ for (<replaceable>argument1</replaceable>; <replaceable>argument2</replaceable>;
<formalpara>
<title>Conditional Operators</title>
+<!-- next 2 indexterms for conditional operators -->
+
+<indexterm>
+<primary>handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>conditional operators</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>conditional statements</secondary>
+<tertiary>conditional operators</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>conditional operators</primary>
+<secondary>conditional statements</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
+
<para>Aside from <command>==</command> ("is equal to"), you can also use the following operators in your conditional statements:</para>
</formalpara>
@@ -174,6 +333,23 @@ for (<replaceable>argument1</replaceable>; <replaceable>argument2</replaceable>;
</section>
<section id="commandlineargssect">
<title>Command-Line Arguments</title>
+<indexterm>
+<primary>handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>command-line arguments</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>command-line arguments</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>command-line arguments</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
<para>You can also allow a SystemTap script to accept simple command-line arguments and declare them in the script without using <command>target()</command>. One way to do this is to use the variable notation <command>$</command> or <command>@</command>.</para>
<!-- </formalpara> -->
@@ -186,7 +362,25 @@ probe kernel.function(@1).return { }
</example>
<para><xref linkend="commandlineargs"/> is similar to <xref linkend="wildcards"/>, except that it allows you to pass the kernel function to be probed as a command-line argument (as in <command>stap commandlineargs.stp <replaceable>kernel function</replaceable></command>). You can also specify the script to accept multiple command-line arguments, noting them as <command>@1</command>, <command>@2</command>, and so on, in the order they are entered by the user.</para>
-
+ <!-- next 2 indexterms for variable notations -->
+
+<indexterm>
+<primary>handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>variable notations</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap handlers</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>variable notations</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>variable notations</primary>
+<secondary>SystemTap handler constructs</secondary>
+<tertiary>handlers</tertiary>
+</indexterm>
<para>Both variable notations <command>$</command> and <command>@</command> also represent a specific variable type. Use <command>$</command> if you are expecting the user to enter an integer as a command-line argument, and <command>@</command> if you are expecting a string.</para>
</section>
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
index b9eb036e..73f4c6b2 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
@@ -4,13 +4,54 @@
<section id="scripts">
<title>SystemTap Scripts</title>
-
- <para>
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+</indexterm>
+ <indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+</indexterm>
+
+
+
+<para>
For the most part, SystemTap scripts are the foundation of each SystemTap
session. SystemTap scripts instruct SystemTap on what type of information to
collect, and what to do once that information is collected.
</para>
-
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>components</tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>components</tertiary>
+</indexterm>
+
+<indexterm>
+ <primary>components</primary>
+ <secondary>SystemTap scripts</secondary>
+ <tertiary>introduction</tertiary>
+</indexterm>
+
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>events and handlers</tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>events and handlers</tertiary>
+</indexterm>
+<indexterm>
+<primary>handlers and events</primary>
+<secondary>SystemTap scripts</secondary>
+<tertiary>introduction</tertiary>
+</indexterm>
<para>
As stated in <xref linkend="understanding-how-systemtap-works"/>, SystemTap
scripts are made up of two components: <emphasis>events</emphasis> and
@@ -21,6 +62,21 @@
<note>
<title>Note</title>
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>probes</tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>probes</tertiary>
+</indexterm>
+<indexterm>
+<primary>probes</primary>
+<secondary>SystemTap scripts</secondary>
+<tertiary>introduction</tertiary>
+</indexterm>
<para>
An event and its corresponding handler is collectively called a
<emphasis>probe</emphasis>. A SystemTap script can have multiple probes.
@@ -51,6 +107,26 @@
<formalpara id="scriptformats">
<title>Format</title>
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>format and syntax</tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>format and syntax</tertiary>
+</indexterm>
+<indexterm>
+<primary>format and syntax</primary>
+<secondary>SystemTap scripts</secondary>
+<tertiary>introduction</tertiary>
+</indexterm>
+<indexterm>
+<primary>syntax and format</primary>
+<secondary>SystemTap scripts</secondary>
+<tertiary>introduction</tertiary>
+</indexterm>
<para>
SystemTap scripts use the file extension <filename>.stp</filename>, and
are conatains probes written in the following format:
@@ -66,7 +142,21 @@ probe <replaceable>event</replaceable> {<replaceable>statements</replaceable>}
single probe, SystemTap will execute the handler when any of the specified
events occur.
</para>
-
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>statement blocks</tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>statement blocks</tertiary>
+</indexterm>
+<indexterm>
+<primary>statement blocks</primary>
+<secondary>SystemTap scripts</secondary>
+<tertiary>introduction</tertiary>
+</indexterm>
<para>
Each probe has a corresponding <firstterm>statement block</firstterm>. This statement block is
enclosed in braces (<command>{ }</command>) and contains the handlers to be executed per event.
@@ -83,7 +173,21 @@ probe <replaceable>event</replaceable> {<replaceable>statements</replaceable>}
administrator.
</para>
</note>
-
+<indexterm>
+<primary>scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>functions</tertiary>
+</indexterm>
+<indexterm>
+<primary>SystemTap scripts</primary>
+<secondary>introduction</secondary>
+<tertiary>functions</tertiary>
+</indexterm>
+<indexterm>
+<primary>functions</primary>
+<secondary>SystemTap scripts</secondary>
+<tertiary>introduction</tertiary>
+</indexterm>
<para>
Systemtap allows you to write functions to factor out code to be used by a
number of probes. Thus, rather than repeatedly writing the same
@@ -120,7 +224,10 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
<section id="systemtapscript-events">
<title>Event</title>
-
+<indexterm>
+<primary>Events</primary>
+<secondary>introduction</secondary>
+</indexterm>
<para>
SystemTap events can be broadly classified into two types:
<firstterm>synchronous</firstterm> and
@@ -129,6 +236,15 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
<formalpara>
<title>Synchronous Events</title>
+<indexterm>
+<primary>Events</primary>
+<secondary>synchronous events</secondary>
+</indexterm>
+
+<indexterm>
+<primary>synchronous events</primary>
+<secondary>Events</secondary>
+</indexterm>
<para>
A <firstterm>synchronous</firstterm> event occurs when any process
executes an instruction that references a particular location in kernel
@@ -140,7 +256,15 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
<!--<para>A <firstterm>synchronous</firstterm> event occurs when any processor executes an instruction matched by the specification. This gives other events a reference point (or instruction address) from which more contextual data may be available.</para>-->
<!--<para>Synchronous events reference particular locations in kernel code. As a result, when synchronous events are used SystemTap can determine contextual information regarding the location (such as function parameters).</para>-->
-
+<indexterm>
+<primary>Events</primary>
+<secondary>examples of synchronous and asynchronous events</secondary>
+</indexterm>
+
+<indexterm>
+<primary>examples of synchronous and asynchronous events</primary>
+<secondary>Events</secondary>
+</indexterm>
<para>Examples of synchronous events include:</para>
<variablelist>
@@ -148,6 +272,16 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
<varlistentry>
<term>syscall.<replaceable>system_call</replaceable></term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary><command>syscall.<replaceable>system_call</replaceable></command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>syscall.<replaceable>system_call</replaceable></command></primary>
+<secondary>Events</secondary>
+</indexterm>
+
<para>
The entry to the system call
<replaceable>system_call</replaceable>. If the exit from a syscall
@@ -161,13 +295,23 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
</varlistentry>
<varlistentry>
- <term>vfs.<replaceable>file_op</replaceable></term>
+ <term>vfs.<replaceable>file_operation</replaceable></term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary><command>vfs.<replaceable>file_operation</replaceable></command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>vfs.<replaceable>file_operation</replaceable></command></primary>
+<secondary>Events</secondary>
+</indexterm>
+
<para>
- The entry to the <replaceable>file_op</replaceable> event for
+ The entry to the <replaceable>file_operation</replaceable> event for
Virtual File System (VFS). Similar to <command>syscall</command>
event, appending a <command>.return</command> to the event monitors
- the exit of the <replaceable>file_op</replaceable> operation.
+ the exit of the <replaceable>file_operation</replaceable> operation.
</para>
</listitem>
</varlistentry>
@@ -175,6 +319,15 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
<varlistentry>
<term>kernel.function("<replaceable>function</replaceable>")</term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary><command>kernel.function("<replaceable>function</replaceable>")</command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>kernel.function("<replaceable>function</replaceable>")</command></primary>
+<secondary>Events</secondary>
+</indexterm>
<para>
The entry to the kernel function
<replaceable>function</replaceable>. For example,
@@ -186,7 +339,17 @@ probe <replaceable>event</replaceable> {<replaceable>function_name</replaceable>
string to the event statement;
i.e. <command>kernel.function("sys_open").return</command>.
</para>
-
+<indexterm>
+<primary>Events</primary>
+<secondary>wildcards</secondary>
+</indexterm>
+
+<indexterm>
+<primary>wildcards in events</primary>
+</indexterm>
+<indexterm>
+ <primary>events wildcards</primary>
+</indexterm>
<para>
When defining functions, you can use asterisk (<literal>*</literal>)
for wildcards. You can also trace the entry or exit of a function in
@@ -217,6 +380,15 @@ probe kernel.function("*@net/socket.c").return { }
<varlistentry>
<term>module("<replaceable>module</replaceable>").function("<replaceable>function</replaceable>")</term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary><command>module("<replaceable>module</replaceable></command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>module("<replaceable>module</replaceable></command></primary>
+<secondary>Events</secondary>
+</indexterm>
<para>Allows you to probe functions within modules. For example:</para>
<example id="eventsmodules"><title>moduleprobe.stp</title>
@@ -240,6 +412,16 @@ probe module("ext3").function("*").return { }
<formalpara>
<title>Asynchronous Events</title>
+<indexterm>
+<primary>Events</primary>
+<secondary>asynchronous events</secondary>
+</indexterm>
+
+<indexterm>
+<primary>asynchronous events</primary>
+<secondary>Events</secondary>
+</indexterm>
+
<para>
<firstterm>Asynchronous</firstterm> events are not tied to a particular
instruction or location in code. This family of probe points consists
@@ -255,6 +437,15 @@ probe module("ext3").function("*").return { }
<varlistentry>
<term>begin</term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary><command>begin</command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>begin</command></primary>
+<secondary>Events</secondary>
+</indexterm>
<para>
The startup of a SystemTap session; i.e. as soon as the SystemTap
script is run.
@@ -265,12 +456,31 @@ probe module("ext3").function("*").return { }
<varlistentry>
<term>end</term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary><command>end</command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>end</command></primary>
+<secondary>Events</secondary>
+</indexterm>
<para>The end of a SystemTap session.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>timer events</term>
<listitem>
+<indexterm>
+<primary>Events</primary>
+<secondary>timer events</secondary>
+</indexterm>
+
+<indexterm>
+<primary>timer events</primary>
+<secondary>Events</secondary>
+</indexterm>
+
<para>
An event that specifies a handler to be executed every specified
period of time. For example:
@@ -329,10 +539,13 @@ probe timer.s(4)
<remark>is reference appropriate? too advanced for readers (it seems so to me)? please advise.</remark>
</section>
-
+<!-- stophere -->
<section id="systemtapscript-handler">
<title>Systemtap Handler/Body</title>
-
+<indexterm>
+<primary>Handlers</primary>
+<secondary>introduction</secondary>
+</indexterm>
<para> Consider the following sample script: </para>
<example id="helloworld"><title>helloworld.stp</title>
@@ -354,6 +567,15 @@ probe begin
<note>
<title>Note</title>
+<indexterm>
+<primary>Handlers</primary>
+<secondary><command>exit()</command></secondary>
+</indexterm>
+
+<indexterm>
+<primary><command>exit()</command></primary>
+<secondary>Handlers</secondary>
+</indexterm>
<para>
SystemTap scripts continue to run until the
<command>exit()</command> function executes. If the users wants to stop
@@ -364,6 +586,11 @@ probe begin
<formalpara id="printf">
<title>printf ( ) Statements</title>
+<indexterm>
+ <primary><command>printf()</command></primary>
+ <secondary>format strings</secondary>
+ </indexterm>
+
<para>
The <command>printf ()</command> statement is one of the simplest
functions for printing data. <command>printf ()</command> can also be
@@ -376,14 +603,30 @@ probe begin
<programlisting>
printf ("<replaceable>format string</replaceable>\n", <replaceable>argument</replaceable>)
</programlisting>
-
+<indexterm>
+<primary><command>printf()</command></primary>
+<secondary>format strings</secondary>
+</indexterm>
+
+<indexterm>
+<primary>format strings</primary>
+<secondary><command>printf()</command></secondary>
+</indexterm>
<para>
The <replaceable>format string</replaceable> specifies how
<replaceable>argument</replaceable> should be printed. The format string
of <xref linkend="helloworld"/> simply instructs SystemTap to print
<command>hello world</command>, and contains no format specifiers.
</para>
-
+<indexterm>
+<primary><command>printf()</command></primary>
+<secondary>format specifiers</secondary>
+</indexterm>
+
+<indexterm>
+<primary>format specifiers</primary>
+<secondary><command>printf()</command></secondary>
+</indexterm>
<para>
You can use the format specifiers <command>%s</command> (for strings)
and <command>%d</command> (for numbers) in format strings, depending on
@@ -394,6 +637,19 @@ printf ("<replaceable>format string</replaceable>\n", <replaceable>argument</rep
<note>
<title>Note</title>
+<indexterm>
+<primary><command>printf()</command></primary>
+<secondary>syntax and format</secondary>
+</indexterm>
+
+<indexterm>
+<primary>syntax and format</primary>
+<secondary><command>printf()</command></secondary>
+</indexterm>
+<indexterm>
+<primary>format and syntax</primary>
+<secondary><command>printf()</command></secondary>
+</indexterm>
<para>Semantically, the SystemTap <command>printf</command> function is
very similar to its C language counterpart. The aforementioned syntax
and format for SystemTap's <command>printf</command> function is
@@ -437,7 +693,25 @@ hald(2360) open
</screen>
<formalpara id="systemtapscript-functions">
- <title>SystemTap Functions</title>
+ <title>SystemTap Functions</title>
+<indexterm>
+<primary>functions</primary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap script functions</primary>
+</indexterm>
+
+<indexterm>
+ <primary>Handlers</primary>
+ <secondary>handler functions</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>handler functions</primary>
+ <secondary>Handlers</secondary>
+</indexterm>
+
<para>
SystemTap supports a wide variety of functions that can be used as
<command>printf ()</command> arguments. <xref linkend="syscall-open"/>
@@ -448,6 +722,10 @@ hald(2360) open
</formalpara>
<remark>is "handler function" an appropriate term? wcohen: use "SystemTap functions" to match up language in man pages</remark>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+</indexterm>
<para>The following is a list of commonly-used SystemTap functions:</para>
<variablelist>
@@ -455,6 +733,24 @@ hald(2360) open
<varlistentry>
<term>tid()</term>
<listitem>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>tid()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>tid()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>tid()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
+
<para>The ID of the current thread.</para>
</listitem>
</varlistentry>
@@ -462,6 +758,23 @@ hald(2360) open
<varlistentry>
<term>uid()</term>
<listitem>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>uid()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>uid()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>uid()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
<para>The ID of the current user.</para>
</listitem>
</varlistentry>
@@ -469,6 +782,23 @@ hald(2360) open
<varlistentry>
<term>cpu()</term>
<listitem>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>cpu()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>cpu()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>cpu()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
<para>The current CPU number.</para>
</listitem>
</varlistentry>
@@ -476,6 +806,24 @@ hald(2360) open
<varlistentry>
<term>gettimeofday_s()</term>
<listitem>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>gettimeofday_s()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>gettimeofday_s()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>gettimeofday_s()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
+
<para>The number of seconds since UNIX epoch (January 1, 1970).</para>
</listitem>
</varlistentry>
@@ -491,6 +839,23 @@ hald(2360) open
<varlistentry>
<term>pp()</term>
<listitem>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>pp()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>pp()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>pp()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
<para>A string describing the probe point currently being handled.</para>
</listitem>
</varlistentry>
@@ -506,7 +871,24 @@ hald(2360) open
<varlistentry>
<term>thread_indent()</term>
<listitem>
- <para>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>thread_indent()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>thread_indent()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>thread_indent()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
+ <para>
This particular function is quite useful, providing you with a way
to better organize your print results. When used with an indentation
parameter (for example, <command>-1</command>), it allows the probe
@@ -584,6 +966,23 @@ that thread_indent is defined in tapsets as a special function of sorts</remark>
<varlistentry>
<term>name</term>
<listitem>
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><command>name</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><command>name</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><command>name</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
<para>Identifies the name of a specific system call. This function can
only be used in probes that use the event
<command>syscall.<replaceable>system_call</replaceable></command>.
@@ -594,7 +993,25 @@ that thread_indent is defined in tapsets as a special function of sorts</remark>
<varlistentry>
<term>target()</term>
<listitem>
- <para>
+
+<indexterm>
+<primary>Handlers</primary>
+<secondary>handler functions</secondary>
+<tertiary><comamnd>target()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary>handler functions</primary>
+<secondary>Handlers</secondary>
+<tertiary><comamnd>target()</command></tertiary>
+</indexterm>
+
+<indexterm>
+<primary><comamnd>target()</command></primary>
+<secondary>Handlers</secondary>
+<tertiary>handler functions</tertiary>
+</indexterm>
+ <para>
Used in conjunction with <command>stap
<replaceable>script</replaceable> -x <replaceable>process
ID</replaceable></command> or <command>stap
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 2cdfd58f..4e63ac4e 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
@@ -7,14 +7,30 @@
<remark>
Short summary; probes, handlers, events
</remark>
+<indexterm>
+<primary>Understanding How SystemTap Works</primary>
+</indexterm>
+
- <para>
+<para>
SystemTap allows users to write and reuse simple scripts to deeply
examine the activities of a running Linux system. These scripts can be
designed to extract data, filter it, and summarize it quickly (and
safely), enabling the diagnosis of complex performance (or even
functional) problems.
</para>
+<indexterm>
+<primary>Understanding How SystemTap Works</primary>
+<secondary>events and handlers</secondary>
+</indexterm>
+
+<indexterm>
+<primary>events and handlers</primary>
+</indexterm>
+<indexterm>
+ <primary>handlers and events</primary>
+</indexterm>
+
<para>The essential idea behind a SystemTap script is to name
<emphasis>events</emphasis>, and to give them
@@ -22,6 +38,15 @@
monitors for the event; once the event occurs, the Linux kernel then runs
the handler as a quick sub-routine, then resumes.
</para>
+<indexterm>
+<primary>Understanding How SystemTap Works</primary>
+<secondary>event types</secondary>
+</indexterm>
+
+<indexterm>
+<primary>event types</primary>
+<secondary>Understanding How SystemTap Works</secondary>
+</indexterm>
<para>
There are several kind of events; entering/exiting a function, timer
@@ -45,7 +70,18 @@
** add design advantages? e.g. "building kmods on-the-fly allows safer
execution of script etc etc"
</remark>
-
+<indexterm>
+<primary>Understanding How SystemTap Works</primary>
+<secondary>architecture</secondary>
+</indexterm>
+
+<indexterm>
+<primary>architecture of SystemTap</primary>
+</indexterm>
+
+<indexterm>
+ <primary>SystemTap architecture</primary>
+</indexterm>
<para>
A SystemTap session begins when you run a SystemTap script. This
session occurs in the following fashion:
@@ -53,7 +89,17 @@
<procedure id="systemtapsession">
<title>SystemTap Session</title>
-
+<indexterm>
+<primary>Understanding How SystemTap Works</primary>
+<secondary>SystemTap sessions</secondary>
+</indexterm>
+
+<indexterm>
+<primary>SystemTap sessions</primary>
+</indexterm>
+<indexterm>
+ <primary>sessions, SystemTap</primary>
+</indexterm>
<step>
<para>
First, SystemTap checks the script against the existing tapset library
@@ -121,7 +167,10 @@
-->
<section id="understanding-tapsets">
<title>Tapsets</title>
-
+<indexterm>
+<primary>Tapsets</primary>
+<secondary>definition of</secondary>
+</indexterm>
<remark>
definition, significance, difference with stap scripts (previous section),
library of tapsets in system: location
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml b/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml
index f1637356..2b5384c4 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml
@@ -7,14 +7,18 @@
<remark>
short intro, contents of chapter
</remark>
+ <indexterm>
+ <primary>Using SystemTap</primary>
+ </indexterm>
+
<para>
This chapter instructs users how to install SystemTap, and provides an introduction on how to run SystemTap scripts.
</para>
<xi:include href="Installation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="CrossInstrumenting.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<section id="using-usage">
- <title>Usage</title>
+ <title>Running SystemTap Scripts</title>
<remark>
- basic commands (e.g. stap), useful options per command (e.g. stap -vv), tool references (man pages, related kernel-doc), references within book (i.e. errors chapter)
</remark>
@@ -25,6 +29,36 @@
<!--
<remark>- Tapsets: short intro on usage</remark>
-->
+<indexterm>
+<primary>Usage</primary>
+<secondary>running SystemTap scripts</secondary>
+</indexterm>
+
+<indexterm>
+<primary>running SystemTap scripts</primary>
+<secondary>Usage</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>Usage</primary>
+ <secondary>stap</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>stap</primary>
+ <secondary>Usage</secondary>
+</indexterm>
+<!-- next 2 indexterms for staprun -->
+
+<indexterm>
+ <primary>Usage</primary>
+ <secondary>staprun</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>staprun</primary>
+ <secondary>Usage</secondary>
+</indexterm>
<para>
SystemTap scripts are run through the command <command>stap</command>. <command>stap</command> can run SystemTap scripts from standard input or from file.
</para>
@@ -38,6 +72,10 @@
<!--<formalpara>
<title>stapdev and stapusr</title>-->
+
+<indexterm>
+<primary>SystemTap scripts, how to run</primary>
+</indexterm>
<para>Running <command>stap</command> and <command>staprun</command> requires elevated privileges to the system. However, not all users can be granted root access just to run SystemTap. In some cases, for instance, you may want to allow a non-privileged user to run SystemTap instrumentation on his machine.</para>
<!-- </formalpara> -->
@@ -48,6 +86,15 @@
<varlistentry>
<term>stapdev</term>
<listitem>
+<indexterm>
+<primary>Usage</primary>
+<secondary>stapdev</secondary>
+</indexterm>
+
+<indexterm>
+<primary>stapdev</primary>
+<secondary>Usage</secondary>
+</indexterm>
<para>
Members of this group can use <command>stap</command> to run SystemTap scripts, or <command>staprun</command> to run SystemTap instrumentation modules.
</para>
@@ -67,6 +114,15 @@
<varlistentry>
<term>stapusr</term>
<listitem>
+<indexterm>
+<primary>Usage</primary>
+<secondary>stapusr</secondary>
+</indexterm>
+
+<indexterm>
+<primary>stapusr</primary>
+<secondary>Usage</secondary>
+</indexterm>
<para>
Members of this group can only run <command>staprun</command> to run SystemTap instrumentation modules. In addition, they can only run those modules from <filename>/lib/modules/<replaceable>kernel_version</replaceable>/systemtap/</filename>. Note that this directory must be owned only by the root user, and must only be writable by the root user.
</para>
@@ -77,9 +133,21 @@
<para> Below is a list of commonly used <command>stap</command> options: </para>
-
+<indexterm>
+<primary>Usage</primary>
+<secondary>options, stap</secondary>
+</indexterm>
+
+<indexterm>
+<primary>options, stap</primary>
+<secondary>Usage</secondary>
+</indexterm>
<variablelist>
+<indexterm>
+<primary>stap options</primary>
+</indexterm>
+
<varlistentry>
<term>-v</term>
<listitem>
@@ -129,7 +197,18 @@
</variablelist>
<para>You can also instruct <command>stap</command> to run scripts from standard input using the switch <command>-</command>. To illustrate:</para>
-
+<indexterm>
+ <primary>Usage</primary>
+ <secondary>standard input, running scripts from</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>standard input, running scripts from</primary>
+ <secondary>Usage</secondary>
+</indexterm>
+<indexterm>
+ <primary>running scripts from standard input</primary>
+</indexterm>
<example id="stdinstap">
<title>Running Scripts From Standard Input</title>
<programlisting>