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/bin/psql/common.h | |
parent | 719a115874226f6e294a7d1d81d7a8ae559768ad (diff) | |
download | postgresql-3bc25384d7a698f25e418bdc5aa7cdd038477d9c.tar.gz |
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/bin/psql/common.h')
-rw-r--r-- | src/bin/psql/common.h | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index c8cefe1843..7977eb5493 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.56 2008/01/01 19:45:55 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.57 2008/05/14 19:10:29 tgl Exp $ */ #ifndef COMMON_H #define COMMON_H @@ -63,36 +63,4 @@ extern const char *session_username(void); extern char *expand_tilde(char **filename); -#ifndef WIN32 - -#include <sys/time.h> - -typedef struct timeval TimevalStruct; - -#define GETTIMEOFDAY(T) gettimeofday(T, NULL) -#define DIFF_MSEC(T, U) \ - ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \ - ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0) -#else -/* - * To get good resolution (better than ~15ms) on Windows, use - * the high resolution performance counters. They can't be used - * to get absolute times, but are good for measuring differences. - */ -static __inline__ double -GetTimerFrequency(void) -{ - LARGE_INTEGER f; - - QueryPerformanceFrequency(&f); - return (double) f.QuadPart; -} - -typedef LARGE_INTEGER TimevalStruct; - -#define GETTIMEOFDAY(T) QueryPerformanceCounter((T)) -#define DIFF_MSEC(T, U) \ - (((T)->QuadPart - (U)->QuadPart) * 1000.0 / GetTimerFrequency()) -#endif /* WIN32 */ - #endif /* COMMON_H */ |