OLD | NEW |
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 json | 7 import json |
8 import multiprocessing | 8 import multiprocessing |
9 import os.path | 9 import os.path |
10 import re | 10 import re |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 ("ullAvailVirtual", ctypes.c_ulonglong), | 1550 ("ullAvailVirtual", ctypes.c_ulonglong), |
1551 ("sullAvailExtendedVirtual", ctypes.c_ulonglong), | 1551 ("sullAvailExtendedVirtual", ctypes.c_ulonglong), |
1552 ] | 1552 ] |
1553 | 1553 |
1554 stat = MEMORYSTATUSEX() | 1554 stat = MEMORYSTATUSEX() |
1555 stat.dwLength = ctypes.sizeof(stat) | 1555 stat.dwLength = ctypes.sizeof(stat) |
1556 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) | 1556 ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) |
1557 | 1557 |
1558 mem_limit = max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB | 1558 mem_limit = max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB |
1559 hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32))) | 1559 hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32))) |
1560 # return min(mem_limit, hard_cap) | 1560 return min(mem_limit, hard_cap) |
1561 # TODO(scottmg): Temporary speculative fix for OOM on builders | |
1562 # See http://crbug.com/333000. | |
1563 return 2 | |
1564 elif sys.platform.startswith('linux'): | 1561 elif sys.platform.startswith('linux'): |
1565 with open("/proc/meminfo") as meminfo: | 1562 with open("/proc/meminfo") as meminfo: |
1566 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') | 1563 memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') |
1567 for line in meminfo: | 1564 for line in meminfo: |
1568 match = memtotal_re.match(line) | 1565 match = memtotal_re.match(line) |
1569 if not match: | 1566 if not match: |
1570 continue | 1567 continue |
1571 # Allow 8Gb per link on Linux because Gold is quite memory hungry | 1568 # Allow 8Gb per link on Linux because Gold is quite memory hungry |
1572 return max(1, int(match.group(1)) / (8 * (2 ** 20))) | 1569 return max(1, int(match.group(1)) / (8 * (2 ** 20))) |
1573 return 1 | 1570 return 1 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 arglists.append( | 2138 arglists.append( |
2142 (target_list, target_dicts, data, params, config_name)) | 2139 (target_list, target_dicts, data, params, config_name)) |
2143 pool.map(CallGenerateOutputForConfig, arglists) | 2140 pool.map(CallGenerateOutputForConfig, arglists) |
2144 except KeyboardInterrupt, e: | 2141 except KeyboardInterrupt, e: |
2145 pool.terminate() | 2142 pool.terminate() |
2146 raise e | 2143 raise e |
2147 else: | 2144 else: |
2148 for config_name in config_names: | 2145 for config_name in config_names: |
2149 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2146 GenerateOutputForConfig(target_list, target_dicts, data, params, |
2150 config_name) | 2147 config_name) |
OLD | NEW |