pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Avoid assuming that instr_time == struct timeval in pgbench logg
Date: Sun, 01 Jan 2017 20:17:22 +0000
Message-ID: <E1cNmZG-0005GY-Rm@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cNmZG-0005GY-Rm@gemulon.postgresql.org>
Permalink:  ../E1cNmZG-0005GY-Rm@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cNmZG-0005GY-Rm@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid assuming that instr_time == struct timeval in pgbench logg
  In-Reply-To: <E1cNmZG-0005GY-Rm@gemulon.postgresql.org>
  References: <E1cNmZG-0005GY-Rm@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox