Chromium Code Reviews| 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 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 Loading... | |
| 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 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.
| |
| 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))) # 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.
| |
| 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 Loading... | |
| 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) |
| OLD | NEW |