From c2509944b1a090d64a4a18dcd524ff63ee0f0212 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 8 Aug 2015 01:19:02 +0200
Subject: [PATCH] Fix bug slowing down pgbench when -P is used.

A removed check in ba3deeefb made all threads but the main one busy-loop
when -P was used. All threads computed the time to the next time the
progress report should be printed, but only the main thread did so and
re-scheduled it only for the future.

Reported-By: Jesper Pedersen
Discussion: 55C4E190.3050104@redhat.com
---
 src/bin/pgbench/pgbench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 30a59afcce..6f5bd994a0 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3646,7 +3646,7 @@ threadRun(void *arg)
 		}
 
 		/* also wake up to print the next progress report on time */
-		if (progress && min_usec > 0)
+		if (progress && min_usec > 0 && thread->tid == 0)
 		{
 			/* get current time if needed */
 			if (now_usec == 0)
-- 
2.40.0