summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2015-07-30 11:50:51 +0000
committerHeikki Linnakangas2015-07-30 11:50:51 +0000
commit5515ec0b3a9425a0c0e36e26b5774c1568f22b3a (patch)
treed96ec8345b91a16eab72a53644a708f04649f688
parenta2932283c2a39efd2f713f647c9f7f3d34123bb3 (diff)
Fix calculation of latency of pgbench backslash commands.
When we loop back to the top of doCustom after processing a backslash command, we must reset the "now" timestamp, because that's used to calculate the time spent executing the previous command. Report and fix by Fabien Coelho. Backpatch to 9.5, where this was broken.
-rw-r--r--src/bin/pgbench/pgbench.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 3b8a80fa7ad..30a59afcce5 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -1135,11 +1135,12 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
* 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".
+ * "not set yet". Reset "now" when we step to the next command with "goto
+ * top", though.
*/
+top:
INSTR_TIME_SET_ZERO(now);
-top:
commands = sql_files[st->use_file];
/*