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

Side by Side 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: Fixes per scottmg's suggestion 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import hashlib 6 import hashlib
7 import multiprocessing 7 import multiprocessing
8 import os.path 8 import os.path
9 import re 9 import re
10 import signal 10 import signal
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 ("ullTotalVirtual", ctypes.c_ulonglong), 1476 ("ullTotalVirtual", ctypes.c_ulonglong),
1477 ("ullAvailVirtual", ctypes.c_ulonglong), 1477 ("ullAvailVirtual", ctypes.c_ulonglong),
1478 ("sullAvailExtendedVirtual", ctypes.c_ulonglong), 1478 ("sullAvailExtendedVirtual", ctypes.c_ulonglong),
1479 ] 1479 ]
1480 1480
1481 stat = MEMORYSTATUSEX() 1481 stat = MEMORYSTATUSEX()
1482 stat.dwLength = ctypes.sizeof(stat) 1482 stat.dwLength = ctypes.sizeof(stat)
1483 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) 1483 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
1484 1484
1485 return max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB 1485 return max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB
1486 elif sys.platform.startswith('linux'):
1487 with open("/proc/meminfo") as meminfo:
1488 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB')
1489 for line in meminfo:
1490 match = memtotal_re.match(line)
1491 if not match:
1492 continue
1493 # Allow 8Gb per link on Linux because Gold is quite memory hungry
1494 return max(1, int(match.group(1)) / (8 * (2 ** 20)))
Nico 2013/08/27 22:01:04 Isn't 2**20 a megabyte, not a gigabyte? ...ah, /p
1495 return 1
1486 else: 1496 else:
1487 # TODO(scottmg): Implement this for other platforms. 1497 # TODO(scottmg): Implement this for other platforms.
1488 return 1 1498 return 1
1489 1499
1490 1500
1491 def _GetWinLinkRuleNameSuffix(embed_manifest, link_incremental): 1501 def _GetWinLinkRuleNameSuffix(embed_manifest, link_incremental):
1492 """Returns the suffix used to select an appropriate linking rule depending on 1502 """Returns the suffix used to select an appropriate linking rule depending on
1493 whether the manifest embedding and/or incremental linking is enabled.""" 1503 whether the manifest embedding and/or incremental linking is enabled."""
1494 suffix = '' 1504 suffix = ''
1495 if embed_manifest: 1505 if embed_manifest:
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 arglists.append( 2053 arglists.append(
2044 (target_list, target_dicts, data, params, config_name)) 2054 (target_list, target_dicts, data, params, config_name))
2045 pool.map(CallGenerateOutputForConfig, arglists) 2055 pool.map(CallGenerateOutputForConfig, arglists)
2046 except KeyboardInterrupt, e: 2056 except KeyboardInterrupt, e:
2047 pool.terminate() 2057 pool.terminate()
2048 raise e 2058 raise e
2049 else: 2059 else:
2050 for config_name in config_names: 2060 for config_name in config_names:
2051 GenerateOutputForConfig(target_list, target_dicts, data, params, 2061 GenerateOutputForConfig(target_list, target_dicts, data, params,
2052 config_name) 2062 config_name)
OLDNEW
« 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