1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Move the "instr_time" typedef and associated macros into a new header

file portability/instr_time.h, and add a couple more macros to eliminate
some abstraction leakage we formerly had.  Also update psql to use this
header instead of its own copy of nearly the same code.

This commit in itself is just code cleanup and shouldn't change anything.
It lays some groundwork for the upcoming function-stats patch, though.
This commit is contained in:
Tom Lane
2008-05-14 19:10:29 +00:00
parent 719a115874
commit 3bc25384d7
8 changed files with 178 additions and 131 deletions

View File

@ -7,7 +7,7 @@
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/instrument.c,v 1.20 2008/01/01 19:45:49 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/instrument.c,v 1.21 2008/05/14 19:10:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -55,25 +55,7 @@ InstrStopNode(Instrumentation *instr, double nTuples)
}
INSTR_TIME_SET_CURRENT(endtime);
#ifndef WIN32
instr->counter.tv_sec += endtime.tv_sec - instr->starttime.tv_sec;
instr->counter.tv_usec += endtime.tv_usec - instr->starttime.tv_usec;
/* Normalize after each add to avoid overflow/underflow of tv_usec */
while (instr->counter.tv_usec < 0)
{
instr->counter.tv_usec += 1000000;
instr->counter.tv_sec--;
}
while (instr->counter.tv_usec >= 1000000)
{
instr->counter.tv_usec -= 1000000;
instr->counter.tv_sec++;
}
#else /* WIN32 */
instr->counter.QuadPart += (endtime.QuadPart - instr->starttime.QuadPart);
#endif
INSTR_TIME_ACCUM_DIFF(instr->counter, endtime, instr->starttime);
INSTR_TIME_SET_ZERO(instr->starttime);