mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Remove redundant gettimeofday() calls to the extent practical without
changing semantics too much. statement_timestamp is now set immediately upon receipt of a client command message, and the various places that used to do their own gettimeofday() calls to mark command startup are referenced to that instead. I have also made stats_command_string use that same value for pg_stat_activity.query_start for both the command itself and its eventual replacement by <IDLE> or <idle in transaction>. There was some debate about that, but no argument that seemed convincing enough to justify an extra gettimeofday() call.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.60 2006/04/25 00:25:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.61 2006/06/20 22:52:00 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -177,6 +177,12 @@ typedef double fsec_t;
|
||||
#define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK)
|
||||
#define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK)
|
||||
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * 1000))
|
||||
#else
|
||||
#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) / 1000.0))
|
||||
#endif
|
||||
|
||||
|
||||
/* Set at postmaster start */
|
||||
extern TimestampTz PgStartTime;
|
||||
@@ -293,7 +299,11 @@ extern Datum pgsql_postmaster_start_time(PG_FUNCTION_ARGS);
|
||||
|
||||
extern TimestampTz GetCurrentTimestamp(void);
|
||||
|
||||
extern void TimestampDifference(TimestampTz start_time, TimestampTz stop_time,
|
||||
long *secs, int *microsecs);
|
||||
|
||||
extern TimestampTz time_t_to_timestamptz(time_t tm);
|
||||
extern time_t timestamptz_to_time_t(TimestampTz t);
|
||||
|
||||
extern int tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *dt);
|
||||
extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm,
|
||||
|
||||
Reference in New Issue
Block a user