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

Side by Side Diff: runtime/tools/utils.py

Issue 2721953004: Unset GREP_OPTIONS when extracting processor count (Closed)
Patch Set: Created 3 years, 9 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) 2011, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # This file contains a set of utilities functions used by other Python-based 5 # This file contains a set of utilities functions used by other Python-based
6 # scripts. 6 # scripts.
7 7
8 import commands 8 import commands
9 import os 9 import os
10 import platform 10 import platform
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return 'ia32' 47 return 'ia32'
48 elif id == 'i86pc': 48 elif id == 'i86pc':
49 return 'ia32' 49 return 'ia32'
50 else: 50 else:
51 return None 51 return None
52 52
53 53
54 # Try to guess the number of cpus on this machine. 54 # Try to guess the number of cpus on this machine.
55 def GuessCpus(): 55 def GuessCpus():
56 if os.path.exists("/proc/cpuinfo"): 56 if os.path.exists("/proc/cpuinfo"):
57 return int(commands.getoutput("grep -E '^processor' /proc/cpuinfo | wc -l")) 57 return int(commands.getoutput("GREP_OPTIONS= grep -E '^processor' /proc/cpui nfo | wc -l"))
58 if os.path.exists("/usr/bin/hostinfo"): 58 if os.path.exists("/usr/bin/hostinfo"):
59 return int(commands.getoutput('/usr/bin/hostinfo | grep "processors are logi cally available." | awk "{ print \$1 }"')) 59 return int(commands.getoutput('/usr/bin/hostinfo | GREP_OPTIONS= grep "proce ssors are logically available." | awk "{ print \$1 }"'))
60 win_cpu_count = os.getenv("NUMBER_OF_PROCESSORS") 60 win_cpu_count = os.getenv("NUMBER_OF_PROCESSORS")
61 if win_cpu_count: 61 if win_cpu_count:
62 return int(win_cpu_count) 62 return int(win_cpu_count)
63 return int(os.getenv("DART_NUMBER_OF_CORES", 2)) 63 return int(os.getenv("DART_NUMBER_OF_CORES", 2))
64 64
65 65
66 # Returns true if we're running under Windows. 66 # Returns true if we're running under Windows.
67 def IsWindows(): 67 def IsWindows():
68 return GuessOS() == 'win32' 68 return GuessOS() == 'win32'
69 69
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 print "IsWindows() -> ", IsWindows() 255 print "IsWindows() -> ", IsWindows()
256 256
257 257
258 class Error(Exception): 258 class Error(Exception):
259 pass 259 pass
260 260
261 261
262 if __name__ == "__main__": 262 if __name__ == "__main__":
263 import sys 263 import sys
264 Main(sys.argv) 264 Main(sys.argv)
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