From: Heikki Linnakangas Date: Wed, 21 Sep 2016 10:14:48 +0000 (+0300) Subject: Fix pgbench's calculation of average latency, when -T is not used. X-Git-Tag: REL9_6_0~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93834a20f67ee458c98067e253894457c5a958ad;p=postgresql Fix pgbench's calculation of average latency, when -T is not used. If the test duration was given in # of transactions (-t or no option), rather as a duration (-T), the latency average was always printed as 0. It has been broken ever since the display of latency average was added, in 9.4. Fabien Coelho Discussion: --- diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index f3d5119684..254ca95f3d 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3293,9 +3293,11 @@ printResults(TState *threads, StatsData *total, instr_time total_time, if (throttle_delay || progress || latency_limit) printSimpleStats("latency", &total->latency); else - /* only an average latency computed from the duration is available */ + { + /* no measurement, show average latency computed from run time */ printf("latency average: %.3f ms\n", - 1000.0 * duration * nclients / total->cnt); + 1000.0 * time_include * nclients / total->cnt); + } if (throttle_delay) {