White space fix only. Translators can ignore.

Sponsored by:	iXsystems
This commit is contained in:
Dru Lavigne 2014-04-15 17:45:54 +00:00
parent a1c9a8f7d4
commit 4ea28ab6bf
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44565

View file

@ -41,18 +41,18 @@ that might make this chapter too large.
kernel and in userland programs.</para>
<para>&dtrace; is a remarkable profiling tool, with an impressive
array of features for diagnosing system issues. It may also
be used to run pre-written scripts to take advantage of its
capabilities. Users can author their own utilities using
the &dtrace; D Language, allowing them to customize their
profiling based on specific needs.</para>
array of features for diagnosing system issues. It may also be
used to run pre-written scripts to take advantage of its
capabilities. Users can author their own utilities using the
&dtrace; D Language, allowing them to customize their profiling
based on specific needs.</para>
<para>The &os; implementation in provides full support for kernel
&dtrace; and experimental
support for userland &dtrace;. Userland &dtrace; allows users to
perform function boundary tracing for userland programs using
the <literal>pid</literal> provider, and to insert static probes
into userland programs for later tracing. Some ports, such as
&dtrace; and experimental support for userland &dtrace;.
Userland &dtrace; allows users to perform function boundary
tracing for userland programs using the <literal>pid</literal>
provider, and to insert static probes into userland programs for
later tracing. Some ports, such as
<package>databases/postgres-server</package> and
<package>lang/php5</package> have a &dtrace; option to enable
static probes. &os; 10.0-RELEASE has reasonably good userland
@ -85,8 +85,8 @@ that might make this chapter too large.
</listitem>
<listitem>
<para>Have some familiarity with security and how it
pertains to &os; (<xref linkend="security"/>).</para>
<para>Have some familiarity with security and how it pertains
to &os; (<xref linkend="security"/>).</para>
</listitem>
</itemizedlist>
</sect1>
@ -106,12 +106,12 @@ that might make this chapter too large.
automatically loaded when <command>dtrace</command> is
run.</para>
<para>&os; uses the <literal>DDB_CTF</literal> kernel option
to enable support for loading <acronym>CTF</acronym>
data from kernel modules and the kernel itself.
<acronym>CTF</acronym> is the &solaris; Compact C Type Format
which encapsulates a reduced form of debugging information
similar to <acronym>DWARF</acronym> and the venerable stabs.
<para>&os; uses the <literal>DDB_CTF</literal> kernel option to
enable support for loading <acronym>CTF</acronym> data from
kernel modules and the kernel itself. <acronym>CTF</acronym> is
the &solaris; Compact C Type Format which encapsulates a reduced
form of debugging information similar to
<acronym>DWARF</acronym> and the venerable stabs.
<acronym>CTF</acronym> data is added to binaries by the
<command>ctfconvert</command> and <command>ctfmerge</command>
build tools. The <command>ctfconvert</command> utility parses
@ -122,8 +122,8 @@ that might make this chapter too large.
<para>Some different providers exist for &os; than for &solaris;.
Most notable is the <literal>dtmalloc</literal> provider, which
allows tracing <function>malloc()</function> by type in the
&os; kernel. Some of the providers found in &solaris;, such as
allows tracing <function>malloc()</function> by type in the &os;
kernel. Some of the providers found in &solaris;, such as
<literal>cpc</literal> and <literal>mib</literal>, are not
present in &os;. These may appear in future versions of &os;.
Moreover, some of the providers available in both operating
@ -139,9 +139,9 @@ that might make this chapter too large.
<filename>/dev/dtrace/dtrace</filename> is strictly limited to
<systemitem class="username">root</systemitem>.</para>
<para>&dtrace; falls under the Common Development and
Distribution License (<acronym>CDDL</acronym>) license. To view
this license on &os;, see
<para>&dtrace; falls under the Common Development and Distribution
License (<acronym>CDDL</acronym>) license. To view this license
on &os;, see
<filename>/usr/src/cddl/contrib/opensolaris/OPENSOLARIS.LICENSE</filename>
or view it online at <uri
xlink:href="http://www.opensolaris.org/os/licensing">http://www.opensolaris.org/os/licensing</uri>.
@ -164,78 +164,73 @@ that might make this chapter too large.
<programlisting>options KDTRACE_HOOKS
options DDB_CTF</programlisting>
<para>Users of the AMD64 architecture should also add this
line:</para>
<para>Users of the AMD64 architecture should also add this
line:</para>
<programlisting>options KDTRACE_FRAME</programlisting>
<programlisting>options KDTRACE_FRAME</programlisting>
<para>This option provides support for
<acronym>FBT</acronym>. While &dtrace; will work without
this option, there will be limited support for
function boundary tracing.</para>
<para>This option provides support for <acronym>FBT</acronym>.
While &dtrace; will work without this option, there will be
limited support for function boundary tracing.</para>
<para>Once the &os; system has rebooted into the new kernel, or
the &dtrace; kernel modules have been loaded using
<command>kldload dtraceall</command>, the system will
have support for the Korn shell. This
is needed as the &dtrace; Toolkit has several utilities written
in <command>ksh</command>. Make sure that the
<package>shells/ksh93</package> package or port is installed.
It is also
possible to run these tools under
<command>kldload dtraceall</command>, the system will have
support for the Korn shell. This is needed as the &dtrace;
Toolkit has several utilities written in <command>ksh</command>.
Make sure that the <package>shells/ksh93</package> package or
port is installed. It is also possible to run these tools under
<package>shells/pdksh</package> or
<package>shells/mksh</package>.</para>
<para>Finally, obtain the current &dtrace; Toolkit.
FreeBSD 10 includes the &dtrace; Toolkit
in <filename>/usr/share/dtrace</filename>.
Otherwise, install the &dtrace; Toolkit using the
<para>Finally, obtain the current &dtrace; Toolkit. FreeBSD 10
includes the &dtrace; Toolkit in
<filename>/usr/share/dtrace</filename>. Otherwise, install the
&dtrace; Toolkit using the
<package>sysutils/DTraceToolkit</package> package or
port.</para>
<para>The &dtrace; Toolkit includes many scripts in the special
language of &dtrace;. This language is called the D
language and it is very similar
to C++. An in depth discussion of the language is beyond the
scope of this document. It is extensively discussed at <uri
language of &dtrace;. This language is called the D language
and it is very similar to C++. An in depth discussion of the
language is beyond the scope of this document. It is
extensively discussed at <uri
xlink:href="http://wikis.oracle.com/display/DTrace/Documentation">http://wikis.oracle.com/display/DTrace/Documentation</uri>.</para>
</sect1>
<sect1 xml:id="dtrace-using">
<title>Using &dtrace;</title>
<para>To view all
probes, the administrator can execute the following
command:</para>
<para>To view all probes, the administrator can execute the
following command:</para>
<screen>&prompt.root; <userinput>dtrace -l | more</userinput></screen>
<para>The &dtrace; Toolkit is a collection of ready-made scripts
for collecting system information. There are scripts
to check open files, memory, <acronym>CPU</acronym> usage, and
a lot more. Extract the scripts with the following
command:</para>
for collecting system information. There are scripts to check
open files, memory, <acronym>CPU</acronym> usage, and a lot
more. Extract the scripts with the following command:</para>
<screen>&prompt.root; <userinput>gunzip -c DTraceToolkit* | tar xvf -</userinput></screen>
<para>Change into that directory with the <command>cd</command>
and change the execution permissions on all files, designated
as those files with lower case names, to
and change the execution permissions on all files, designated as
those files with lower case names, to
<literal>755</literal>.</para>
<para>All of these scripts will need modifications to their
contents. The ones which refer to
<filename>/usr/bin/ksh</filename> need that changed to
<filename>/usr/local/bin/ksh</filename>, the others which
use <filename>/usr/bin/sh</filename> need to be altered to use
<filename>/bin/sh</filename>, and finally the ones which
use <filename>/usr/bin/perl</filename> will need altered to
use <filename>/usr/local/bin/perl</filename>.</para>
<filename>/usr/local/bin/ksh</filename>, the others which use
<filename>/usr/bin/sh</filename> need to be altered to use
<filename>/bin/sh</filename>, and finally the ones which use
<filename>/usr/bin/perl</filename> will need altered to use
<filename>/usr/local/bin/perl</filename>.</para>
<para>At the time of this writing only two of the scripts of the
&dtrace; Toolkit are fully supported in &os;:
the <filename>hotkernel</filename>
and <filename>procsystime</filename> scripts. These are the two
&dtrace; Toolkit are fully supported in &os;: the
<filename>hotkernel</filename> and
<filename>procsystime</filename> scripts. These are the two
we will explore in the following parts of this section.</para>
<para>The <filename>hotkernel</filename> is designed to identify
@ -312,11 +307,11 @@ kernel 874 0.4%
<para>The <filename>procsystime</filename> script captures and
prints the system call time usage for a given
<acronym>PID</acronym> or process name. In the following
example, a new instance of <filename>/bin/csh</filename>
was spawned. The <filename>procsystime</filename> was executed
and remained waiting while a few commands were typed on the
other incarnation of <command>csh</command>. These are the
results of this test:</para>
example, a new instance of <filename>/bin/csh</filename> was
spawned. The <filename>procsystime</filename> was executed and
remained waiting while a few commands were typed on the other
incarnation of <command>csh</command>. These are the results of
this test:</para>
<screen>&prompt.root; <userinput>./procsystime -n csh</userinput>
Tracing... Hit Ctrl-C to end...
@ -344,8 +339,8 @@ Elapsed Times for processes csh,
sigsuspend 6985124
read 3988049784</screen>
<para>As shown, the <function>read()</function> system call
seems to use the most time in nanoseconds with the
<para>As shown, the <function>read()</function> system call seems
to use the most time in nanoseconds with the
<function>getpid()</function> system call used the least amount
of time.</para>
</sect1>