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 collections | 5 import collections |
6 import copy | 6 import copy |
7 import hashlib | 7 import hashlib |
8 import json | 8 import json |
9 import multiprocessing | 9 import multiprocessing |
10 import os.path | 10 import os.path |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1575 | 1575 |
1576 def CommandWithWrapper(cmd, wrappers, prog): | 1576 def CommandWithWrapper(cmd, wrappers, prog): |
1577 wrapper = wrappers.get(cmd, '') | 1577 wrapper = wrappers.get(cmd, '') |
1578 if wrapper: | 1578 if wrapper: |
1579 return wrapper + ' ' + prog | 1579 return wrapper + ' ' + prog |
1580 return prog | 1580 return prog |
1581 | 1581 |
1582 | 1582 |
1583 def GetDefaultConcurrentLinks(): | 1583 def GetDefaultConcurrentLinks(): |
1584 """Returns a best-guess for a number of concurrent links.""" | 1584 """Returns a best-guess for a number of concurrent links.""" |
1585 pool_size = os.getenv('GYP_LINK_CONCURRENCY', 0) | |
scottmg
2014/06/05 21:44:53
int(os.getenv(...))
would be better, otherwise se
mtklein
2014/06/05 21:59:39
Ah, I see. PTAL?
This version works I think more
| |
1586 if pool_size != 0: | |
1587 return pool_size | |
1588 | |
1585 if sys.platform in ('win32', 'cygwin'): | 1589 if sys.platform in ('win32', 'cygwin'): |
1586 import ctypes | 1590 import ctypes |
1587 | 1591 |
1588 class MEMORYSTATUSEX(ctypes.Structure): | 1592 class MEMORYSTATUSEX(ctypes.Structure): |
1589 _fields_ = [ | 1593 _fields_ = [ |
1590 ("dwLength", ctypes.c_ulong), | 1594 ("dwLength", ctypes.c_ulong), |
1591 ("dwMemoryLoad", ctypes.c_ulong), | 1595 ("dwMemoryLoad", ctypes.c_ulong), |
1592 ("ullTotalPhys", ctypes.c_ulonglong), | 1596 ("ullTotalPhys", ctypes.c_ulonglong), |
1593 ("ullAvailPhys", ctypes.c_ulonglong), | 1597 ("ullAvailPhys", ctypes.c_ulonglong), |
1594 ("ullTotalPageFile", ctypes.c_ulonglong), | 1598 ("ullTotalPageFile", ctypes.c_ulonglong), |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2204 arglists.append( | 2208 arglists.append( |
2205 (target_list, target_dicts, data, params, config_name)) | 2209 (target_list, target_dicts, data, params, config_name)) |
2206 pool.map(CallGenerateOutputForConfig, arglists) | 2210 pool.map(CallGenerateOutputForConfig, arglists) |
2207 except KeyboardInterrupt, e: | 2211 except KeyboardInterrupt, e: |
2208 pool.terminate() | 2212 pool.terminate() |
2209 raise e | 2213 raise e |
2210 else: | 2214 else: |
2211 for config_name in config_names: | 2215 for config_name in config_names: |
2212 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2216 GenerateOutputForConfig(target_list, target_dicts, data, params, |
2213 config_name) | 2217 config_name) |
OLD | NEW |