mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
Collect the bits of wisdom about dtrace installation in the installation
chapter rather than scattering them across several incomplete fragments. (This makes the documentation consistent with the backported FAQ_Solaris.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.267 2006/12/01 21:17:51 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.267.2.1 2006/12/12 16:07:41 petere Exp $ -->
|
||||||
|
|
||||||
<chapter id="installation">
|
<chapter id="installation">
|
||||||
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
||||||
@@ -1039,6 +1039,19 @@ su - postgres
|
|||||||
specified in the environment variable
|
specified in the environment variable
|
||||||
<envar>DTRACEFLAGS</envar>.
|
<envar>DTRACEFLAGS</envar>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
To include DTrace support in a 64-bit binary, specify
|
||||||
|
<literal>DTRACEFLAGS="-64"</> to configure. For example,
|
||||||
|
using the GCC compiler:
|
||||||
|
<screen>
|
||||||
|
./configure CC='gcc -m64' --enable-dtrace DTRACEFLAGS='-64' ...
|
||||||
|
</screen>
|
||||||
|
Using Sun's compiler:
|
||||||
|
<screen>
|
||||||
|
./configure CC='/opt/SUNWspro/bin/cc -xtarget=native64' --enable-dtrace DTRACEFLAGS='-64' ...
|
||||||
|
</screen>
|
||||||
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.40 2006/12/02 00:42:54 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.40.2.1 2006/12/12 16:07:42 petere Exp $ -->
|
||||||
|
|
||||||
<chapter id="monitoring">
|
<chapter id="monitoring">
|
||||||
<title>Monitoring Database Activity</title>
|
<title>Monitoring Database Activity</title>
|
||||||
@@ -824,29 +824,14 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="compiling-for-trace">
|
<sect2 id="compiling-for-trace">
|
||||||
<title>Compiling for Dynamic Trace</title>
|
<title>Compiling for Dynamic Tracing</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
By default, trace points are disabled, so you will need to
|
By default, trace points are disabled, so you will need to
|
||||||
explicitly tell the configure script to make the probes available
|
explicitly tell the configure script to make the probes available
|
||||||
in <productname>PostgreSQL</productname>. To include DTrace support
|
in <productname>PostgreSQL</productname>. To include DTrace support
|
||||||
in a 32-bit binary, specify <option>--enable-dtrace</> to configure.
|
specify <option>--enable-dtrace</> to configure. See <xref
|
||||||
For example:
|
linkend="install-procedure"> for further information.
|
||||||
<programlisting>
|
|
||||||
$ ./configure --enable-dtrace ...
|
|
||||||
</programlisting>
|
|
||||||
To include DTrace support in a 64-bit binary, specify
|
|
||||||
<option>--enable-dtrace</>
|
|
||||||
and <literal>DTRACEFLAGS="-64"</> to configure. For example,
|
|
||||||
using the gcc compiler:
|
|
||||||
<programlisting>
|
|
||||||
$ ./configure CC='gcc -m64' --enable-dtrace DTRACEFLAGS='-64' ...
|
|
||||||
</programlisting>
|
|
||||||
Using Sun's compiler:
|
|
||||||
<programlisting>
|
|
||||||
$ ./configure CC='/path_to_sun_compiler/cc -xtarget=native64' --enable-dtrace DTRACEFLAGS='-64' ...
|
|
||||||
</programlisting>
|
|
||||||
</para>
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="trace-points">
|
<sect2 id="trace-points">
|
||||||
@@ -855,7 +840,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
<para>
|
<para>
|
||||||
A few standard trace points are provided in the source code
|
A few standard trace points are provided in the source code
|
||||||
(of course, more can be added as needed for a particular problem).
|
(of course, more can be added as needed for a particular problem).
|
||||||
These are:
|
These are shown in <xref linkend="trace-point-table">.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<table id="trace-point-table">
|
<table id="trace-point-table">
|
||||||
@@ -974,15 +959,14 @@ postgresql$1:::transaction-commit
|
|||||||
Note how the double underline in trace point names needs to
|
Note how the double underline in trace point names needs to
|
||||||
be replaced by a hyphen when using D script.
|
be replaced by a hyphen when using D script.
|
||||||
When executed, the example D script gives output such as:
|
When executed, the example D script gives output such as:
|
||||||
<programlisting>
|
<screen>
|
||||||
# ./txn_count.d `pgrep -n postgres`
|
# ./txn_count.d `pgrep -n postgres`
|
||||||
^C
|
^C
|
||||||
|
|
||||||
Start 71
|
Start 71
|
||||||
Commit 70
|
Commit 70
|
||||||
Abort 1
|
|
||||||
Total time (ns) 2312105013
|
Total time (ns) 2312105013
|
||||||
</programlisting>
|
</screen>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You should remember that trace programs need to be carefully written and
|
You should remember that trace programs need to be carefully written and
|
||||||
@@ -999,7 +983,7 @@ Total time (ns) 2312105013
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
New trace points can be defined within the code wherever the developer
|
New trace points can be defined within the code wherever the developer
|
||||||
desires, though this will require a re-compile.
|
desires, though this will require a recompilation.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -1009,14 +993,14 @@ Total time (ns) 2312105013
|
|||||||
occurrence of an event can be achieved with a single line, using
|
occurrence of an event can be achieved with a single line, using
|
||||||
just the trace point name, e.g.
|
just the trace point name, e.g.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
PG_TRACE (my__new__trace__point);
|
PG_TRACE (my__new__trace__point);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
More complex trace points can be provided with one or more variables
|
More complex trace points can be provided with one or more variables
|
||||||
for inspection by the dynamic tracing utility by using the
|
for inspection by the dynamic tracing utility by using the
|
||||||
<literal>PG_TRACE</><replaceable>n</> macro that corresponds to the number
|
<literal>PG_TRACE</><replaceable>n</> macro that corresponds to the number
|
||||||
of parameters after the trace point name:
|
of parameters after the trace point name:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
PG_TRACE3 (my__complex__event, varX, varY, varZ);
|
PG_TRACE3 (my__complex__event, varX, varY, varZ);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
The definition of the transaction__start trace point is shown below:
|
The definition of the transaction__start trace point is shown below:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@@ -1055,7 +1039,7 @@ provider postgresql {
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
You should take care that the datatypes specified for the probe arguments
|
You should take care that the data types specified for the probe arguments
|
||||||
match the datatypes of the variables used in the <literal>PG_TRACE</>
|
match the datatypes of the variables used in the <literal>PG_TRACE</>
|
||||||
macro. This is not checked at compile time. You can check that your newly
|
macro. This is not checked at compile time. You can check that your newly
|
||||||
added trace point is available by recompiling, then running the new binary,
|
added trace point is available by recompiling, then running the new binary,
|
||||||
|
Reference in New Issue
Block a user