Skip to content

Commit 65c6556

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 46b55e7 commit 65c6556

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
@@ -3296,9 +3296,11 @@ printResults(TState *threads, StatsData *total, instr_time total_time,
32963296
if (throttle_delay || progress || latency_limit)
32973297
printSimpleStats("latency", &total->latency);
32983298
else
3299-
/* only an average latency computed from the duration is available */
3299+
{
3300+
/* no measurement, show average latency computed from run time */
33003301
printf("latency average: %.3f ms\n",
3301-
1000.0 * duration * nclients / total->cnt);
3302+
1000.0 * time_include * nclients / total->cnt);
3303+
}
33023304

33033305
if (throttle_delay)
33043306
{

0 commit comments

Comments
 (0)