1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Arrange to call localtime() during postmaster startup. On most Unixen,

the first call of localtime() in a process will read /usr/lib/tztab or
local equivalent.  Better to do this once in the postmaster and inherit
the data by fork() than to have to do it during every backend start.
This commit is contained in:
Tom Lane
2002-02-19 19:53:35 +00:00
parent 9103372f52
commit 6e546c286c

View File

@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.264 2002/01/10 01:11:45 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.265 2002/02/19 19:53:35 tgl Exp $
*
* NOTES
*
@ -723,6 +723,10 @@ PostmasterMain(int argc, char *argv[])
/*
* Set up signal handlers for the postmaster process.
*
* CAUTION: when changing this list, check for side-effects on the
* signal handling setup of child processes. See tcop/postgres.c,
* bootstrap/bootstrap.c, and postmaster/pgstat.c.
*/
pqinitmask();
PG_SETMASK(&BlockSig);
@ -749,6 +753,18 @@ PostmasterMain(int argc, char *argv[])
*/
whereToSendOutput = None;
/*
* On many platforms, the first call of localtime() incurs significant
* overhead to load timezone info from the system configuration files.
* By doing it once in the postmaster, we avoid having to do it in every
* started child process. The savings are not huge, but they add up...
*/
{
time_t now = time(NULL);
(void) localtime(&now);
}
/*
* Initialize and startup the statistics collector process
*/
@ -1793,7 +1809,6 @@ SignalChildren(int signal)
Dlelem *curr,
*next;
Backend *bp;
int mypid = getpid();
curr = DLGetHead(BackendList);
while (curr)
@ -1801,7 +1816,7 @@ SignalChildren(int signal)
next = DLGetSucc(curr);
bp = (Backend *) DLE_VAL(curr);
if (bp->pid != mypid)
if (bp->pid != MyProcPid)
{
if (DebugLvl >= 1)
elog(DEBUG, "SignalChildren: sending signal %d to process %d",
@ -2412,13 +2427,12 @@ CountChildren(void)
{
Dlelem *curr;
Backend *bp;
int mypid = getpid();
int cnt = 0;
for (curr = DLGetHead(BackendList); curr; curr = DLGetSucc(curr))
{
bp = (Backend *) DLE_VAL(curr);
if (bp->pid != mypid)
if (bp->pid != MyProcPid)
cnt++;
}
if (CheckPointPID != 0)