Note how the double underline in trace point names needs to
be replaced by a hyphen when using D script.
When executed, the example D script gives output such as:
-<programlisting>
+<screen>
# ./txn_count.d `pgrep -n postgres`
^C
Start 71
Commit 70
-Abort 1
Total time (ns) 2312105013
-programlisting>
+screen>
You should remember that trace programs need to be carefully written and
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.
occurrence of an event can be achieved with a single line, using
just the trace point name, e.g.
- PG_TRACE (my__new__trace__point);
+PG_TRACE (my__new__trace__point);
More complex trace points can be provided with one or more variables
for inspection by the dynamic tracing utility by using the
PG_TRACE>n> macro that corresponds to the number
of parameters after the trace point name:
- PG_TRACE3 (my__complex__event, varX, varY, varZ);
+PG_TRACE3 (my__complex__event, varX, varY, varZ);
The definition of the transaction__start trace point is shown below:
- 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 PG_TRACE>
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,