summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/distcc.18
-rw-r--r--src/where.c11
2 files changed, 16 insertions, 3 deletions
diff --git a/man/distcc.1 b/man/distcc.1
index 8f6223c..e335d05 100644
--- a/man/distcc.1
+++ b/man/distcc.1
@@ -769,6 +769,14 @@ takes a long time, consider increasing this value so the job does
not time out and fallback to a local compile. By default set to
300 seconds.
.TP
+.B "DISTCC_PAUSE_TIME_MSEC"
+Specifies how long (in milliseconds) distcc will pause when all
+compilation servers are in use.
+By default set to 1000 milliseconds (1 second).
+Setting this to a smaller value (e.g. 10 milliconds) may improve
+throughput for some configurations, at the expense of increased CPU
+load on the distcc client machine.
+.TP
.B "DISTCC_SAVE_TEMPS"
If set to 1, temporary files are not deleted after use. Good for
debugging, or if your disks are too empty.
diff --git a/src/where.c b/src/where.c
index 6e4c5dd..6bd3168 100644
--- a/src/where.c
+++ b/src/where.c
@@ -122,15 +122,20 @@ static void dcc_lock_pause(void)
* really necessary, and also by making jobs complete very-out-of-order is
* more likely to find Makefile bugs. */
- unsigned pause_time = 1;
+ unsigned pause_time_ms = 1000;
+
+ char *pt = getenv("DISTCC_PAUSE_TIME_MSEC");
+ if (pt)
+ pause_time_ms = atoi(pt);
/* This call to dcc_note_state() is made before the host is known, so it
does not make sense and does nothing useful as far as I can tell. */
/* dcc_note_state(DCC_PHASE_BLOCKED, NULL, NULL, DCC_UNKNOWN); */
- rs_trace("nothing available, sleeping %us...", pause_time);
+ rs_trace("nothing available, sleeping %ums...", pause_time_ms);
- sleep(pause_time);
+ if (pause_time_ms > 0)
+ usleep(pause_time_ms * 1000);
}