Under 9.5a1 "pgbench -r" negative latencies are reported on meta commands,
probably as an oversight of 84f0ea3f.
This patch ensures that "now" is reset on each loop inside doCustom.
--
Fabien.
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 2c3e365..cce67e8 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -1146,16 +1146,19 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
bool trans_needs_throttle = false;
instr_time now;
+top:
/*
* gettimeofday() isn't free, so we get the current timestamp lazily the
* first time it's needed, and reuse the same value throughout this
* function after that. This also ensures that e.g. the calculated latency
* reported in the log file and in the totals are the same. Zero means
* "not set yet".
+ *
+ * "now" must also be reset on "goto top;" issued when interpreting meta
+ * commands, otherwise the per-command measured latency is wrong.
*/
INSTR_TIME_SET_ZERO(now);
-top:
commands = sql_files[st->use_file];
/*
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers