diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-14 19:10:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-14 19:10:29 +0000 |
commit | 3bc25384d7a698f25e418bdc5aa7cdd038477d9c (patch) | |
tree | 0d17e084e418a335ec4eb48470bf7847a9102a6e /src/include/executor | |
parent | 719a115874226f6e294a7d1d81d7a8ae559768ad (diff) | |
download | postgresql-3bc25384d7a698f25e418bdc5aa7cdd038477d9c.tar.gz postgresql-3bc25384d7a698f25e418bdc5aa7cdd038477d9c.zip |
Move the "instr_time" typedef and associated macros into a new header
file portability/instr_time.h, and add a couple more macros to eliminate
some abstraction leakage we formerly had. Also update psql to use this
header instead of its own copy of nearly the same code.
This commit in itself is just code cleanup and shouldn't change anything.
It lays some groundwork for the upcoming function-stats patch, though.
Diffstat (limited to 'src/include/executor')
-rw-r--r-- | src/include/executor/instrument.h | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h index 6889e9c0eb4..080e264629b 100644 --- a/src/include/executor/instrument.h +++ b/src/include/executor/instrument.h @@ -6,51 +6,14 @@ * * Copyright (c) 2001-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.18 2008/01/01 19:45:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/instrument.h,v 1.19 2008/05/14 19:10:29 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef INSTRUMENT_H #define INSTRUMENT_H -#include <sys/time.h> - - -/* - * gettimeofday() does not have sufficient resolution on Windows, - * so we must use QueryPerformanceCounter() instead. These macros - * also give some breathing room to use other high-precision-timing APIs - * on yet other platforms. (The macro-ization is not complete, however; - * see subtraction code in instrument.c and explain.c.) - */ -#ifndef WIN32 - -typedef struct timeval instr_time; - -#define INSTR_TIME_IS_ZERO(t) ((t).tv_sec == 0 && (t).tv_usec == 0) -#define INSTR_TIME_SET_ZERO(t) ((t).tv_sec = 0, (t).tv_usec = 0) -#define INSTR_TIME_SET_CURRENT(t) gettimeofday(&(t), NULL) -#define INSTR_TIME_GET_DOUBLE(t) \ - (((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0) -#else /* WIN32 */ - -typedef LARGE_INTEGER instr_time; - -#define INSTR_TIME_IS_ZERO(t) ((t).QuadPart == 0) -#define INSTR_TIME_SET_ZERO(t) ((t).QuadPart = 0) -#define INSTR_TIME_SET_CURRENT(t) QueryPerformanceCounter(&(t)) -#define INSTR_TIME_GET_DOUBLE(t) \ - (((double) (t).QuadPart) / GetTimerFrequency()) - -static __inline__ double -GetTimerFrequency(void) -{ - LARGE_INTEGER f; - - QueryPerformanceFrequency(&f); - return (double) f.QuadPart; -} -#endif /* WIN32 */ +#include "portability/instr_time.h" typedef struct Instrumentation |