]> sourceware.org Git - systemtap.git/commitdiff
new section, iotop.stp
authorddomingo <ddomingo@redhat.com>
Thu, 2 Oct 2008 13:07:01 +0000 (23:07 +1000)
committerddomingo <ddomingo@redhat.com>
Thu, 2 Oct 2008 13:07:01 +0000 (23:07 +1000)
doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml
doc/SystemTap_Beginners_Guide/en-US/Installation.xml
doc/SystemTap_Beginners_Guide/en-US/Introduction.xml
doc/SystemTap_Beginners_Guide/en-US/Scripts.xml
doc/SystemTap_Beginners_Guide/en-US/SystemTap_Beginners_Guide.xml
doc/SystemTap_Beginners_Guide/en-US/Tips_Tricks.xml
doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml
doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-disktop.xml
doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-iotop.xml [new file with mode: 0644]
doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml
doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml

index 07280100660ccd44d6e62e3e9e1cfb196c983b5b..cc451ec45ce1d92e5139adc492a65497794f2ee7 100644 (file)
@@ -77,7 +77,7 @@
        <title>Configuring a Host System and Target Systems</title>
        
 <step>
-               <para>Configure <command>yum</command> on the <emphasis>host system</emphasis> to point to a repository containing the necessary debug RPMs for the <emphasis>target kernels</emphasis>. The following <command>yum</command> repository file (which you can add to <filename>/etc/yum.repos.d/</filename> points to a popular debug RPM repository for Red Hat Enterprise Linux 5:</para>
+               <para>Configure <command>yum</command> on the <emphasis>host system</emphasis> to point to a repository containing the necessary debug RPMs for the <emphasis>target kernels</emphasis>. The following <command>yum</command> repository file (which you can add to <filename>/etc/yum.repos.d/</filename> points to a popular debug RPM repository for i386 systems running Red Hat Enterprise Linux 5:</para>
 <screen>
 [rhel-debuginfo]
 name=Red Hat Enterprise Linux $releasever - $basearch - Debug
@@ -119,10 +119,11 @@ enabled=1
 
 <note>
        <title>Note</title>
-       <para>To determine the version of a running kernel, run <command>uname -r</command>. To determine the architecture notation of a running kernel, run <command>uname -m</command>.</para>
+       <para>To determine the architecture notation of a running kernel, run <command>uname -m</command>.</para>
+<!--   <para>To determine the version of a running kernel, run <command>uname -r</command>. To determine the architecture notation of a running kernel, run <command>uname -m</command>.</para>-->
 </note>        
 
-<para>Once the the <emphasis>instrumentation module</emphasis>is compiled, copy it to the <emphasis>target system</emphasis> and load it using:</para>
+<para>Once the the <emphasis>instrumentation module</emphasis> is compiled, copy it to the <emphasis>target system</emphasis> and load it using:</para>
 
 <para><command>staprun <replaceable>instrumentation</replaceable></command></para>
 
@@ -142,6 +143,9 @@ enabled=1
 <step>
        <para>Note the version of the target system's kernel on which you wish to use SystemTap. You can do this by logging onto the target system and running <command>uname -r</command> (assuming the system is running the kernel on which you wish to use SystemTap), or by inspecting <filename>/boot</filename>.</para>
 </step>        -->
-               
+<important>
+       <title>Important</title>
+       <para>The <emphasis>host system</emphasis> must be the same architecture as the <emphasis>target system</emphasis> in order for the <emphasis>instrumentation module</emphasis> to work.</para>
+</important>   
 
        </section>      
\ No newline at end of file
index 92d40bc0fb2bc2bb091d44bad89e906bcf8029ae..0ccefa3accc8300b9c3c915683d879be6d345606 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version='1.0'?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 ]>
 
        
-<chapter id="using-setup">
+<section id="using-setup">
                <title>Setup and Installation</title>
                <remark>
                        required packages, installation thru yum, repos (?); possibly, a script to install all required packages
@@ -14,7 +14,7 @@
                </remark>       
                
                <para>
-                       To deploy SystemTap, you need to install the SystemTap packages along with the corresponding set of debug RPMs of your kernel. This means that if your system has multiple kernels installed, and you wish to use SystemTap on more than one kernel, you will need to install the debug RPMs for <emphasis>each</emphasis> of those kernels.
+                       To deploy SystemTap, you need to install the SystemTap packages along with the corresponding set of <filename>-devel</filename> and <filename>-debuginfo</filename> packages for your kernel. This means that if your system has multiple kernels installed, and you wish to use SystemTap on more than one kernel kernel, you will need to install the <filename>-devel</filename> and <filename>-debuginfo</filename> packages for <emphasis>each</emphasis> of those kernel versions.
                </para>
 <section id="installprep">
        <title>Preparing For Installation</title>
 <screen>
 uname -r
 </screen>
+<!--           
+               <para>
+                       Red Hat recommends that you configure <command>yum</command> to point to a repository that houses the necessary debuginfo packages. Otherwise, you will have to manually download the debuginfo packages yourself.
+               </para>-->
                
                <para>
-                       You will also need to configure <command>yum</command> to point to a repository that houses the necessary debug RPMs. Most debugging RPMs for Red Hat Enterprise Linux 5 can be found at the following repository:
+                       Most <filename>-debuginfo</filename> packages for Red Hat Enterprise Linux 5 can be found at the following link (under <filename><replaceable>arch</replaceable>/Debuginfo</filename>, where <filename>arch</filename> is the appropriate architecture for your system:
                </para>
                
-               <para><ulink url="ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/i386/Debuginfo/">ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/i386/Debuginfo/</ulink></para>
+               <para><ulink url="ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/">ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/</ulink></para>
                
                <remark>find any other such repository, if only for RHEL</remark>       
+               
+               
+               
        </section>                      
                        
 <section id="installproper">
@@ -55,7 +62,7 @@ uname -r
 <!--<procedure id="deployproper">
        <title>Deploying SystemTap</title>
        <step>-->
-       <para>Next, you'll need to download and install the necessary debug RPMs for your kernel. The necessary debugging RPMs for the ordinary "vanilla" kernel are as follows:</para>
+               <para>Next, you'll need to download and install the necessary  <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:</para>
        <!-- Most debugging RPMs for Red Hat Enterprise Linux 5 can be found at the following link:</para>
 
        <para>   -->
@@ -65,7 +72,7 @@ uname -r
        <listitem><para><filename>kernel-devel</filename></para></listitem>
 </itemizedlist>
 
-<para>For example, if you wish to use SystemTap on kernel version <filename>2.6.18-53.el5</filename>, then you need to download the following debugging RPMs:</para>
+<para>For example, if you wish to use SystemTap on kernel version <filename>2.6.18-53.el5</filename>, then you need to download and install the following RPMs:</para>
 
 <example id="debuggingrpmlist">
        <title>Sample List of Debugging RPMs</title>
@@ -76,23 +83,13 @@ uname -r
 </itemizedlist>
 </example>
 <!--</step>
-
-<step>-->
-       <para>Install the debugging RPMs using <command>rpm -ivh <replaceable>RPM</replaceable></command> or <command>yum localinstall <replaceable>RPM</replaceable></command>.</para>
-<!-- </step> -->
-<!--
-<step>
-       <para>
-               Restart the system, loading the appropriate kernel at the <command>grub</command> screen.
-       </para> 
-</step>        
-</procedure>-->
 </section>
 
-<!--           
+               
 <itemizedlist>
        <listitem><para><filename>systemtap</filename></para></listitem>
        <listitem><para><filename>systemtap-runtime</filename></para></listitem>
 </itemizedlist>        
                -->             
-</chapter>
\ No newline at end of file
+</section>
+</section>
\ No newline at end of file
index b19f5e48e367e88f8765b0b8747e617ea6e6b855..28abf439b26434bdb38b4e15db2ea921233f2203 100644 (file)
@@ -30,7 +30,7 @@
        <itemizedlist>
                <listitem><para>To introduce users to SystemTap, familiarize them with its architecture, and provide setup instructions for all kernel types.</para></listitem>
                
-               <listitem><para>To provide pre-written SystemTap scripts for monitoring and forensic tasks, along with instructions on how to analyze their output.</para></listitem>  
+               <listitem><para>To provide pre-written SystemTap scripts for monitoring detailed activity in different components of the system, along with instructions on how to analyze their output.</para></listitem>  
        </itemizedlist> 
 <!-- </formalpara>      -->
 <remark>above,  Short description on the underlying goals of SystemTap_Beginners_Guide, what we want to teach users.</remark>
index fec9aee71d498a0ff8f8260e3a2b6f620130e928..b928372b597f5f1f2a121587d049722638e9dea2 100644 (file)
@@ -6,7 +6,7 @@
        <title>SystemTap Scripts</title>
        
        <para>
-               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.
+               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>
        
        <para>
        <para>A probe's handler is also commonly referred to as a <emphasis>probe body</emphasis>.</para>
 </note>        
        
-       <para>
-               In terms of application development, using events and handlers is similar to inserting <command>print</command> statements in a program's sequence of commands. These <command>print</command> statements allow you to view a history of commands executed once the program is run. 
+<para>
+       In terms of application development, using events and handlers is similar to inserting diagnostic print statements in a program's sequence of commands. These diagnostic print statements allow you to view a history of commands executed once the program is run. 
        </para> 
+<!--   <para>
+               In terms of application development, using events and handlers is similar to inserting <command>print</command> statements in a program's sequence of commands. These <command>print</command> statements allow you to view a history of commands executed once the program is run. 
+       </para> -->
        
        <para>
                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. 
 </formalpara>  
 <programlisting>
 probe  <replaceable>event</replaceable>,
-<replaceable>another event</replaceable>
 
 {
        <replaceable>handler</replaceable>
-
-       exit()
 }
 </programlisting>              
-       <para>The <replaceable>exit()</replaceable> condition is optional; this condition safely terminates the session once the script successfully traps the required information the first time.</para>      
-       
+<!--
+       <para>The <replaceable>exit()</replaceable> condition is optional; this condition safely terminates the session once the script successfully collects the required information the first time.</para>   
+       -->
 <important>
        <title>Important</title>
        <para>
@@ -59,9 +60,13 @@ probe        <replaceable>event</replaceable>,
 <para>SystemTap events can be broadly classified into two types: <firstterm>synchronous</firstterm> and <firstterm>asynchronous</firstterm>.</para>
 
 <formalpara><title>Synchronous Events</title>
-       <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>A <firstterm>synchronous</firstterm> event occurs when any process executes an instruction that references a particular location in kernel code. This gives other events a reference point from which more contextual data may be available. </para>
 </formalpara>
 
+<!--<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>-->
+
 <para>Examples of synchronous events include:</para>
 
 <variablelist>
@@ -70,7 +75,7 @@ probe <replaceable>event</replaceable>,
        <listitem>
                <para>The entry to the kernel function <replaceable>function</replaceable>. For example, <command>kernel.function("sys_open")</command> refers to the "event" that occurs when the kernel function <command>sys_open</command> is called by any thread in the system. 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>
+               <para>When defining functions, you can use asterisk (<literal>*</literal>) for wildcards. You can also trace the entry or 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") { }
@@ -118,7 +123,8 @@ probe kernel.function("*@net/socket.c").return { }
        
 <formalpara>
        <title>Asynchronous Events</title>
-       <para><firstterm>Asynchronous</firstterm> events, on the other hand, do not point to any reference point. This family of probe points consists mainly of counters, timers, and similar constructs.</para>
+       <para><firstterm>Asynchronous</firstterm> events, on the other hand, occur as instructed in the probe itself, rather than waiting for a particular instruction in kernel code to be executed by a process. This family of probe points consists mainly of counters, timers, and similar constructs.</para>
+<!--   <para><firstterm>Asynchronous</firstterm> events, on the other hand, do not point to any reference point. This family of probe points consists mainly of counters, timers, and similar constructs.</para>-->
 </formalpara>
 
        <para>Examples of asynchronous events include:</para>
@@ -144,19 +150,19 @@ probe kernel.function("*@net/socket.c").return { }
 <varlistentry>
        <term>timer events</term>
        <listitem>
-               <para>An event that specifies a handler to be executed "after X number of milliseconds". For example:</para>
+               <para>An event that specifies a handler to be executed every  specified period of time. For example:</para>
                
 <example id="timer"><title>Using timer.ms</title>              
 <programlisting>
 probe timer.ms(4000)
 {
-       exit()
+       printf("hello world\n")
 }
 </programlisting>
 </example>
 
 <para>
-       <xref linkend="timer"/> is an example of a probe that allows you to terminate the script after 4000 milliseconds. Note that you can also use the following timer events:
+       <xref linkend="timer"/> is an example of a probe that prints <command>hello world</command> every 4000 milliseconds. Note that you can also use the following timer events:
 </para>
        
 <itemizedlist>
@@ -172,8 +178,12 @@ probe timer.ms(4000)
 
 </itemizedlist>
 <para>
-       When used in conjunction with another probe that traps a large quantity of data, timer events allow you to limit the information your script is collecting (and printing out).
+       When used in conjunction with another probe that collects information that updates periodically, timer events allows you to see how that information changes over time. 
 </para>        
+<!--
+<para>
+       When used in conjunction with another probe that collects a large quantity of data, timer events allow you to limit the information your script is collecting (and printing out). It is also useful for collecting periodically updating information.
+</para>        -->
                
        </listitem>     
 </varlistentry>
@@ -231,7 +241,7 @@ probe begin
 <formalpara id="printf">
        <title>printf ( ) Statements</title>
 <para>
-       The <command>printf ()</command> statement is one of the simplest functions for printing data. <command>printf ()</command> can also be used to trap data using a wide variety of SystemTap handler functions using the following format:
+       The <command>printf ()</command> statement is one of the simplest functions for printing data. <command>printf ()</command> can also be used to display data using a wide variety of SystemTap functions in the following format:
 </para>
 
 </formalpara>
@@ -288,13 +298,13 @@ hald(2360) open
 </screen>
 
 <formalpara>
-       <title>Handler Functions</title>        
-       <para>SystemTap supports a wide variety of handler functions that can be used as <command>printf ()</command> arguments. <xref linkend="syscall-open"/> uses the handler functions <command>execname()</command> (current process name) and <command>pid()</command> (current process ID).</para>
+       <title>SystemTap Functions</title>      
+       <para>SystemTap supports a wide variety of functions that can be used as <command>printf ()</command> arguments. <xref linkend="syscall-open"/> uses the SystemTap functions <command>execname()</command> (current process name) and <command>pid()</command> (current process ID).</para>
 </formalpara>          
 
-<remark>is "handler function" an appropriate term?</remark>
+<remark>is "handler function" an appropriate term? wcohen: use "SystemTap functions" to match up language in man pages</remark>
 
-       <para>The following is a list of commonly-used handler functions:</para>        
+       <para>The following is a list of commonly-used SystemTap functions:</para>      
 <variablelist>
 
 <varlistentry>
@@ -349,7 +359,7 @@ hald(2360) open
 <varlistentry>
        <term>thread_indent()</term>
        <listitem>
-               <para>This particular handler 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 to internally store an "indentation counter" for each thread (identified by ID, as in <command>tid</command>). It then returns a string with some generic trace data along with an appropriate number of indentation spaces.</para>
+               <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 to internally store an "indentation counter" for each thread (identified by ID, as in <command>tid</command>). It then returns a string with some generic trace data along with an appropriate number of indentation spaces.</para>
                
                <para>The generic data included in the returned string includes a timestamp (number of microseconds since the most recent initial indentation), a process name, and the thread ID. This allows you to identify what functions were called, who called them, and the duration of each function call.
                </para> 
@@ -405,9 +415,9 @@ probe kernel.function("*@net/socket.c").return
 -->    
 </variablelist>                
 
-<para>For more information about supported handler functions, refer to <command>man stapfuncs</command>.</para>
+<para>For more information about supported SystemTap functions, refer to <command>man stapfuncs</command>.</para>
 
-<remark>will need a complete listing of supported handler functions? also, handler function descriptions seem ambiguous, please advise.</remark>
+<remark>will need a complete listing of supported handler functions? also, SystemTap function descriptions seem ambiguous, please advise.</remark>
 
 <!--   
 <para>
index 8b8647209727b2b4cd16b1c706791fa20f61bda2..ccc979159888ae617c4ab99d1ee159ad47002eaa 100644 (file)
@@ -6,8 +6,9 @@
        <xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-       <xi:include href="Understanding_How_SystemTap_Works.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Using_SystemTap.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+       <!--<xi:include href="Installation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
+       <xi:include href="Understanding_How_SystemTap_Works.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_SystemTap_Scripts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Errors.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Tips_Tricks.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
index 0377c4992b12aa5e1167e59c110eee25a07f4895..0327962b0ea6793f78b162b2350f66f95e80e5ca 100644 (file)
@@ -4,11 +4,12 @@
 
 <chapter id="tips-tricks">
        <title>Tips and Tricks</title>
-       <remark>This chapter covers miscellaneous tips/tricks</remark>
-       
-       <remark>This is a tentative section, and will only be included if content can be provided</remark>
+       <remark>- This chapter covers miscellaneous tips/tricks</remark>
        
+       <remark>- This is a tentative section, and will only be included if content can be provided</remark>
        
+       <remark>- add use of exit() here</remark>
 
+       <remark>- add "basic constructs" here; i.e. using if/else, while loops, for loops, examples; if done, consider moving up to before Useful_SystemTap_Scripts.xm, after Understanding_How_SystemTap_Works.xml</remark>
 </chapter>
 
index 2794901c910a4a358a42443a513abf489fb31833..1fb8cfb4caf8440bb26e95645294b9967ad15468 100644 (file)
        
        <step><para>First, SystemTap checks the script against the existing tapset library (normally in <filename>/usr/share/systemtap/tapset/</filename> for any tapsets used.</para></step>
        
-       <step><para>SystemTap then translates the script to C, running the system C compiler to create a kernel module from it.</para></step>
+       <step><para>SystemTap then translates the script to C, running the system C compiler to create a kernel module from it. The tools that perform this step are contained in the <filename>systemtap</filename> package (refer to <xref linkend="installproper"/> for more information).</para></step>
        
-       <step><para>SystemTap loads the module, then enables all the probed events by "hooking" those events into the kernel.</para></step>
+       <step><para>SystemTap loads the module, then enables all the probes (events and handlers) in the script. The tools that enable this function are deployed by the <filename>systemtap-runtime</filename> package (refer to <xref linkend="installproper"/> for more information).</para></step>
                
+<!--   <step><para>SystemTap loads the module, then enables all the probed events by "hooking" those events into the kernel.</para></step>
+               -->
        <step><para>As the events occur, their corresponding handlers are executed.</para></step>
        
-       <step><para>Once the SystemTap session is terminated, the hooked events are disconnected from the kernel; afterwards, the kernel module is unloaded.</para></step>    
+       <step><para>Once the SystemTap session is terminated, the probes are disconnected from the kernel; afterwards, the kernel module is unloaded.</para></step>
+       <!--
+       <step><para>Once the SystemTap session is terminated, the hooked events are disconnected from the kernel; afterwards, the kernel module is unloaded.</para></step>-->    
 </procedure>
 
-<para>This sequence is driven from a single command-line program: <command>stap</command>. This program is SystemTap's main front-end tool. For more information about <command>stap</command>, refer to <command>man stap</command> (once SystemTap is set up on your machine).</para>
+<para>This sequence is driven from a single command-line program: <command>stap</command>. This program is SystemTap's main front-end tool. For more information about <command>stap</command>, refer to <command>man stap</command> (once SystemTap is properly installed on your machine).</para>
 
 </section>
 <xi:include href="Scripts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
index a3e3d8a71ccdbb9e4c88083325bf0323ad633800..0c191cff3e7d2b61273ec50cd69cd7e1f6985b0a 100644 (file)
@@ -3,7 +3,7 @@
 ]>
 
 
-       <section id="useful-disk-disktop">
+       <section id="disktop">
                <title>Summarizing Disk Read/Write Traffic</title>
                
                
@@ -73,7 +73,7 @@ probe timer.ms(5000) {
        }
        /* print top ten I/O */
        foreach ([process,cmd,userid,parent,action] in io_stat- limit 10)
-         printf("%8d %8d %8d %25s %8s %4s %12d\n",userid,process,parent,cmd,device[process,cmd,userid,parent,action],action,io_stat[process,cmd,userid,parent,action])
+         printf("%8d %8d %8d %25s %8s %4s %12d\n",userid,process,parent,cmd,device[process,cmd,userid,parent,action], action,io_stat[process,cmd,userid,parent,action])
 
        /* clear data */
        delete io_stat
@@ -115,18 +115,18 @@ probe end{
        <title><xref linkend="scriptdisktop"/> Sample Output</title>
 <screen>
 [...]
-Mon Sep 29 03:38:28 2008 , Average:  19Kb/sec, Read:       7Kb, Write:     89Kb\r
+Mon Sep 29 03:38:28 2008 , Average:  19Kb/sec, Read: 7Kb, Write: 89Kb
 
-UID      PID     PPID                       CMD   DEVICE    T        BYTES\r
-0    26319    26294                   firefox     sda5    W        90229\r
-0     2758     2757           pam_timestamp_c     sda5    R         8064\r
-0     2885        1                     cupsd     sda5    W         1678\r
+UID      PID     PPID                       CMD   DEVICE    T    BYTES
+0    26319    26294                   firefox     sda5    W        90229
+0     2758     2757           pam_timestamp_c     sda5    R         8064
+0     2885        1                     cupsd     sda5    W         1678
 
-Mon Sep 29 03:38:38 2008 , Average:   1Kb/sec, Read:       7Kb, Write:      1Kb\r
+Mon Sep 29 03:38:38 2008 , Average:   1Kb/sec, Read: 7Kb, Write: 1Kb
 
-UID      PID     PPID                       CMD   DEVICE    T        BYTES\r
-0     2758     2757           pam_timestamp_c     sda5    R         8064\r
-0     2885        1                     cupsd     sda5    W         1678\r
+UID      PID     PPID                       CMD   DEVICE    T    BYTES
+0     2758     2757           pam_timestamp_c     sda5    R         8064
+0     2885        1                     cupsd     sda5    W         1678
 </screen>
 </example>
 
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-iotop.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-iotop.xml
new file mode 100644 (file)
index 0000000..fe24942
--- /dev/null
@@ -0,0 +1,76 @@
+<?xml version='1.0'?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+
+       <section id="iotopsect">
+               <title>Periodically Print I/O Activity</title>
+
+       <para>This section describes how to monitor I/O activity on the system.</para>
+       
+<formalpara id="iotop">
+       <title>iotop.stp</title>
+<para>
+<programlisting>
+global reads, writes, total_io
+
+probe kernel.function("vfs_read") {
+    reads[execname()] += $count
+}
+
+probe kernel.function("vfs_write") {
+    writes[execname()] += $count
+}
+
+# print top 10 IO processes every 5 seconds
+probe timer.s(5) {
+    foreach (name in writes)
+        total_io[name] += writes[name]
+    foreach (name in reads)
+        total_io[name] += reads[name]
+    printf ("%16s\t%10s\t%10s\n", "Process", "KB Read", "KB Written")
+    foreach (name in total_io- limit 10)
+        printf("%16s\t%10d\t%10d\n", name,
+               reads[name]/1024, writes[name]/1024)
+    delete reads
+    delete writes
+    delete total_io
+    print("\n")
+}
+</programlisting>
+</para>
+</formalpara>
+
+<para><xref linkend="iotop"/> prints out the top ten executables generating I/O traffic every 5-second interval, in descending order. Its output contains the process name and the amount of data read or written by the process, in KB. For example:</para>
+
+<example id="iotopoutput">
+       <title><xref linkend="iotop"/> Sample Output</title>
+<screen>
+[...]  
+         Process           KB Read      KB Written
+            Xorg             50287               0
+         staprun              3328               0
+ multiload-apple              3039              23
+            sshd               208               1
+        floaters                14              62
+  NetworkManager                15               0
+ gnome-vfs-daemo                 8               0
+           cupsd                 3               3
+        sendmail                 4               0
+   mixer_applet2                 3               0
+
+         Process           KB Read      KB Written
+            Xorg             51886               0
+         staprun              3328               0
+ multiload-apple              3039              23
+            sshd              1344               4
+           snmpd                90               0
+        floaters                15              66
+  NetworkManager                23               0
+      irqbalance                16               0
+ pam_timestamp_c                 9               0
+        sendmail                 4               0
+</screen>
+</example>
+
+<para><xref linkend="iotopoutput"/> displays top I/O writes and reads within a random 10-second interval. Note that <xref linkend="iotop"/> is recursive, as it also detects I/O resulting from SystemTap activity &mdash; <xref linkend="iotopoutput"/> also displays reads done by <command>staprun</command>.</para>
+</section>
\ No newline at end of file
index 51fef2762e0c5eb27682ed6bd6b52eca5ccd4109..03e515ff09f10176b5393c33f1a20b2bbd2795ee 100644 (file)
        <xi:include href="Useful_Scripts-Disk.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-disktop.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-IO.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+       <xi:include href="Useful_Scripts-iotop.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-Kernel.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-Network.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-Signals.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-Syscalls.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <xi:include href="Useful_Scripts-Others.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<!--   
+       <xi:include href="" xmlns:xi="http://www.w3.org/2001/XInclude" />       
+-->
 </chapter>
 
index 8b851a494f7889c7b8c800bb8605662333d5eff0..ebf71276e54697f55cf7815c8fba3b71df442bcd 100644 (file)
        <para>
                This chapter instructs users how to install SystemTap, and provides an introduction on how to run SystemTap scripts.
        </para> 
-       
-       <section id="using-setup">
-               <title>Setup and Installation</title>
-               <remark>
-                       required packages, installation thru yum, repos (?); possibly, a script to install all required packages
-               </remark>
-               
-               <remark>
-                       notes in ~/Desktop/SystemTap/aug21chatlog and ~/Desktop/SystemTap/noted_wcohenmeeting 
-               </remark>       
-               
-               <para>
-                       To deploy SystemTap, you need to install the SystemTap packages along with the corresponding set of debug RPMs of your kernel. This means that if your system has multiple kernels installed, and you wish to use SystemTap on more than one kernel, you will need to install the debug RPMs for <emphasis>each</emphasis> of those kernels.
-               </para>
-<formalpara>
-       <title>Preparing For Installation</title>
-               <para>
-                       To view what kernels and kernel versions are installed on your system, check the contents of <filename>/boot</filename>. Each installed kernel/kernel version has a corresponding <filename>vmlinuz-<replaceable>kernel version</replaceable></filename> there.
-               </para>
-</formalpara>          
-               <para>
-                       To determine what kernel your system is currently using, use:
-               </para>
-               
-<screen>
-uname -r
-</screen>
-               
-               <para>
-                       You will also need to configure <command>yum</command> to point to a repository that houses the necessary debug RPMs. One such repository is:
-               </para>
-               
-               <para><ulink url="ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/i386/Debuginfo/">ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/i386/Debuginfo/</ulink></para>
-               
-               <remark>find any other such repository, if only for RHEL</remark>       
-                       
-                       
-<procedure id="installproper">
-       <title>Deploying SystemTap</title>
-       
-<step>
-       <para>Once you've decided which kernels you need to use SystemTap with, install the following packages:</para>
-       
-       <itemizedlist>
-               <listitem><para><filename>systemtap</filename></para></listitem>
-               <listitem><para><filename>systemtap-runtime</filename></para></listitem>
-       </itemizedlist>
-       
-       <para>This will install the SystemTap suite of tools.</para> 
-</step>
-
-<step>
-       <para>Next, you'll need to download and install the necessary debug RPMs for your kernel. Most debugging RPMs for Red Hat Enterprise Linux 5 can be found at the following link:</para>
-       
-       <para>The necessary debugging RPMs are as follows:</para>
-       
-<itemizedlist>
-       <listitem><para><filename>kernel-debuginfo</filename></para></listitem>
-       <listitem><para><filename>kernel-debuginfo-common</filename></para></listitem>
-       <listitem><para><filename>kernel-devel</filename></para></listitem>
-</itemizedlist>
-
-<para>For example, if you wish to use SystemTap on kernel version <filename>2.6.18-53.el5</filename>, then you need to download the following debugging RPMs:</para>
-
-<example id="debuggingrpmlist">
-       <title>Sample List of Debugging RPMs</title>
-<itemizedlist>
-       <listitem><para><filename>kernel-debuginfo-2.6.18-53.1.13.el5.i686.rpm</filename></para></listitem>
-       <listitem><para><filename>kernel-debuginfo-common-2.6.18-53.1.13.el5.i686.rpm</filename></para></listitem>
-       <listitem><para><filename>kernel-devel-2.6.18-53.1.13.el5.i686.rpm</filename></para></listitem>
-</itemizedlist>
-</example>
-</step>
-
-<step>
-       <para>Install the debugging RPMs using <command>rpm -ivh <replaceable>RPM</replaceable></command> or <command>yum localinstall <replaceable>RPM</replaceable></command>.</para>
-</step>
-
-<step>
-       <para>
-               Restart the system, loading the appropriate kernel at the <command>grub</command> screen.
-       </para> 
-</step>        
-</procedure>
-
-
-<!--           
-<itemizedlist>
-       <listitem><para><filename>systemtap</filename></para></listitem>
-       <listitem><para><filename>systemtap-runtime</filename></para></listitem>
-</itemizedlist>        
-               -->             
-       </section>
+       <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>
@@ -118,9 +26,18 @@ uname -r
                <remark>- Tapsets: short intro on usage</remark>
                -->
                <para>
-                       SystemTap scripts are run through the command <command>stap</command>. <command>stap</command> can run SystemTap scripts from standard input or from file. Below is a list of common options available to you: 
+                       SystemTap scripts are run through the command <command>stap</command>. <command>stap</command> can run SystemTap scripts from standard input or from file.
                </para>
                
+<important>
+       <title>Important</title>
+<para>Running SystemTap requires root privileges. As such, you need to either log in as root or configure <command>sudo</command> accordingly for specific users who need to run SystemTap (refer to <command>man sudo</command> or <command>man visudo</command> for more information.</para> 
+
+</important>
+               
+               
+               <para> Below is a list of commonly used <command>stap</command> options: </para>
+               
 <variablelist>
 
 <varlistentry>
This page took 0.058451 seconds and 5 git commands to generate.