@@ -91,6 +91,12 @@ typedef struct timespec instr_time;
91
91
92
92
#define INSTR_TIME_SET_CURRENT (t ) ((void) clock_gettime(PG_INSTR_CLOCK, &(t)))
93
93
94
+ #ifdef CLOCK_MONOTONIC_COARSE
95
+ #define INSTR_TIME_SET_CURRENT_COARSE (t ) ((void) clock_gettime(CLOCK_MONOTONIC_COARSE, &(t)))
96
+ #else
97
+ #define INSTR_TIME_SET_CURRENT_COARSE (t ) INSTR_TIME_SET_CURRENT(t)
98
+ #endif
99
+
94
100
#define INSTR_TIME_ASSIGN (x ,y ) ((x).tv_sec = (y).tv_sec, (x).tv_nsec = (y).tv_nsec)
95
101
96
102
#define INSTR_TIME_ADD (x ,y ) \
@@ -157,6 +163,8 @@ typedef struct timeval instr_time;
157
163
158
164
#define INSTR_TIME_SET_CURRENT (t ) gettimeofday(&(t), NULL)
159
165
166
+ #define INSTR_TIME_SET_CURRENT_COARSE (t ) INSTR_TIME_SET_CURRENT(t)
167
+
160
168
#define INSTR_TIME_ASSIGN (x ,y ) ((x).tv_sec = (y).tv_sec, (x).tv_usec = (y).tv_usec)
161
169
162
170
#define INSTR_TIME_ADD (x ,y ) \
@@ -223,6 +231,8 @@ typedef LARGE_INTEGER instr_time;
223
231
224
232
#define INSTR_TIME_SET_CURRENT (t ) QueryPerformanceCounter(&(t))
225
233
234
+ #define INSTR_TIME_SET_CURRENT_COARSE (t ) INSTR_TIME_SET_CURRENT(t)
235
+
226
236
#define INSTR_TIME_ASSIGN (x ,y ) ((x).QuadPart = (y).QuadPart)
227
237
228
238
#define INSTR_TIME_ADD (x ,y ) \
@@ -257,6 +267,6 @@ GetTimerFrequency(void)
257
267
/* same macro on all platforms */
258
268
259
269
#define INSTR_TIME_SET_CURRENT_LAZY (t ) \
260
- (INSTR_TIME_IS_ZERO(t) ? INSTR_TIME_SET_CURRENT (t), true : false)
270
+ (INSTR_TIME_IS_ZERO(t) ? INSTR_TIME_SET_CURRENT_COARSE (t), true : false)
261
271
262
272
#endif /* INSTR_TIME_H */
0 commit comments