diff options
| author | Peter Eisentraut <peter_e@gmx.net> | 2006-07-24 16:32:45 +0000 |
|---|---|---|
| committer | Peter Eisentraut <peter_e@gmx.net> | 2006-07-24 16:32:45 +0000 |
| commit | e9b49690627eb91106af3aa98d0fcc510de6538b (patch) | |
| tree | 2e878a58fbb23ace8f2cfe4758779a62869f1239 /src/include | |
| parent | 9dc34b5feb73615d7371ef1c1b7c05b3146cc9a9 (diff) | |
DTrace support, with a small initial set of probes
by Robert Lor
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/c.h | 3 | ||||
| -rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
| -rw-r--r-- | src/include/pg_trace.h | 56 |
3 files changed, 61 insertions, 1 deletions
diff --git a/src/include/c.h b/src/include/c.h index bd09a430edc..5195db2ac75 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.206 2006/07/06 01:55:51 momjian Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.207 2006/07/24 16:32:45 petere Exp $ * *------------------------------------------------------------------------- */ @@ -56,6 +56,7 @@ #include "pg_config_os.h" /* must be before any system header files */ #endif #include "postgres_ext.h" +#include "pg_trace.h" #if defined(_MSC_VER) || defined(__BORLANDC__) #define WIN32_ONLY_COMPILER diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 82ccde63c1c..e84205c9ea0 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -36,6 +36,9 @@ /* Define to the default TCP port number as a string constant. */ #undef DEF_PGPORT_STR +/* Define to 1 to enable DTrace support. (--enable-dtrace) */ +#undef ENABLE_DTRACE + /* Define to 1 if you want National Language Support. (--enable-nls) */ #undef ENABLE_NLS diff --git a/src/include/pg_trace.h b/src/include/pg_trace.h new file mode 100644 index 00000000000..6c35cb2e8dd --- /dev/null +++ b/src/include/pg_trace.h @@ -0,0 +1,56 @@ +/* ---------- + * pg_trace.h + * + * Definitions for the PostgreSQL tracing framework + * + * Copyright (c) 2006, PostgreSQL Global Development Group + * + * $PostgreSQL: pgsql/src/include/pg_trace.h,v 1.1 2006/07/24 16:32:45 petere Exp $ + * ---------- + */ + +#ifndef PG_TRACE_H +#define PG_TRACE_H + +#ifdef ENABLE_DTRACE + +#include <sys/sdt.h> + +/* + * The PG_TRACE macros are mapped to the appropriate macros used by DTrace. + * + * Only one DTrace provider called "postgresql" will be used for PostgreSQL, + * so the name is hard-coded here to avoid having to specify it in the + * source code. + */ + +#define PG_TRACE(name) \ + DTRACE_PROBE(postgresql, name) +#define PG_TRACE1(name, arg1) \ + DTRACE_PROBE1(postgresql, name, arg1) +#define PG_TRACE2(name, arg1, arg2) \ + DTRACE_PROBE2(postgresql, name, arg1, arg2) +#define PG_TRACE3(name, arg1, arg2, arg3) \ + DTRACE_PROBE3(postgresql, name, arg1, arg2, arg3) +#define PG_TRACE4(name, arg1, arg2, arg3, arg4) \ + DTRACE_PROBE4(postgresql, name, arg1, arg2, arg3, arg4) +#define PG_TRACE5(name, arg1, arg2, arg3, arg4, arg5) \ + DTRACE_PROBE5(postgresql, name, arg1, arg2, arg3, arg4, arg5) + +#else /* not ENABLE_DTRACE */ + +/* + * Unless DTrace is explicitly enabled with --enable-dtrace, the PG_TRACE + * macros will expand to no-ops. + */ + +#define PG_TRACE(name) +#define PG_TRACE1(name, arg1) +#define PG_TRACE2(name, arg1, arg2) +#define PG_TRACE3(name, arg1, arg2, arg3) +#define PG_TRACE4(name, arg1, arg2, arg3, arg4) +#define PG_TRACE5(name, arg1, arg2, arg3, arg4, arg5) + +#endif /* not ENABLE_DTRACE */ + +#endif /* PG_TRACE_H */ |
