diff options
author | ddomingo <ddomingo@redhat.com> | 2008-09-10 16:25:23 +1000 |
---|---|---|
committer | ddomingo <ddomingo@redhat.com> | 2008-09-10 16:25:23 +1000 |
commit | 63265337e2b74c4a34fb9b4d67d0a695c88e7d5e (patch) | |
tree | 76a55be53e3379dad3f375bdd26e4ffdc2210237 /doc/SystemTap_Beginners_Guide | |
parent | 23b3bb31858e54b8a10ad570a3bc8ad49487d725 (diff) | |
download | systemtap-steved-63265337e2b74c4a34fb9b4d67d0a695c88e7d5e.tar.gz systemtap-steved-63265337e2b74c4a34fb9b4d67d0a695c88e7d5e.tar.xz systemtap-steved-63265337e2b74c4a34fb9b4d67d0a695c88e7d5e.zip |
added new content for Understanding, events
Diffstat (limited to 'doc/SystemTap_Beginners_Guide')
-rw-r--r-- | doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml | 3 | ||||
-rw-r--r-- | doc/SystemTap_Beginners_Guide/en-US/Introduction.xml | 11 | ||||
-rw-r--r-- | doc/SystemTap_Beginners_Guide/en-US/Scripts.xml | 106 |
3 files changed, 106 insertions, 14 deletions
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml b/doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml index 0058f768..09530ccc 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml @@ -5,10 +5,9 @@ <bookinfo id="SystemTap_Beginners_Guide"> <title>SystemTap Beginners Guide</title> <subtitle>For use with Red Hat Enterprise Linux 5</subtitle> - <issuenum>0.1</issuenum> <edition>1.0</edition> <productname>Red Hat Enterprise Linux</productname> - <productnumber>5</productnumber> + <productnumber>5.3</productnumber> <pubsnumber>1</pubsnumber> <abstract><para>This guide provides basic instructions on how to use SystemTap to monitor different subsystems of &PRODUCT; in finer detail. The <citetitle>SystemTap Beginners Guide</citetitle> is recommended for users who have taken <ulink url="https://www.redhat.com/courses/rh133_red_hat_linux_system_administration_and_rhct_exam/">RHCT</ulink> or have a similar level of expertise in &PRODUCT;.</para></abstract> <corpauthor> diff --git a/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml b/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml index f60ab2f3..6f1b2a0a 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Introduction.xml @@ -19,13 +19,13 @@ --> <section id="goals"> <title>Goals</title> - <para>The goal of SystemTap is to provide infrastructure to monitor the running Linux kernel for detailed analysis. This can assist in identifying the underlying cause of a performance or functional problem.</para> + <para>SystemTap provides the infrastructure to monitor the running Linux kernel for detailed analysis. This can assist in identifying the underlying cause of a performance or functional 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 you to gather the same information by simply running its suite of tools against specific <firstterm>tapsets</firstterm> or SystemTap scripts.</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 its suite of tools against specific <firstterm>tapsets</firstterm> or SystemTap scripts.</para> <para>However, SystemTap was initially designed for users with intermediate to advanced knowledge of the kernel. This could present a steep learning curve for administrators or developers whose knowledge of the Linux kernel is little to none.</para> - <para>In line with that, the main goal of the <citetitle>SystemTap Beginner's Guide</citetitle> is two-fold:</para> + <para>In line with that, the main goals of the <citetitle>SystemTap Beginner's Guide</citetitle> are as follows:</para> <itemizedlist> <listitem><para>To introduce users to SystemTap, familiarize them with its architecture, and provide setup instructions for all kernel types.</para></listitem> @@ -34,15 +34,16 @@ </itemizedlist> <!-- </formalpara> --> <remark>above, Short description on the underlying goals of SystemTap_Beginners_Guide, what we want to teach users.</remark> -</section> +</section> +<!-- <section id="intro-usage"> <title>Usage</title> <remark> This section describes the practical uses of SystemTap, at a conceptual level. What a beginner can use SystemTap for, and what an advanced user can use SystemTap for. </remark> </section> - + --> <section id="intro-systemtap-vs-others"> <title>SystemTap Versus Other Monitoring Tools</title> <remark> diff --git a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml index abb087bc..24ab8a83 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml @@ -6,7 +6,7 @@ <title>SystemTap Scripts</title> <para> - For the most part, SystemTap scripts are the foundation of each SystemTap session. The SystemTap scripts you use or write yourself instruct SystemTap on what type of information to trap, and what to do once that information is trapped. + For the most part, SystemTap scripts are the foundation of each SystemTap session. SystemTap scripts instruct SystemTap on what type of information to trap, and what to do once that information is trapped. </para> <para> @@ -15,7 +15,7 @@ <note> <title>Note</title> - <para>An event and its corresponding handler is collectively called a <emphasis>probe</emphasis>. A SystemTap script can have multiple probes, in the same manner that each event can have multiple corresponding handlers.</para> + <para>An event and its corresponding handler is collectively called a <emphasis>probe</emphasis>. A SystemTap script can have multiple probes.</para> </note> <para> @@ -26,13 +26,105 @@ SystemTap scripts go one step further by allowing you more flexibility with regard to handlers. Events serve as the triggers for handlers to run; handlers can be specified to trap specified data and print it in a certain manner. </para> +<formalpara id="scriptformats"> + <title>Format</title> + <para> + SystemTap scripts use the file extension <filename>.stp</filename>, and are written in the following format: + </para> +</formalpara> +<screen> +probe <replaceable>[event]</replaceable>, +<replaceable>[another event]</replaceable> + +{ + <replaceable>[handler]</replaceable> + + exit() +} +</screen> + <para>The <replaceable>exit()</replaceable> condition is optional, but it is recommended since it safely terminates the session once the script successfully traps the required information.</para> +<important> + <title>Important</title> + <para> + <xref linkend="scripts"/> is designed to introduce readers to the basics of SystemTap scripts. To understand SystemTap scripts better, it is advisable that you refer to <xref linkend="useful-systemtap-scripts"/>; each section therein provides a detailed explanation of the script, its events, handlers, and expected output. + </para> +</important> + <section id="systemtapscript-events"> + <title>Events</title> + +<para> + SystemTap supports multiple events per probe; as shown in <xref linkend="scriptformats"/>, multiple events are delimited by a comma (<command>,</command>). Sample <replaceable>[event]</replaceable>s include:</para> + +<variablelist> + +<varlistentry> + <term>begin</term> + <listitem> + <para>The startup of a SystemTap session; i.e. as soon as the SystemTap script is run.</para> + </listitem> +</varlistentry> + +<varlistentry> + <term>end</term> + <listitem> + <para>The end of a SystemTap session.</para> + </listitem> +</varlistentry> + +<varlistentry> + <term>kernel.function("<replaceable>[function]</replaceable>")</term> + <listitem> + <para>The entry to the kernel function <replaceable>function</replaceable>. For example, <command>kernel.function("sys_open")</command> refers to the "event" that the kernel function <command>sys_open</command> is used. To specify the <emphasis>return</emphasis> of the kernel function <command>sys_open</command>, append the <command>return</command> string to the event statement; i.e. <command>kernel.function("sys_open").return</command>.</para> + + <para>When defining functions, you can use asterisk (<command>*</command>) for wildcards. You can also trace the entry/exit of a function in a kernel source file. Consider the following example:</para> +<example id="wildcards"><title>Wildcards and Kernel Source Files in an Event</title> +<programlisting> +probe kernel.function("*@net/socket.c") { } +probe kernel.function("*@net/socket.c").return { } +</programlisting> +</example> + +<para>In the previous example, the first probe's event specifies the entry of ALL functions in the kernel source file <filename>net/socket.c</filename>. The second probe specifies the exit of all those functions. Note that in this example, no handler was specified; as such, no information will be displayed.</para> + </listitem> +</varlistentry> + +<varlistentry> + <term>syscall.<replaceable>[system_call]</replaceable></term> + <listitem> + <para>The entry to the system call <replaceable>[system_call]</replaceable>. Similar to <command>kerne.function</command>, appending a <command>return</command> to the statement specifies the exit of the system call. For example, to specify the entry of the system call <command>close</command>, use <command>syscall.close.return</command>.</para> + + <para>To identify what system calls are made by a specific program/command, use <command>strace <replaceable>command</replaceable></command>.</para> + </listitem> +</varlistentry> +<!-- +<varlistentry> + <term></term> + <listitem> + <para></para> + </listitem> +</varlistentry> +--> + +</variablelist> + + + </section> + + <section id="systemtapscript-handlers"> + <title>Handlers</title> + +<para> + SystemTap supports a wide variety of functions that can trap data when triggered by events. One way to display these functions is to use the <command>print()</command> +</para> + +<!-- +<para> + <xref linkend="wildcards"/> illustrates an example of a SystemTap script that contains no handlers. SystemTap will still be able to run the script, but no information will be displayed. +</para> +--> + - <section id="systemtapscript-format"> - <title>Format</title> - <para> - SystemTap scripts use the following format: - </para> </section> <!-- <section id="SystemTap_Beginners_Guide-Test-Section_2_Test"> |