summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamal@whence.com <kamal@whence.com@01de4be4-8c4a-0410-9132-4925637da917>2012-04-04 20:22:04 +0000
committerkamal@whence.com <kamal@whence.com@01de4be4-8c4a-0410-9132-4925637da917>2012-04-04 20:22:04 +0000
commit14171eb36f552625629bf84ec6fd131b1d1e977a (patch)
treecd1b739acf4178af40c2a17fbb74b33bae649ac5
parent10a264caa0eeff8dd8b6dde00d42dc841b862335 (diff)
downloaddistcc-14171eb36f552625629bf84ec6fd131b1d1e977a.tar.gz
Fix for distcc issue 102 <http://code.google.com/p/distcc/issues/detail?id=102>:
"all servers busy" dcc_lock_pause is hardcoded at 1 sec, could be tunable. Makes the pause time tunable via a new env var DISTCC_PAUSE_TIME_MSEC. The default remains set for 1 second. git-svn-id: http://distcc.googlecode.com/svn/trunk@760 01de4be4-8c4a-0410-9132-4925637da917
-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);
}