Index: pylib/gyp/generator/ninja.py |
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py |
index 25f5780dd26a5f77ad9d27662cd904b1e39e8cfc..0af9cd87e1e995255c322978d1e4b933eede4012 100644 |
--- a/pylib/gyp/generator/ninja.py |
+++ b/pylib/gyp/generator/ninja.py |
@@ -1483,6 +1483,16 @@ def GetDefaultConcurrentLinks(): |
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
return max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB |
+ elif sys.platform.startswith('linux'): |
+ meminfo = open("/proc/meminfo") |
scottmg
2013/08/21 15:44:58
with open("/proc/meminfo") as meminfo:
...
anton1
2013/08/21 16:06:59
Done.
|
+ memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') |
+ for line in meminfo: |
+ match = memtotal_re.match(line) |
+ if not match: |
+ continue |
+ # Allow 8Gb per link on Linux because Gold is quite memory hungry |
+ return max(1, int(match.group(1)) / (8 * (2 ** 20))) # total_Kb / 8GB |
scottmg
2013/08/21 15:44:58
change comment to match (MB) or remove
anton1
2013/08/21 16:06:59
Done.
|
+ return 1 |
else: |
# TODO(scottmg): Implement this for other platforms. |
return 1 |