mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Add pg_postmaster_start_time() function.
Euler Taveira de Oliveira Matthias Schmidt
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.447 2005/06/03 23:05:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.448 2005/06/14 21:04:40 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -149,6 +149,9 @@ static int UseNewLine = 0; /* Use EOF as query delimiters */
|
||||
#endif /* TCOP_DONTUSENEWLINE */
|
||||
|
||||
|
||||
/* Backend startup time */
|
||||
TimestampTz StartTime;
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* decls for routines only used in this file
|
||||
* ----------------------------------------------------------------
|
||||
@ -2380,6 +2383,9 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
sigjmp_buf local_sigjmp_buf;
|
||||
volatile bool send_rfq = true;
|
||||
|
||||
AbsoluteTime StartTimeSec; /* integer part */
|
||||
int StartTimeUSec; /* microsecond part */
|
||||
|
||||
#define PendingConfigOption(name,val) \
|
||||
(guc_names = lappend(guc_names, pstrdup(name)), \
|
||||
guc_values = lappend(guc_values, pstrdup(val)))
|
||||
@ -2969,6 +2975,15 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
*/
|
||||
pgstat_bestart();
|
||||
|
||||
/*
|
||||
* Get stand-alone backend startup time
|
||||
*/
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
StartTimeSec = GetCurrentAbsoluteTimeUsec(&StartTimeUSec);
|
||||
StartTime = AbsoluteTimeUsecToTimestampTz(StartTimeSec, StartTimeUSec);
|
||||
}
|
||||
|
||||
/*
|
||||
* POSTGRES main processing loop begins here
|
||||
*
|
||||
|
Reference in New Issue
Block a user