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

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 23622005: ninja/mac: Allow more than one ld process at a time, based on available RAM. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« 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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 elif sys.platform.startswith('linux'): 1488 elif sys.platform.startswith('linux'):
1489 with open("/proc/meminfo") as meminfo: 1489 with open("/proc/meminfo") as meminfo:
1490 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') 1490 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB')
1491 for line in meminfo: 1491 for line in meminfo:
1492 match = memtotal_re.match(line) 1492 match = memtotal_re.match(line)
1493 if not match: 1493 if not match:
1494 continue 1494 continue
1495 # Allow 8Gb per link on Linux because Gold is quite memory hungry 1495 # Allow 8Gb per link on Linux because Gold is quite memory hungry
1496 return max(1, int(match.group(1)) / (8 * (2 ** 20))) 1496 return max(1, int(match.group(1)) / (8 * (2 ** 20)))
1497 return 1 1497 return 1
1498 elif sys.platform == 'darwin':
1499 try:
1500 avail_bytes = int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']))
1501 # A static library debug build of Chromium's unit_tests takes ~2.7GB, so
1502 # 4GB per ld process allows for some more bloat.
1503 return max(1, avail_bytes / (4 * (2 ** 30))) # total / 4GB
1504 except:
1505 return 1
1498 else: 1506 else:
1499 # TODO(scottmg): Implement this for other platforms. 1507 # TODO(scottmg): Implement this for other platforms.
1500 return 1 1508 return 1
1501 1509
1502 1510
1503 def _GetWinLinkRuleNameSuffix(embed_manifest, link_incremental): 1511 def _GetWinLinkRuleNameSuffix(embed_manifest, link_incremental):
1504 """Returns the suffix used to select an appropriate linking rule depending on 1512 """Returns the suffix used to select an appropriate linking rule depending on
1505 whether the manifest embedding and/or incremental linking is enabled.""" 1513 whether the manifest embedding and/or incremental linking is enabled."""
1506 suffix = '' 1514 suffix = ''
1507 if embed_manifest: 1515 if embed_manifest:
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 arglists.append( 2077 arglists.append(
2070 (target_list, target_dicts, data, params, config_name)) 2078 (target_list, target_dicts, data, params, config_name))
2071 pool.map(CallGenerateOutputForConfig, arglists) 2079 pool.map(CallGenerateOutputForConfig, arglists)
2072 except KeyboardInterrupt, e: 2080 except KeyboardInterrupt, e:
2073 pool.terminate() 2081 pool.terminate()
2074 raise e 2082 raise e
2075 else: 2083 else:
2076 for config_name in config_names: 2084 for config_name in config_names:
2077 GenerateOutputForConfig(target_list, target_dicts, data, params, 2085 GenerateOutputForConfig(target_list, target_dicts, data, params,
2078 config_name) 2086 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