Re: Fixing pgbench's logging of transaction timestamps

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-01-02T17:28:31Z
Lists: pgsql-hackers
I wrote:
> BTW, why is it that the --aggregate-interval option is unsupported on
> Windows?  Is that an artifact of the same disease of assuming too much
> about how instr_time is represented?  I don't see any very good reason
> for it other than the weird decision to store the result of
> INSTR_TIME_GET_DOUBLE in a "long", which seems rather broken in any case.

After looking closer, I see the real issue is that it prints the integer
part of INSTR_TIME_GET_DOUBLE and documents that as being a Unix
timestamp.  So that's not going to do either.  I solved it the same way
as in the other code path, ie just eat the cost of doing our own time
inquiry.

			regards, tom lane


Commits

  1. In pgbench logging, avoid assuming that instr_times match Unix timestamps.

  2. Avoid assuming that instr_time == struct timeval in pgbench logging.