Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
bf3b8d8a
Commit
bf3b8d8a
authored
Apr 13, 2007
by
Magnus Hagander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow \timing in psql to have a better resolution than ~15ms on Windows.
ITAGAKI Takahiro
parent
5b464e11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
src/bin/psql/common.h
src/bin/psql/common.h
+17
-12
No files found.
src/bin/psql/common.h
View file @
bf3b8d8a
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.5
4 2007/01/05 22:19:49 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.5
5 2007/04/13 20:40:59 mha
Exp $
*/
#ifndef COMMON_H
#define COMMON_H
...
...
@@ -63,10 +63,6 @@ extern const char *session_username(void);
extern
char
*
expand_tilde
(
char
**
filename
);
/* Workarounds for Windows */
/* Probably to be moved up the source tree in the future, perhaps to be replaced by
* more specific checks like configure-style HAVE_GETTIMEOFDAY macros.
*/
#ifndef WIN32
#include <sys/time.h>
...
...
@@ -78,16 +74,25 @@ typedef struct timeval TimevalStruct;
((((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
;
#include <sys/types.h>
#include <sys/timeb.h>
QueryPerformanceFrequency
(
&
f
);
return
(
double
)
f
.
QuadPart
;
}
typedef
struct
_timeb
TimevalStruct
;
typedef
LARGE_INTEGER
TimevalStruct
;
#define GETTIMEOFDAY(T)
_ftime(T
)
#define GETTIMEOFDAY(T)
QueryPerformanceCounter((T)
)
#define DIFF_MSEC(T, U) \
(((T)->time - (U)->time) * 1000.0 + \
((T)->millitm - (U)->millitm))
#endif
(((T)->QuadPart - (U)->QuadPart) * 1000.0 / GetTimerFrequency())
#endif
/* WIN32 */
#endif
/* COMMON_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment