Skip to content

Commit 93834a2

Browse files
committed
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: <alpine.DEB.2.20.1607131015370.7486@sto>
1 parent 496c90b commit 93834a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,9 +3293,11 @@ printResults(TState *threads, StatsData *total, instr_time total_time,
32933293
if (throttle_delay || progress || latency_limit)
32943294
printSimpleStats("latency", &total->latency);
32953295
else
3296-
/* only an average latency computed from the duration is available */
3296+
{
3297+
/* no measurement, show average latency computed from run time */
32973298
printf("latency average: %.3f ms\n",
3298-
1000.0 * duration * nclients / total->cnt);
3299+
1000.0 * time_include * nclients / total->cnt);
3300+
}
32993301

33003302
if (throttle_delay)
33013303
{

0 commit comments

Comments
 (0)