Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2416)

Unified Diff: pylib/gyp/generator/ninja.py

Issue 23242012: Linux (and Android): Implement GetDefaultConcurrentLinks() for Linux Builds (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698