summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamal Mostafa <kamal@whence.com>2012-04-20 16:05:55 +0000
committerKamal Mostafa <kamal@whence.com>2012-04-20 16:05:55 +0000
commit66d0e7f2234cb779c3f19b743b3f91b05b598f24 (patch)
treef24a2eef3d7d0069bb968c488a0d8ffaea6a6f5a
parent3aeae5f2a6725c19f67c54c45c2ba4273ccc8030 (diff)
downloaddistcc-git-66d0e7f2234cb779c3f19b743b3f91b05b598f24.tar.gz
Fix issue 108 <http://code.google.com/p/distcc/issues/detail?id=108>:
include_server --no_force_dirs inhibits forcing_technique The "forcing_technique" trick which handles the (rare) case of files included as e.g. <foo/../file.h> causes a performance degradation: The forcing files accumulate over the life of the include_server, making distcc send more and more (useless) files as the build progresses. While the forcing files are zero-length, the transmission filenames themselves introduce a significant overhead for builds with many files and directories. This patch implements the include_server arg --no_force_dirs, which if set switches off the "forcing_technique" scheme.
-rwxr-xr-xinclude_server/basics.py1
-rwxr-xr-xinclude_server/include_analyzer.py7
-rwxr-xr-xinclude_server/include_server.py9
-rw-r--r--man/include_server.17
4 files changed, 22 insertions, 2 deletions
diff --git a/include_server/basics.py b/include_server/basics.py
index 0854aa5..f2c5301 100755
--- a/include_server/basics.py
+++ b/include_server/basics.py
@@ -220,6 +220,7 @@ opt_simple_algorithm = False
opt_stat_reset_triggers = {}
opt_statistics = False
opt_unsafe_absolute_includes = False
+opt_no_force_dirs = False
opt_verify = False # whether to compare calculated include closure to that
# produced by compiler
opt_write_include_closure = False # write include closures to file
diff --git a/include_server/include_analyzer.py b/include_server/include_analyzer.py
index 576fa17..2c0fa5c 100755
--- a/include_server/include_analyzer.py
+++ b/include_server/include_analyzer.py
@@ -271,9 +271,12 @@ class IncludeAnalyzer(object):
links = self.compiler_defaults.system_links + self.mirror_path.Links()
files = self.compress_files.Compress(include_closure, client_root_keeper)
- forcing_files = self._ForceDirectoriesToExist()
+ files_and_links = files + links
- files_and_links = files + links + forcing_files
+ # Note that the performance degradation comment above applies especially
+ # to forced include directories, unless disabled with --no_force_dirs
+ if basics.opt_no_force_dirs == False:
+ files_and_links += self._ForceDirectoriesToExist()
realpath_map = self.realpath_map
diff --git a/include_server/include_server.py b/include_server/include_server.py
index b7aa0d8..886baac 100755
--- a/include_server/include_server.py
+++ b/include_server/include_server.py
@@ -116,6 +116,12 @@ OPTIONS:
gathering the include closure. See the
include_server(1) man page for futher information.
Using this option may lead to incorrect results.
+
+ --no_force_dirs Do not force the creation of all directories used
+ in an include path. May improve peformance for
+ some cases, but will break builds which use
+ include structures like "<foo/../file.h>" without
+ including other files in foo/.
-v, --verify Verify that files in CPP closure are contained in
closure calculated by include processor.
@@ -482,6 +488,7 @@ def _ParseCommandLineOptions():
"statistics",
"time",
"unsafe_absolute_includes",
+ "no_force_dirs",
"verify",
"write_include_closure"])
except getopt.GetoptError:
@@ -517,6 +524,8 @@ def _ParseCommandLineOptions():
sys.exit("Not implemented")
if opt in ("--unsafe_absolute_includes",):
basics.opt_unsafe_absolute_includes = True
+ if opt in ("--no_force_dirs",):
+ basics.opt_no_force_dirs = True
if opt in ("-s", "--statistics"):
basics.opt_statistics = True
if opt in ("-t", "--time"):
diff --git a/man/include_server.1 b/man/include_server.1
index f462f89..2db9e5d 100644
--- a/man/include_server.1
+++ b/man/include_server.1
@@ -109,6 +109,13 @@ of existence of the header file is moot and the remote compilation is sound.
This is often the case if such includes are meant for unusual configurations
different from the actual configuration.
.TP
+.B --no_force_dirs
+Do not force the creation of all directories used
+in an include path. May improve peformance for
+some cases, but will break builds which use
+include structures like "<foo/../file.h>" without
+including other files in foo/.
+.TP
.B -v, --verify
Verify that files in CPP closure are contained in
closure calculated by include processor.