diff options
author | ddomingo <ddomingo@redhat.com> | 2008-10-08 11:39:50 +1000 |
---|---|---|
committer | ddomingo <ddomingo@redhat.com> | 2008-10-08 11:39:50 +1000 |
commit | 905da6a564c4204c15e74969dd7d5ec28063cdbf (patch) | |
tree | 40a0be5b4ec3d1340faff952018a2501c672c52c /doc | |
parent | abcca478e050a2207cac91e227683741b46582fa (diff) | |
download | systemtap-steved-905da6a564c4204c15e74969dd7d5ec28063cdbf.tar.gz systemtap-steved-905da6a564c4204c15e74969dd7d5ec28063cdbf.tar.xz systemtap-steved-905da6a564c4204c15e74969dd7d5ec28063cdbf.zip |
added traceio2.stp
Diffstat (limited to 'doc')
3 files changed, 74 insertions, 6 deletions
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml index 55a9c5de..7914e79c 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml @@ -588,7 +588,7 @@ probe kernel.function(@1).return { } </programlisting> </example> -<para><xref linkend="commandlineargs"/> is similar to <xref linkend="wildcards"/> (earlier in the chapter), 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> +<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> </section> <!-- <section id="SystemTap_Beginners_Guide-Test-Section_2_Test"> diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml new file mode 100644 index 00000000..d0b91025 --- /dev/null +++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-traceio2.xml @@ -0,0 +1,67 @@ +<?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="traceio2sect"> + <title>I/O Monitoring (By Device)</title> + <para> + This section describes how to monitor I/O activity on a specific device. + </para> + +<formalpara id="traceio2"> + <title>traceio2.stp</title> +<para> +<programlisting> +probe kernel.function ("vfs_write"), + kernel.function ("vfs_read") +{ + dev_nr = $file->f_dentry->d_inode->i_sb->s_dev + inode_nr = $file->f_dentry->d_inode->i_ino + if (dev_nr == ($1 << 20 | $2)) + printf ("%s(%d) %s 0x%x\n", execname(), pid(), probefunc(), dev_nr) +} +</programlisting> +</para> +</formalpara> + +<para condition="fedora">For some kernel versions (e.g. <filename>2.6.21-1.3194.fc7</filename>, you may need to revise <xref linkend="traceio2"/> accordingly. SystemTap will output the following error if you need to do so:</para> + +<screen condition="fedora"> +semantic error: field 'f_dentry' not found +</screen> + +<para condition="fedora">If this is the case, revise <xref linkend="traceio2"/> by deleting the following lines in the script:</para> + +<programlisting condition="fedora"> + dev_nr = $file->f_dentry->d_inode->i_sb->s_dev + inode_nr = $file->f_dentry->d_inode->i_ino +</programlisting> + +<para condition="fedora">Replace those lines with:</para> + +<programlisting condition="fedora"> + dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev + inode_nr = $file->f_path->dentry->d_inode->i_ino +</programlisting> + +<para><xref linkend="traceio2"/> takes 2 arguments: the <emphasis>major</emphasis> and <emphasis>minor</emphasis> numbers of the device you wish to monitor. Its output includes the name of the process name, process ID, the function being probes (i.e. <command>vfs_read</command> or <command>vfs_write</command>), and the byte address being read from or written to.</para> + +<remark>please verify if "0x800005" is "the byte address being read from or written to"</remark> + +<para>The following example is a snippet from the output of <command>stap traceio2.stp 8 5</command>, where <command>8 5</command> is the MAJOR:MINOR device number of <filename>/dev/sda5</filename> (which we determined through <command>cat /sys/block/sda/sda5/dev</command>).</para> + +<example id="traceio2output"> + <title><xref linkend="traceio2"/> Sample Output</title> +<screen> +[...] +synergyc(3722) vfs_read 0x800005 +synergyc(3722) vfs_read 0x800005 +cupsd(2889) vfs_write 0x800005 +cupsd(2889) vfs_write 0x800005 +cupsd(2889) vfs_write 0x800005 +[...] +</screen> +</example> + </section> + + diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml index 7e724ac2..3bc44461 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml @@ -18,17 +18,18 @@ <remark>case studies and more info on some scripts here - http://sourceware.org/systemtap/wiki/WarStories</remark> - <xi:include href="Useful_Scripts-Disk.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> +<!-- <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-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-traceio.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-traceio2.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-paracallgraph.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-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="Useful_Scripts-Others.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />--> <!-- <xi:include href="" xmlns:xi="http://www.w3.org/2001/XInclude" /> --> |