pgsql: In pgbench logging, avoid assuming that instr_times match Unix t

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: In pgbench logging, avoid assuming that instr_times match Unix t
Date: 2017-01-02 17:26:19
Message-ID: E1cO6NH-0002XM-5t@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

For aggregated logging, pg_bench supposed that printing the integer part of
INSTR_TIME_GET_DOUBLE() would produce a Unix timestamp. That was already
broken on Windows, and it's about to get broken on most other platforms as
well. As in commit 74baa1e3b, we can remove the entanglement at the price
of one extra syscall per transaction; though here it seems more convenient
to use time(NULL) instead of gettimeofday(), since we only need
integral-second precision.

I took the time to do some wordsmithing on the documentation about
pgbench's logging features, too.

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/67a875355e4a6db294e9652af5a883876ddeb4a5

Modified Files
--------------
doc/src/sgml/ref/pgbench.sgml | 96 ++++++++++++++++++++++++-------------------
src/bin/pgbench/pgbench.c | 62 ++++++++++++++--------------
2 files changed, 84 insertions(+), 74 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-01-02 18:49:09 pgsql: Use clock_gettime(), if available, in instr_time measurements.
Previous Message Tom Lane 2017-01-01 20:17:22 pgsql: Avoid assuming that instr_time == struct timeval in pgbench logg