[COMMITTERS] pgsql: Avoid assuming that instr_time == struct timeval in pgbenchlogg - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Avoid assuming that instr_time == struct timeval in pgbenchlogg
Date
Msg-id E1cNmZG-0005GY-Rm@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Avoid assuming that instr_time == struct timeval in pgbench logging.

This code was presuming undue familiarity with the contents of the
instr_time struct.  That was already broken on Windows, and it's about
to get broken on most other platforms as well.  The simplest solution
that preserves the current output definition is to just do our own
gettimeofday() call here.  Realistically, the extra cost is probably
negligible in comparison to everything else that's going on in a
pgbench transaction, so it's not worth sweating over.

On Windows, the precision delivered by gettimeofday() is lower than
one could wish, but this is still a big improvement over printing
zeroes, as the code did before.

Discussion: https://postgr.es/m/8837.1483216839@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/74baa1e3b89c1651ade1afeffc715cac24041e2f

Modified Files
--------------
src/bin/pgbench/pgbench.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)


pgsql-committers by date:

Previous
From: Magnus Hagander
Date:
Subject: [COMMITTERS] pgsql: Silence compiler warning
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: In pgbench logging,avoid assuming that instr_times match Unix t