I haven't had time to really review the code here (except to notice
that you have a typo: "nedded") but the idea of it seems good.
v3 rebase (after pgbench moved to src/bin) and minor style tweaking.
--
Fabien.
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 06a4dfd..38dc4a5 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3607,6 +3607,28 @@ threadRun(void *arg)
maxsock = sock;
}
+ /* also meet the next progress report time if needed */
+ if (progress && min_usec > 0
+#if !defined(PTHREAD_FORK_EMULATION)
+ && thread->tid == 0
+#endif /* !PTHREAD_FORK_EMULATION */
+ )
+ {
+ /* get current time if needed */
+ if (now_usec == 0)
+ {
+ instr_time now;
+
+ INSTR_TIME_SET_CURRENT(now);
+ now_usec = INSTR_TIME_GET_MICROSEC(now);
+ }
+
+ if (now_usec >= next_report)
+ min_usec = 0;
+ else if ((next_report - now_usec) < min_usec)
+ min_usec = next_report - now_usec;
+ }
+
if (min_usec > 0 && maxsock != -1)
{
int nsocks; /* return from select(2) */
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers