mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
More fixes for 8.4 DTrace probes. Remove useless BUFFER_HIT/BUFFER_MISS
probes --- the BUFFER_READ_DONE probe provides the same information and more besides. Expand the LOCK_WAIT_START/DONE probe arguments so that there's actually some chance of telling what is being waited for. Update and clean up the documentation.
This commit is contained in:
parent
c242e6b6d4
commit
471913a6a5
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.319 2009/02/04 21:30:41 alvherre Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.320 2009/03/23 01:52:38 tgl Exp $ -->
|
||||||
|
|
||||||
<chapter id="installation">
|
<chapter id="installation">
|
||||||
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
||||||
@ -1305,9 +1305,10 @@ su - postgres
|
|||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>DTrace</primary>
|
<primary>DTrace</primary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
Compiles with support for the dynamic tracing tool DTrace.
|
Compiles <productname>PostgreSQL</productname> with support for the
|
||||||
Operating system support for DTrace is currently available in
|
dynamic tracing tool DTrace.
|
||||||
Solaris and Mac OS X Leopard.
|
<![%standalone-ignore[See <xref linkend="dynamic-trace">
|
||||||
|
for more information.]]>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -1315,14 +1316,14 @@ su - postgres
|
|||||||
environment variable <envar>DTRACE</envar> can be set. This
|
environment variable <envar>DTRACE</envar> can be set. This
|
||||||
will often be necessary because <command>dtrace</command> is
|
will often be necessary because <command>dtrace</command> is
|
||||||
typically installed under <filename>/usr/sbin</filename>,
|
typically installed under <filename>/usr/sbin</filename>,
|
||||||
which might not be in the path. Additional command-line
|
which might not be in the path.
|
||||||
options for the <command>dtrace</command> program can be
|
|
||||||
specified in the environment variable
|
|
||||||
<envar>DTRACEFLAGS</envar>.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
To include DTrace support in a 64-bit binary, specify
|
Extra command-line options for the <command>dtrace</command> program
|
||||||
|
can be specified in the environment variable
|
||||||
|
<envar>DTRACEFLAGS</envar>. On Solaris,
|
||||||
|
to include DTrace support in a 64-bit binary, you must specify
|
||||||
<literal>DTRACEFLAGS="-64"</> to configure. For example,
|
<literal>DTRACEFLAGS="-64"</> to configure. For example,
|
||||||
using the GCC compiler:
|
using the GCC compiler:
|
||||||
<screen>
|
<screen>
|
||||||
@ -2942,7 +2943,7 @@ LIBOBJS = snprintf.o
|
|||||||
<para>
|
<para>
|
||||||
Yes, using DTrace is possible. See <![%standalone-include[the
|
Yes, using DTrace is possible. See <![%standalone-include[the
|
||||||
documentation]]>
|
documentation]]>
|
||||||
<![%standalone-ignore[<xref linkend="monitoring">]]> for further
|
<![%standalone-ignore[<xref linkend="dynamic-trace">]]> for further
|
||||||
information. You can also find more information in this
|
information. You can also find more information in this
|
||||||
article: <ulink url="http://blogs.sun.com/robertlor/entry/user_level_dtrace_probes_in"></ulink>.
|
article: <ulink url="http://blogs.sun.com/robertlor/entry/user_level_dtrace_probes_in"></ulink>.
|
||||||
</para>
|
</para>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.64 2009/03/10 00:08:28 momjian Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.65 2009/03/23 01:52:38 tgl Exp $ -->
|
||||||
|
|
||||||
<chapter id="monitoring">
|
<chapter id="monitoring">
|
||||||
<title>Monitoring Database Activity</title>
|
<title>Monitoring Database Activity</title>
|
||||||
@ -1015,9 +1015,9 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
<para>
|
<para>
|
||||||
A number of probes or trace points are already inserted into the source
|
A number of probes or trace points are already inserted into the source
|
||||||
code. These probes are intended to be used by database developers and
|
code. These probes are intended to be used by database developers and
|
||||||
administrators. By default the probes are not compiled into the
|
administrators. By default the probes are not compiled into
|
||||||
binary, and the user needs to explicitly tell the configure script to make
|
<productname>PostgreSQL</productname>; the user needs to explicitly tell
|
||||||
the probes available in <productname>PostgreSQL</productname>.
|
the configure script to make the probes available.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -1026,9 +1026,11 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
utility is supported, which is available
|
utility is supported, which is available
|
||||||
on OpenSolaris, Solaris 10, and Mac OS X Leopard. It is expected that
|
on OpenSolaris, Solaris 10, and Mac OS X Leopard. It is expected that
|
||||||
DTrace will be available in the future on FreeBSD and possibly other
|
DTrace will be available in the future on FreeBSD and possibly other
|
||||||
operating systems. Supporting other dynamic tracing utilities is
|
operating systems. The
|
||||||
theoretically possible by changing the definitions for the macros in
|
<ulink url="http://sourceware.org/systemtap/">SystemTap</ulink> project
|
||||||
<filename>src/include/utils/probes.h</>.
|
for Linux also provides a DTrace equivalent. Supporting other dynamic
|
||||||
|
tracing utilities is theoretically possible by changing the definitions for
|
||||||
|
the macros in <filename>src/include/utils/probes.h</>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="compiling-for-trace">
|
<sect2 id="compiling-for-trace">
|
||||||
@ -1047,15 +1049,13 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
<title>Built-in Probes</title>
|
<title>Built-in Probes</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
A number of standard probes are provided in the source code, and more
|
A number of standard probes are provided in the source code,
|
||||||
can certainly be added to enhance PostgreSQL's observability. There are two categories
|
as shown in <xref linkend="dtrace-probe-point-table">.
|
||||||
of probes, those that are targeted toward database administrators and those for developers.
|
More can certainly be added to enhance PostgreSQL's observability.
|
||||||
They are shown in <xref linkend="admin-trace-point-table"> and
|
|
||||||
<xref linkend="dev-trace-point-table">.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<table id="admin-trace-point-table">
|
<table id="dtrace-probe-point-table">
|
||||||
<title>Built-in Probes for Administrators</title>
|
<title>Built-in DTrace Probes</title>
|
||||||
<tgroup cols="3">
|
<tgroup cols="3">
|
||||||
<thead>
|
<thead>
|
||||||
<row>
|
<row>
|
||||||
@ -1070,47 +1070,56 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
<row>
|
<row>
|
||||||
<entry>transaction-start</entry>
|
<entry>transaction-start</entry>
|
||||||
<entry>(LocalTransactionId)</entry>
|
<entry>(LocalTransactionId)</entry>
|
||||||
<entry>Probe that fires at the start of a new transaction. arg0 is the transaction id.</entry>
|
<entry>Probe that fires at the start of a new transaction.
|
||||||
|
arg0 is the transaction id.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>transaction-commit</entry>
|
<entry>transaction-commit</entry>
|
||||||
<entry>(LocalTransactionId)</entry>
|
<entry>(LocalTransactionId)</entry>
|
||||||
<entry>Probe that fires when a transaction completes successfully. arg0 is the transaction id.</entry>
|
<entry>Probe that fires when a transaction completes successfully.
|
||||||
|
arg0 is the transaction id.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>transaction-abort</entry>
|
<entry>transaction-abort</entry>
|
||||||
<entry>(LocalTransactionId)</entry>
|
<entry>(LocalTransactionId)</entry>
|
||||||
<entry>Probes that fires when a transaction does not complete successfully. arg0 is the transaction id.</entry>
|
<entry>Probe that fires when a transaction completes unsuccessfully.
|
||||||
|
arg0 is the transaction id.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-start</entry>
|
<entry>query-start</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires when the execution of a statement is started. arg0 is the query string.</entry>
|
<entry>Probe that fires when the processing of a query is started.
|
||||||
|
arg0 is the query string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-done</entry>
|
<entry>query-done</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires when the execution of a statement is complete. arg0 is the query string.</entry>
|
<entry>Probe that fires when the processing of a query is complete.
|
||||||
|
arg0 is the query string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-parse-start</entry>
|
<entry>query-parse-start</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires when the parsing of a query is started. arg0 is the query string.</entry>
|
<entry>Probe that fires when the parsing of a query is started.
|
||||||
|
arg0 is the query string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-parse-done</entry>
|
<entry>query-parse-done</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires when the parsing of a query is complete. arg0 is the query string.</entry>
|
<entry>Probe that fires when the parsing of a query is complete.
|
||||||
|
arg0 is the query string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-rewrite-start</entry>
|
<entry>query-rewrite-start</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires when the rewriting of a query is started. arg0 is the query string.</entry>
|
<entry>Probe that fires when the rewriting of a query is started.
|
||||||
|
arg0 is the query string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-rewrite-done</entry>
|
<entry>query-rewrite-done</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires when the rewriting of a query is complete. arg0 is the query string.</entry>
|
<entry>Probe that fires when the rewriting of a query is complete.
|
||||||
|
arg0 is the query string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>query-plan-start</entry>
|
<entry>query-plan-start</entry>
|
||||||
@ -1135,245 +1144,333 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
<row>
|
<row>
|
||||||
<entry>statement-status</entry>
|
<entry>statement-status</entry>
|
||||||
<entry>(const char *)</entry>
|
<entry>(const char *)</entry>
|
||||||
<entry>Probe that fires anytime an SQL statement is executed on the server. arg0 is the query string.</entry>
|
<entry>Probe that fires anytime the server process updates its
|
||||||
|
<structname>pg_stat_activity</>.<structfield>current_query</> status.
|
||||||
|
arg0 is the new status string.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>checkpoint-start</entry>
|
<entry>checkpoint-start</entry>
|
||||||
<entry>(int)</entry>
|
<entry>(int)</entry>
|
||||||
<entry>Probe that fires when a checkpoint is performed. arg0 holds the bitwise flags used to distinguish different checkpoints such as shutdown, immediate or force.</entry>
|
<entry>Probe that fires when a checkpoint is started.
|
||||||
|
arg0 holds the bitwise flags used to distinguish different checkpoint
|
||||||
|
types, such as shutdown, immediate or force.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>checkpoint-done</entry>
|
<entry>checkpoint-done</entry>
|
||||||
<entry>(int, int, int, int, int)</entry>
|
<entry>(int, int, int, int, int)</entry>
|
||||||
<entry>Probe that fires when a checkpoint is complete. arg0 is the number of buffers written. arg1 is the total number of buffers. arg2, arg3 and arg4 contain the number of xlog file(s) added, removed and recycled respectively.</entry>
|
<entry>Probe that fires when a checkpoint is complete.
|
||||||
|
(The probes listed next fire in sequence during checkpoint processing.)
|
||||||
|
arg0 is the number of buffers written. arg1 is the total number of
|
||||||
|
buffers. arg2, arg3 and arg4 contain the number of xlog file(s) added,
|
||||||
|
removed and recycled respectively.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>clog-checkpoint-start</entry>
|
<entry>clog-checkpoint-start</entry>
|
||||||
<entry>(bool)</entry>
|
<entry>(bool)</entry>
|
||||||
<entry>Probe that fires when the CLOG portion of the checkpoint is started. arg0 is either true or false, true for normal checkpoint, false for postmaster shutdown.</entry>
|
<entry>Probe that fires when the CLOG portion of a checkpoint is started.
|
||||||
|
arg0 is true for normal checkpoint, false for shutdown
|
||||||
|
checkpoint.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>clog-checkpoint-done</entry>
|
<entry>clog-checkpoint-done</entry>
|
||||||
<entry>(bool)</entry>
|
<entry>(bool)</entry>
|
||||||
<entry>Probe that fires when the CLOG portion of the checkpoint is complete. arg0 has the same meaning as clog-checkpoint-start.</entry>
|
<entry>Probe that fires when the CLOG portion of a checkpoint is
|
||||||
|
complete. arg0 has the same meaning as for clog-checkpoint-start.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>subtrans-checkpoint-start</entry>
|
<entry>subtrans-checkpoint-start</entry>
|
||||||
<entry>(bool)</entry>
|
<entry>(bool)</entry>
|
||||||
<entry>Probe that fires when the SUBTRANS portion of the checkpoint is started. arg0 is either true or false, true for normal checkpoint, false for postmaster shutdown.</entry>
|
<entry>Probe that fires when the SUBTRANS portion of a checkpoint is
|
||||||
|
started.
|
||||||
|
arg0 is true for normal checkpoint, false for shutdown
|
||||||
|
checkpoint.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>subtrans-checkpoint-done</entry>
|
<entry>subtrans-checkpoint-done</entry>
|
||||||
<entry>(bool)</entry>
|
<entry>(bool)</entry>
|
||||||
<entry>Probe that fires when the SUBTRANS portion of the checkpoint is complete. arg0 has the same meaning as subtrans-checkpoint-done.</entry>
|
<entry>Probe that fires when the SUBTRANS portion of a checkpoint is
|
||||||
|
complete. arg0 has the same meaning as for
|
||||||
|
subtrans-checkpoint-start.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>multixact-checkpoint-start</entry>
|
<entry>multixact-checkpoint-start</entry>
|
||||||
<entry>(bool)</entry>
|
<entry>(bool)</entry>
|
||||||
<entry>Probe that fires when the MultiXact portion of the checkpoint is started. arg0 is either true or false, true for normal checkpoint, false for postmaster shutdown.</entry>
|
<entry>Probe that fires when the MultiXact portion of a checkpoint is
|
||||||
|
started.
|
||||||
|
arg0 is true for normal checkpoint, false for shutdown
|
||||||
|
checkpoint.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>multixact-checkpoint-done</entry>
|
<entry>multixact-checkpoint-done</entry>
|
||||||
<entry>(bool)</entry>
|
<entry>(bool)</entry>
|
||||||
<entry>Probe that fires when the MultiXact portion of the checkpoint is complete. arg0 has the same meaning as multixact-checkpoint-start.</entry>
|
<entry>Probe that fires when the MultiXact portion of a checkpoint is
|
||||||
|
complete. arg0 has the same meaning as for
|
||||||
|
multixact-checkpoint-start.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-checkpoint-start</entry>
|
<entry>buffer-checkpoint-start</entry>
|
||||||
<entry>(int)</entry>
|
<entry>(int)</entry>
|
||||||
<entry>Probe that fires when the shared buffers portion of the checkpoint is started to flush out the buffers, and it's always followed by buffer-sync-start. arg0 holds the bitwise flags used to distinguish different checkpoints such as shutdown, immediate or force</entry>
|
<entry>Probe that fires when the buffer-writing portion of a checkpoint
|
||||||
</row>
|
is started.
|
||||||
<row>
|
arg0 holds the bitwise flags used to distinguish different checkpoint
|
||||||
<entry>buffer-checkpoint-sync-start</entry>
|
types, such as shutdown, immediate or force.</entry>
|
||||||
<entry>()</entry>
|
|
||||||
<entry>Probe that fires to fsync buffers to disk, and it's always preceeded by buffer-checkpoint-start, buffer-sync-start, and buffer-flush-start. The time difference between buffer-checkpoint-start and buffer-checkpoint-sync-start is the write time, and the difference between buffer-checkpoint-sync-start and buffer-checkpoint-done is the sync time.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>buffer-checkpoint-done</entry>
|
|
||||||
<entry>()</entry>
|
|
||||||
<entry>Probe that fires when the shared buffers portion of the checkpoint is complete. This probe is fired after buffer-checkpoint-sync-start.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>twophase-checkpoint-start</entry>
|
|
||||||
<entry>()</entry>
|
|
||||||
<entry>Probe that fires when the two-phase portion of the checkpoint is started.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>twophase-checkpoint-done</entry>
|
|
||||||
<entry>()</entry>
|
|
||||||
<entry>Probe that fires when the two-phase portion of the checkpoint is complete.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>buffer-hit</entry>
|
|
||||||
<entry>(bool)</entry>
|
|
||||||
<entry>Probe that fires when a read request is satisfied from the buffer cache. arg0 is either true or false, true for local buffer, false for shared buffer.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>buffer-miss</entry>
|
|
||||||
<entry>(bool)</entry>
|
|
||||||
<entry>Probe that fires when a read request requires disk access. arg0 is either true or false, true for local buffer, false for shared buffer .</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>buffer-read-start</entry>
|
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, bool)</entry>
|
|
||||||
<entry>Probe that fires when a buffer read is started. arg0 and arg1 contain the fork and block numbers. arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs respectively. arg5 is either true or false, true for local buffer, false for shared buffer.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>buffer-read-done</entry>
|
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool)</entry>
|
|
||||||
<entry>Probe that fires when a buffer read is complete. arg0 and arg1 contain the fork and block numbers. arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs respectively. arg5 is either true or false, true for local buffer, false for shared buffer. arg6 is true if buffer is found in the pool, false otherwise.</entry>
|
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-sync-start</entry>
|
<entry>buffer-sync-start</entry>
|
||||||
<entry>(int, int)</entry>
|
<entry>(int, int)</entry>
|
||||||
<entry>Probe that fires to write out all dirty buffers in the pool at checkpoint time, and it's always preceeded by buffer-checkpoint-start and followed by buffer-flush-start. arg0 is the total number of buffers. arg1 is the number it intends to write.</entry>
|
<entry>Probe that fires when we begin to write dirty buffers during
|
||||||
</row>
|
checkpoint (after identifying which buffers must be written).
|
||||||
<row>
|
arg0 is the total number of buffers.
|
||||||
<entry>buffer-sync-done</entry>
|
arg1 is the number that are currently dirty and need to be written.</entry>
|
||||||
<entry>(int, int, int)</entry>
|
|
||||||
<entry>Probe that fires when all dirty buffers have been written. arg0 is the total number of buffers. arg1 is the number actually written. arg2 is the total number to write.</entry>
|
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-sync-written</entry>
|
<entry>buffer-sync-written</entry>
|
||||||
<entry>(int)</entry>
|
<entry>(int)</entry>
|
||||||
<entry>Probe that fires when the buffer pool syncing is in progress (e.g. buffer-sync-start has fired) and a buffer has been successfully written.</entry>
|
<entry>Probe that fires after each buffer is written during checkpoint.
|
||||||
|
arg0 is the ID number of the buffer.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>buffer-sync-done</entry>
|
||||||
|
<entry>(int, int, int)</entry>
|
||||||
|
<entry>Probe that fires when all dirty buffers have been written.
|
||||||
|
arg0 is the total number of buffers.
|
||||||
|
arg1 is the number of buffers actually written by the checkpoint process.
|
||||||
|
arg2 is the number that were expected to be written (arg1 of
|
||||||
|
buffer-sync-start); any difference reflects other processes flushing
|
||||||
|
buffers during the checkpoint.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>buffer-checkpoint-sync-start</entry>
|
||||||
|
<entry>()</entry>
|
||||||
|
<entry>Probe that fires after dirty buffers have been written to the
|
||||||
|
kernel, and before starting to issue fsync requests.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>buffer-checkpoint-done</entry>
|
||||||
|
<entry>()</entry>
|
||||||
|
<entry>Probe that fires when syncing of buffers to disk is
|
||||||
|
complete.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>twophase-checkpoint-start</entry>
|
||||||
|
<entry>()</entry>
|
||||||
|
<entry>Probe that fires when the two-phase portion of a checkpoint is
|
||||||
|
started.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>twophase-checkpoint-done</entry>
|
||||||
|
<entry>()</entry>
|
||||||
|
<entry>Probe that fires when the two-phase portion of a checkpoint is
|
||||||
|
complete.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>buffer-read-start</entry>
|
||||||
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool)</entry>
|
||||||
|
<entry>Probe that fires when a buffer read is started.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page (but
|
||||||
|
arg1 will be -1 if this is a relation extension request).
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.
|
||||||
|
arg5 is true for a local buffer, false for a shared buffer.
|
||||||
|
arg6 is true for a relation extension request, false for normal
|
||||||
|
read.</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>buffer-read-done</entry>
|
||||||
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool, bool)</entry>
|
||||||
|
<entry>Probe that fires when a buffer read is complete.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page (if this
|
||||||
|
is a relation extension request, arg1 now contains the block number
|
||||||
|
of the newly added block).
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.
|
||||||
|
arg5 is true for a local buffer, false for a shared buffer.
|
||||||
|
arg6 is true for a relation extension request, false for normal
|
||||||
|
read.
|
||||||
|
arg7 is true if the buffer was found in the pool, false if not.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-flush-start</entry>
|
<entry>buffer-flush-start</entry>
|
||||||
<entry>(Oid, Oid, Oid)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
||||||
<entry>Probe that fires when a shared buffer needs to be physically written out to disk, and it's always preceeded by buffer-sync-start. This actually just passes the buffer contents to the kernel; the real write to disk happens later by the kernel. This is okay since the changes have already been written to the WAL. arg0, arg1, and arg2 contain the tablespace, database, and relation OIDs respectively.</entry>
|
<entry>Probe that fires before issuing any write request for a shared
|
||||||
|
buffer.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page.
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-flush-done</entry>
|
<entry>buffer-flush-done</entry>
|
||||||
<entry>(Oid, Oid, Oid)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
||||||
<entry>Probe that fires when the buffer flush is complete, and it's always followed by buffer-checkpoint-sync-start. arg0, arg1, and arg2 have the same meaning as buffer-flush-start.</entry>
|
<entry>Probe that fires when a write request is complete. (Note
|
||||||
|
that this just reflects the time to pass the data to the kernel;
|
||||||
|
it's typically not actually been written to disk yet.)
|
||||||
|
The arguments are the same as for buffer-flush-start.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-write-dirty-start</entry>
|
<entry>buffer-write-dirty-start</entry>
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
||||||
<entry>Probe that fires when the server starts writting out dirty buffers, indicating that the bgwriter is ineffective or shared_buffers is too small. arg0 refers to a fork in a relation. arg1 is the disk block number. arg2, arg3, arg4 contain the tablespace, database, and relation OIDs respectively.</entry>
|
<entry>Probe that fires when a server process begins to write a dirty
|
||||||
|
buffer. (If this happens often, it implies that
|
||||||
|
<xref linkend="guc-shared-buffers"> is too
|
||||||
|
small or the bgwriter control parameters need adjustment.)
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page.
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>buffer-write-dirty-done</entry>
|
<entry>buffer-write-dirty-done</entry>
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
||||||
<entry>Probe that fires when the buffer write is complete. The arguments are the same as buffer-write-dirty-start probe.</entry>
|
<entry>Probe that fires when a dirty-buffer write is complete.
|
||||||
|
The arguments are the same as for buffer-write-dirty-start.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>wal-buffer-write-dirty-start</entry>
|
<entry>wal-buffer-write-dirty-start</entry>
|
||||||
<entry>()</entry>
|
<entry>()</entry>
|
||||||
<entry>Probe that fires when the server starts writting out dirty WAL buffers, indicating that no more WAL buffer pages are available. Increasing wal_buffers will reduce the writes and may improve performance.</entry>
|
<entry>Probe that fires when when a server process begins to write a
|
||||||
|
dirty WAL buffer because no more WAL buffer space is available.
|
||||||
|
(If this happens often, it implies that
|
||||||
|
<xref linkend="guc-wal-buffers"> is too small.)</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>wal-buffer-write-dirty-done</entry>
|
<entry>wal-buffer-write-dirty-done</entry>
|
||||||
<entry>()</entry>
|
<entry>()</entry>
|
||||||
<entry>Probe that fires when the WAL buffer write is complete.</entry>
|
<entry>Probe that fires when a dirty WAL buffer write is complete.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>xlog-insert</entry>
|
<entry>xlog-insert</entry>
|
||||||
<entry>(unsigned char, unsigned char)</entry>
|
<entry>(unsigned char, unsigned char)</entry>
|
||||||
<entry>Probe that fires when data is inserted in the XLog. arg0 is the resource manager (rmid) for the record. arg1 represents the info flags.</entry>
|
<entry>Probe that fires when a WAL record is inserted.
|
||||||
|
arg0 is the resource manager (rmid) for the record.
|
||||||
|
arg1 contains the info flags.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>xlog-switch</entry>
|
<entry>xlog-switch</entry>
|
||||||
<entry>()</entry>
|
<entry>()</entry>
|
||||||
<entry>Probe that fires when an XLog switch is requested. This is always immediately preceeded by an firing of the xlog-insert probe.</entry>
|
<entry>Probe that fires when a WAL segment switch is requested.</entry>
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>sort-start</entry>
|
|
||||||
<entry>(int, bool, int, int, bool)</entry>
|
|
||||||
<entry>Probe that fires when sort is performed. arg0 indicates heap, index or datum sort. arg1 is true for unique enforcement. arg2 is the number of keys. arg3 represents workMem. arg3 is true for random access.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry>sort-done</entry>
|
|
||||||
<entry>(unsigned long, long)</entry>
|
|
||||||
<entry>Probe that fires when sort is complete. arg0 is either true or false, true for external sort, false for internal sort. arg1 is the number of disk blocks used for external sort or memory used in KB for internal sort.</entry>
|
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>smgr-md-read-start</entry>
|
<entry>smgr-md-read-start</entry>
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
||||||
<entry>Probes that fires when reading a block from a relation. arg0 and arg1 contain fork and block number. arg2, arg3 and arg4 contain the tablespace, database and relation OIDs.</entry>
|
<entry>Probe that fires when beginning to read a block from a relation.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page.
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>smgr-md-read-done</entry>
|
<entry>smgr-md-read-done</entry>
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, const char *, int, int)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int)</entry>
|
||||||
<entry>Probes that fires when a block read is complete. arg0 and arg1 contan fork and block number. arg2, arg3, arg4 contain the tablespace, database, and relation OIDs. arg5 is the path to the relation's file. arg6 is the number of bytes read. arg7 is the block size.</entry>
|
<entry>Probe that fires when a block read is complete.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page.
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.
|
||||||
|
arg5 is the number of bytes actually read, while arg6 is the number
|
||||||
|
requested (if these are different it indicates trouble).</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>smgr-md-write-start</entry>
|
<entry>smgr-md-write-start</entry>
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
|
||||||
<entry>Probes that fires when writing a block to the appropriate relation. arg0 and arg1 contain fork and block number. arg2, arg3 and arg4 contain the tablespace, database and relation OIDs.</entry>
|
<entry>Probe that fires when beginning to write a block to a relation.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page.
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>smgr-md-write-done</entry>
|
<entry>smgr-md-write-done</entry>
|
||||||
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, const char *, int, int)</entry>
|
<entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int)</entry>
|
||||||
<entry>Probes that fires when a block write is complete. arg0 and arg1 contan fork and block number. arg2, arg3, arg4 contain the tablespace, database, and relation OIDs. arg5 is the path to the relation's file. arg6 is number of bytes read. arg7 is the block size.</entry>
|
<entry>Probe that fires when a block write is complete.
|
||||||
|
arg0 and arg1 contain the fork and block numbers of the page.
|
||||||
|
arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs
|
||||||
|
identifying the relation.
|
||||||
|
arg5 is the number of bytes actually written, while arg6 is the number
|
||||||
|
requested (if these are different it indicates trouble).</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>deadlock-found</entry>
|
<entry>sort-start</entry>
|
||||||
<entry>()</entry>
|
<entry>(int, bool, int, int, bool)</entry>
|
||||||
<entry>Probe that fires when a deadlock is found by the deadlock detector.</entry>
|
<entry>Probe that fires when a sort operation is started.
|
||||||
|
arg0 indicates heap, index or datum sort.
|
||||||
|
arg1 is true for unique-value enforcement.
|
||||||
|
arg2 is the number of key columns.
|
||||||
|
arg3 is the number of kilobytes of work memory allowed.
|
||||||
|
arg4 is true if random access to the sort result is required.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</tgroup>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
<table id="dev-trace-point-table">
|
|
||||||
<title>Built-in Probes for Developers</title>
|
|
||||||
<tgroup cols="3">
|
|
||||||
<thead>
|
|
||||||
<row>
|
<row>
|
||||||
<entry>Name</entry>
|
<entry>sort-done</entry>
|
||||||
<entry>Parameters</entry>
|
<entry>(bool, long)</entry>
|
||||||
<entry>Description</entry>
|
<entry>Probe that fires when a sort is complete.
|
||||||
|
arg0 is true for external sort, false for internal sort.
|
||||||
|
arg1 is the number of disk blocks used for an external sort,
|
||||||
|
or kilobytes of memory used for an internal sort.</entry>
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry>lwlock-acquire</entry>
|
<entry>lwlock-acquire</entry>
|
||||||
<entry>(LWLockId, LWLockMode)</entry>
|
<entry>(LWLockId, LWLockMode)</entry>
|
||||||
<entry>Probe that fires when an LWLock has been acquired. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
|
<entry>Probe that fires when an LWLock has been acquired.
|
||||||
|
arg0 is the LWLock's ID.
|
||||||
|
arg1 is the requested lock mode, either exclusive or shared.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lwlock-release</entry>
|
<entry>lwlock-release</entry>
|
||||||
<entry>(LWLockId)</entry>
|
<entry>(LWLockId)</entry>
|
||||||
<entry>Probe that fires when an LWLock has been released. arg0 is a predefined or dynamic ID defined in LWLockId enum.</entry>
|
<entry>Probe that fires when an LWLock has been released (but note
|
||||||
|
that any released waiters have not yet been awakened).
|
||||||
|
arg0 is the LWLock's ID.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lwlock-wait-start</entry>
|
<entry>lwlock-wait-start</entry>
|
||||||
<entry>(LWLockId, LWLockMode)</entry>
|
<entry>(LWLockId, LWLockMode)</entry>
|
||||||
<entry>Probe that fires when an LWLock was not immediately available and a backend has begun to wait for the lock to become available. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared .</entry>
|
<entry>Probe that fires when an LWLock was not immediately available and
|
||||||
|
a server process has begun to wait for the lock to become available.
|
||||||
|
arg0 is the LWLock's ID.
|
||||||
|
arg1 is the requested lock mode, either exclusive or shared.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lwlock-wait-done</entry>
|
<entry>lwlock-wait-done</entry>
|
||||||
<entry>(LWLockId, LWLockMode)</entry>
|
<entry>(LWLockId, LWLockMode)</entry>
|
||||||
<entry>Probe that fires when a backend has been released from its wait for an LWLock. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
|
<entry>Probe that fires when a server process has been released from its
|
||||||
|
wait for an LWLock (it does not actually have the lock yet).
|
||||||
|
arg0 is the LWLock's ID.
|
||||||
|
arg1 is the requested lock mode, either exclusive or shared.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lwlock-condacquire</entry>
|
<entry>lwlock-condacquire</entry>
|
||||||
<entry>(LWLockId, LWLockMode)</entry>
|
<entry>(LWLockId, LWLockMode)</entry>
|
||||||
<entry>Probe that fires when an LWLock was successfully acquired when the caller specified no waiting. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
|
<entry>Probe that fires when an LWLock was successfully acquired when the
|
||||||
|
caller specified no waiting.
|
||||||
|
arg0 is the LWLock's ID.
|
||||||
|
arg1 is the requested lock mode, either exclusive or shared.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lwlock-condacquire-fail</entry>
|
<entry>lwlock-condacquire-fail</entry>
|
||||||
<entry>(LWLockId, LWLockMode)</entry>
|
<entry>(LWLockId, LWLockMode)</entry>
|
||||||
<entry>Probe that fires when an LWLock was not successfully acquired when the caller specified no waiting. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
|
<entry>Probe that fires when an LWLock was not successfully acquired when
|
||||||
|
the caller specified no waiting.
|
||||||
|
arg0 is the LWLock's ID.
|
||||||
|
arg1 is the requested lock mode, either exclusive or shared.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lock-wait-start</entry>
|
<entry>lock-wait-start</entry>
|
||||||
<entry>(unsigned int, LOCKMODE)</entry>
|
<entry>(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE)</entry>
|
||||||
<entry>Probe that fires when a request for a heavyweight lock (lmgr lock) has begun to wait because the lock is not available. arg0 is the unique ID tag defined in LOCKTAG struct. arg1 is an integer indicating a lock type.
|
<entry>Probe that fires when a request for a heavyweight lock (lmgr lock)
|
||||||
</entry>
|
has begun to wait because the lock is not available.
|
||||||
|
arg0 through arg3 are the tag fields identifying the object being
|
||||||
|
locked. arg4 indicates the type of object being locked.
|
||||||
|
arg5 indicates the lock type being requested.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lock-wait-done</entry>
|
<entry>lock-wait-done</entry>
|
||||||
<entry>(unsigned int, LOCKMODE)</entry>
|
<entry>(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE)</entry>
|
||||||
<entry>Probe that fires when a request for a heavyweight lock (lmgr lock) has finished waiting (i.e., has acquired the lock). arg0 is the unique ID tag defined in LOCKTAG struct. arg1 is an integer indicating a lock type.
|
<entry>Probe that fires when a request for a heavyweight lock (lmgr lock)
|
||||||
</entry>
|
has finished waiting (i.e., has acquired the lock).
|
||||||
|
The arguments are the same as for lock-wait-start.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>deadlock-found</entry>
|
||||||
|
<entry>()</entry>
|
||||||
|
<entry>Probe that fires when a deadlock is found by the deadlock
|
||||||
|
detector.</entry>
|
||||||
|
</row>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
@ -1435,7 +1532,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The example below shows a DTrace script for analyzing transaction
|
The example below shows a DTrace script for analyzing transaction
|
||||||
counts on the system, as an alternative to snapshotting
|
counts in the system, as an alternative to snapshotting
|
||||||
<structname>pg_stat_database</> before and after a performance test:
|
<structname>pg_stat_database</> before and after a performance test:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
#!/usr/sbin/dtrace -qs
|
#!/usr/sbin/dtrace -qs
|
||||||
@ -1471,15 +1568,15 @@ Total time (ns) 2312105013
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You should remember that DTrace scripts need to be carefully written and
|
You should remember that DTrace scripts need to be carefully written and
|
||||||
debugged prior to their use, otherwise the trace information collected might
|
debugged, otherwise the trace information collected might
|
||||||
be meaningless. In most cases where problems are found it is the
|
be meaningless. In most cases where problems are found it is the
|
||||||
instrumentation that is at fault, not the underlying system. When
|
instrumentation that is at fault, not the underlying system. When
|
||||||
discussing information found using dynamic tracing, be sure to enclose
|
discussing information found using dynamic tracing, be sure to enclose
|
||||||
the script used to allow that too to be checked and discussed.
|
the script used to allow that too to be checked and discussed.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
More example scripts can be found on
|
More example scripts can be found in the PgFoundry
|
||||||
<ulink url="http://pgfoundry.org/projects/dtrace/">PgFoundry.</ulink>
|
<ulink url="http://pgfoundry.org/projects/dtrace/">dtrace project</ulink>.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
@ -1507,7 +1604,9 @@ Total time (ns) 2312105013
|
|||||||
|
|
||||||
<step>
|
<step>
|
||||||
<para>
|
<para>
|
||||||
Include pg_trace.h if it is not already presence and insert a one-line probe macros at the desired locations in the source code
|
Include <filename>pg_trace.h</> if it is not already present in the
|
||||||
|
module(s) containing the probe points, and insert TRACE_POSTGRESQL
|
||||||
|
probe macros at the desired locations in the source code
|
||||||
</para>
|
</para>
|
||||||
</step>
|
</step>
|
||||||
|
|
||||||
@ -1521,30 +1620,30 @@ Total time (ns) 2312105013
|
|||||||
<formalpara>
|
<formalpara>
|
||||||
<title>Example:</title>
|
<title>Example:</title>
|
||||||
<para>
|
<para>
|
||||||
Here is an example of how you would add a probe to trace all new transactions by transaction ID.
|
Here is an example of how you would add a probe to trace all new
|
||||||
|
transactions by transaction ID.
|
||||||
</para>
|
</para>
|
||||||
</formalpara>
|
</formalpara>
|
||||||
|
|
||||||
<procedure>
|
<procedure>
|
||||||
<step>
|
<step>
|
||||||
<para>
|
<para>
|
||||||
Name the probe transaction-start and give it a parameter of type LocalTransactionId
|
Decide that the probe will be named transaction-start and requires
|
||||||
|
a parameter of type LocalTransactionId
|
||||||
</para>
|
</para>
|
||||||
</step>
|
</step>
|
||||||
|
|
||||||
<step>
|
<step>
|
||||||
<para>
|
<para>
|
||||||
Add <quote>probe transaction__start(LocalTransactionId);</quote> to
|
Add the probe definition to <filename>src/backend/utils/probes.d</>:
|
||||||
<filename>src/backend/utils/probes.d</>, and it should look like the following:
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
provider postgresql {
|
|
||||||
...
|
...
|
||||||
probe transaction__start(LocalTransactionId);
|
probe transaction__start(LocalTransactionId);
|
||||||
...
|
...
|
||||||
};
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Note the use of the double underline in the probe name. In the DTrace
|
Note the use of the double underline in the probe name. In a DTrace
|
||||||
script, the double underline needs to be replaced with a hyphen.
|
script using the probe, the double underline needs to be replaced with a
|
||||||
|
hyphen.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -1557,41 +1656,22 @@ provider postgresql {
|
|||||||
<step>
|
<step>
|
||||||
<para>
|
<para>
|
||||||
At compile time, transaction__start is converted to a macro called
|
At compile time, transaction__start is converted to a macro called
|
||||||
TRACE_POSTGRESQL_TRANSACTION_START, and it resides in
|
TRACE_POSTGRESQL_TRANSACTION_START (note the underscores are single
|
||||||
<filename>src/backend/utils/probes.h</>. Before recompiling, add
|
here), which is available by including <filename>pg_trace.h</>.
|
||||||
the single line macro to the appropriate location in the source code.
|
Add the macro call to the appropriate location in the source code.
|
||||||
In this case, it looks like the following:
|
In this case, it looks like the following:
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
static void
|
|
||||||
StartTransaction(void)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Advertise it in the proc array. We assume assignment of
|
|
||||||
* LocalTransactionID is atomic, and the backendId should be set already.
|
|
||||||
*/
|
|
||||||
Assert(MyProc->backendId == vxid.backendId);
|
|
||||||
MyProc->lxid = vxid.localTransactionId;
|
|
||||||
|
|
||||||
TRACE_POSTGRESQL_TRANSACTION_START(vxid.localTransactionId);
|
TRACE_POSTGRESQL_TRANSACTION_START(vxid.localTransactionId);
|
||||||
|
|
||||||
...
|
|
||||||
}
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Note how the transaction ID is made available to the dynamic tracing
|
|
||||||
utility.
|
|
||||||
</para>
|
</para>
|
||||||
</step>
|
</step>
|
||||||
|
|
||||||
<step>
|
<step>
|
||||||
<para>
|
<para>
|
||||||
After recompiling and running the new binary, check that your newly added
|
After recompiling and running the new binary, check that your newly added
|
||||||
probe is available by executing the following DTrace command, and you
|
probe is available by executing the following DTrace command. You
|
||||||
should see similar output.
|
should see similar output:
|
||||||
<screen>
|
<screen>
|
||||||
# dtrace -ln transaction-start
|
# dtrace -ln transaction-start
|
||||||
ID PROVIDER MODULE FUNCTION NAME
|
ID PROVIDER MODULE FUNCTION NAME
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.248 2009/03/22 22:39:05 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.249 2009/03/23 01:52:38 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -272,14 +272,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
|
|||||||
ReadLocalBufferCount++;
|
ReadLocalBufferCount++;
|
||||||
bufHdr = LocalBufferAlloc(smgr, forkNum, blockNum, &found);
|
bufHdr = LocalBufferAlloc(smgr, forkNum, blockNum, &found);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
|
||||||
LocalBufferHitCount++;
|
LocalBufferHitCount++;
|
||||||
TRACE_POSTGRESQL_BUFFER_HIT(true); /* true = local buffer */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TRACE_POSTGRESQL_BUFFER_MISS(true); /* ditto */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -291,14 +284,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
|
|||||||
*/
|
*/
|
||||||
bufHdr = BufferAlloc(smgr, forkNum, blockNum, strategy, &found);
|
bufHdr = BufferAlloc(smgr, forkNum, blockNum, strategy, &found);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
|
||||||
BufferHitCount++;
|
BufferHitCount++;
|
||||||
TRACE_POSTGRESQL_BUFFER_HIT(false); /* false = shared buffer */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TRACE_POSTGRESQL_BUFFER_MISS(false); /* ditto */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this point we do NOT hold any locks. */
|
/* At this point we do NOT hold any locks. */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.186 2009/01/01 17:23:47 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.187 2009/03/23 01:52:38 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* A lock table is a shared memory hash table. When
|
* A lock table is a shared memory hash table. When
|
||||||
@ -787,11 +787,21 @@ LockAcquire(const LOCKTAG *locktag,
|
|||||||
* Sleep till someone wakes me up.
|
* Sleep till someone wakes me up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TRACE_POSTGRESQL_LOCK_WAIT_START(locktag->locktag_field2, lockmode);
|
TRACE_POSTGRESQL_LOCK_WAIT_START(locktag->locktag_field1,
|
||||||
|
locktag->locktag_field2,
|
||||||
|
locktag->locktag_field3,
|
||||||
|
locktag->locktag_field4,
|
||||||
|
locktag->locktag_type,
|
||||||
|
lockmode);
|
||||||
|
|
||||||
WaitOnLock(locallock, owner);
|
WaitOnLock(locallock, owner);
|
||||||
|
|
||||||
TRACE_POSTGRESQL_LOCK_WAIT_DONE(locktag->locktag_field2, lockmode);
|
TRACE_POSTGRESQL_LOCK_WAIT_DONE(locktag->locktag_field1,
|
||||||
|
locktag->locktag_field2,
|
||||||
|
locktag->locktag_field3,
|
||||||
|
locktag->locktag_field4,
|
||||||
|
locktag->locktag_type,
|
||||||
|
lockmode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: do not do any material change of state between here and
|
* NOTE: do not do any material change of state between here and
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2006-2009, PostgreSQL Global Development Group
|
* Copyright (c) 2006-2009, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.8 2009/03/22 22:39:05 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.9 2009/03/23 01:52:38 tgl Exp $
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -36,8 +36,8 @@ provider postgresql {
|
|||||||
probe lwlock__condacquire(LWLockId, LWLockMode);
|
probe lwlock__condacquire(LWLockId, LWLockMode);
|
||||||
probe lwlock__condacquire__fail(LWLockId, LWLockMode);
|
probe lwlock__condacquire__fail(LWLockId, LWLockMode);
|
||||||
|
|
||||||
probe lock__wait__start(unsigned int, LOCKMODE);
|
probe lock__wait__start(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
|
||||||
probe lock__wait__done(unsigned int, LOCKMODE);
|
probe lock__wait__done(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
|
||||||
|
|
||||||
probe query__parse__start(const char *);
|
probe query__parse__start(const char *);
|
||||||
probe query__parse__done(const char *);
|
probe query__parse__done(const char *);
|
||||||
@ -59,8 +59,6 @@ provider postgresql {
|
|||||||
probe buffer__flush__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
|
probe buffer__flush__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
|
||||||
probe buffer__flush__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
|
probe buffer__flush__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
|
||||||
|
|
||||||
probe buffer__hit(bool);
|
|
||||||
probe buffer__miss(bool);
|
|
||||||
probe buffer__checkpoint__start(int);
|
probe buffer__checkpoint__start(int);
|
||||||
probe buffer__checkpoint__sync__start();
|
probe buffer__checkpoint__sync__start();
|
||||||
probe buffer__checkpoint__done();
|
probe buffer__checkpoint__done();
|
||||||
|
Loading…
Reference in New Issue
Block a user