]> granicus.if.org Git - postgresql/blob - src/include/pg_trace.h
pgindent run for 8.2.
[postgresql] / src / include / pg_trace.h
1 /* ----------
2  *      pg_trace.h
3  *
4  *      Definitions for the PostgreSQL tracing framework
5  *
6  *      Copyright (c) 2006, PostgreSQL Global Development Group
7  *
8  *      $PostgreSQL: pgsql/src/include/pg_trace.h,v 1.2 2006/10/04 00:30:06 momjian Exp $
9  * ----------
10  */
11
12 #ifndef PG_TRACE_H
13 #define PG_TRACE_H
14
15 #ifdef ENABLE_DTRACE
16
17 #include <sys/sdt.h>
18
19 /*
20  * The PG_TRACE macros are mapped to the appropriate macros used by DTrace.
21  *
22  * Only one DTrace provider called "postgresql" will be used for PostgreSQL,
23  * so the name is hard-coded here to avoid having to specify it in the
24  * source code.
25  */
26
27 #define PG_TRACE(name) \
28         DTRACE_PROBE(postgresql, name)
29 #define PG_TRACE1(name, arg1) \
30         DTRACE_PROBE1(postgresql, name, arg1)
31 #define PG_TRACE2(name, arg1, arg2) \
32         DTRACE_PROBE2(postgresql, name, arg1, arg2)
33 #define PG_TRACE3(name, arg1, arg2, arg3) \
34         DTRACE_PROBE3(postgresql, name, arg1, arg2, arg3)
35 #define PG_TRACE4(name, arg1, arg2, arg3, arg4) \
36         DTRACE_PROBE4(postgresql, name, arg1, arg2, arg3, arg4)
37 #define PG_TRACE5(name, arg1, arg2, arg3, arg4, arg5) \
38         DTRACE_PROBE5(postgresql, name, arg1, arg2, arg3, arg4, arg5)
39 #else                                                   /* not ENABLE_DTRACE */
40
41 /*
42  * Unless DTrace is explicitly enabled with --enable-dtrace, the PG_TRACE
43  * macros will expand to no-ops.
44  */
45
46 #define PG_TRACE(name)
47 #define PG_TRACE1(name, arg1)
48 #define PG_TRACE2(name, arg1, arg2)
49 #define PG_TRACE3(name, arg1, arg2, arg3)
50 #define PG_TRACE4(name, arg1, arg2, arg3, arg4)
51 #define PG_TRACE5(name, arg1, arg2, arg3, arg4, arg5)
52 #endif   /* not ENABLE_DTRACE */
53
54 #endif   /* PG_TRACE_H */