aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2015-07-30 14:50:51 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2015-07-30 14:51:08 +0300
commit2e75be6660dbaaf2da09b98c54d47c9fe0ac8cfa (patch)
tree27c72c4e9a7a3efeec723e9393cc50e20ba6cb33 /src
parenta664d4790e5f93726f264c77c044a7ce4c1a675c (diff)
downloadpostgresql-2e75be6660dbaaf2da09b98c54d47c9fe0ac8cfa.tar.gz
postgresql-2e75be6660dbaaf2da09b98c54d47c9fe0ac8cfa.zip
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.
Diffstat (limited to 'src')
-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 ceaf14cde16..d48e5b78443 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -1154,11 +1154,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];
/*