mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +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:
@ -42,7 +42,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.169 2006/03/05 15:58:46 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.170 2006/06/20 22:52:00 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1408,7 +1408,7 @@ log_line_prefix(StringInfo buf)
|
||||
if (MyProcPort)
|
||||
{
|
||||
appendStringInfo(buf, "%lx.%x",
|
||||
(long) (MyProcPort->session_start.tv_sec),
|
||||
(long) (MyProcPort->session_start),
|
||||
MyProcPid);
|
||||
}
|
||||
break;
|
||||
@ -1440,7 +1440,7 @@ log_line_prefix(StringInfo buf)
|
||||
|
||||
strftime(strfbuf, sizeof(strfbuf),
|
||||
/* leave room for milliseconds... */
|
||||
/* Win32 timezone names are too long so don't print them. */
|
||||
/* Win32 timezone names are too long so don't print them */
|
||||
#ifndef WIN32
|
||||
"%Y-%m-%d %H:%M:%S %Z",
|
||||
#else
|
||||
@ -1474,12 +1474,11 @@ log_line_prefix(StringInfo buf)
|
||||
case 's':
|
||||
if (MyProcPort)
|
||||
{
|
||||
time_t stamp_time = MyProcPort->session_start.tv_sec;
|
||||
char strfbuf[128];
|
||||
|
||||
strftime(strfbuf, sizeof(strfbuf),
|
||||
"%Y-%m-%d %H:%M:%S %Z",
|
||||
localtime(&stamp_time));
|
||||
localtime(&MyProcPort->session_start));
|
||||
appendStringInfoString(buf, strfbuf);
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user