PostgreSQL Source Code  git master
instr_time.h File Reference
#include <sys/time.h>
Include dependency graph for instr_time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INSTR_TIME_IS_ZERO(t)   ((t).tv_usec == 0 && (t).tv_sec == 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_ADD(x, y)
 
#define INSTR_TIME_SUBTRACT(x, y)
 
#define INSTR_TIME_ACCUM_DIFF(x, y, z)
 
#define INSTR_TIME_GET_DOUBLE(t)   (((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0)
 
#define INSTR_TIME_GET_MILLISEC(t)   (((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0)
 
#define INSTR_TIME_GET_MICROSEC(t)   (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec)
 

Typedefs

typedef struct timeval instr_time
 

Macro Definition Documentation

◆ INSTR_TIME_ACCUM_DIFF

#define INSTR_TIME_ACCUM_DIFF (   x,
  y,
 
)
Value:
do { \
(x).tv_sec += (y).tv_sec - (z).tv_sec; \
(x).tv_usec += (y).tv_usec - (z).tv_usec; \
/* Normalize after each add to avoid overflow/underflow of tv_usec */ \
while ((x).tv_usec < 0) \
{ \
(x).tv_usec += 1000000; \
(x).tv_sec--; \
} \
while ((x).tv_usec >= 1000000) \
{ \
(x).tv_usec -= 1000000; \
(x).tv_sec++; \
} \
} while (0)

Definition at line 179 of file instr_time.h.

Referenced by BufferUsageAccumDiff(), doCustom(), InstrStopNode(), and threadRun().

◆ INSTR_TIME_ADD

#define INSTR_TIME_ADD (   x,
 
)
Value:
do { \
(x).tv_sec += (y).tv_sec; \
(x).tv_usec += (y).tv_usec; \
/* Normalize */ \
while ((x).tv_usec >= 1000000) \
{ \
(x).tv_usec -= 1000000; \
(x).tv_sec++; \
} \
} while (0)

Definition at line 155 of file instr_time.h.

Referenced by BufferUsageAdd(), FlushBuffer(), InstrAggNode(), main(), pgstat_end_function_usage(), and ReadBuffer_common().

◆ INSTR_TIME_GET_DOUBLE

#define INSTR_TIME_GET_DOUBLE (   t)    (((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0)

◆ INSTR_TIME_GET_MICROSEC

#define INSTR_TIME_GET_MICROSEC (   t)    (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec)

◆ INSTR_TIME_GET_MILLISEC

#define INSTR_TIME_GET_MILLISEC (   t)    (((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0)

◆ INSTR_TIME_IS_ZERO

#define INSTR_TIME_IS_ZERO (   t)    ((t).tv_usec == 0 && (t).tv_sec == 0)

◆ INSTR_TIME_SET_CURRENT

◆ INSTR_TIME_SET_ZERO

#define INSTR_TIME_SET_ZERO (   t)    ((t).tv_sec = 0, (t).tv_usec = 0)

Definition at line 151 of file instr_time.h.

Referenced by doCustom(), InstrEndLoop(), InstrStopNode(), main(), and threadRun().

◆ INSTR_TIME_SUBTRACT

#define INSTR_TIME_SUBTRACT (   x,
 
)
Value:
do { \
(x).tv_sec -= (y).tv_sec; \
(x).tv_usec -= (y).tv_usec; \
/* Normalize */ \
while ((x).tv_usec < 0) \
{ \
(x).tv_usec += 1000000; \
(x).tv_sec--; \
} \
} while (0)

Definition at line 167 of file instr_time.h.

Referenced by count_nondeletable_pages(), DescribeQuery(), elapsed_time(), ExecQueryUsingCursor(), ExplainExecuteQuery(), ExplainOneQuery(), FlushBuffer(), initGenerateData(), main(), mdsync(), pgss_ProcessUtility(), pgstat_end_function_usage(), PSQLexecWatch(), ReadBuffer_common(), SendQuery(), system_time_nextsampleblock(), test_timing(), threadRun(), and WaitEventSetWait().

Typedef Documentation

◆ instr_time

typedef struct timeval instr_time

Definition at line 147 of file instr_time.h.