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

Unified Diff: gclient_utils.py

Issue 11140019: Make gclient sync use cpu count for default jobs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: pylint disable Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index ab45d28cc6bed09de46c4163dde258dbf7de96c3..78fa7222adc4bae3d8c8696186ecc38352d5a8f8 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -769,3 +769,17 @@ def ParseCodereviewSettingsContent(content):
fix_url('CODE_REVIEW_SERVER')
fix_url('VIEW_VC')
return keyvals
+
+
+def NumLocalCpus():
+ """Returns the number of processors.
+
+ Python on OSX 10.6 raises a NotImplementedError exception.
+ """
+ try:
+ import multiprocessing
+ return multiprocessing.cpu_count()
+ except: # pylint: disable=W0702
+ # Mac OS 10.6 only
+ # pylint: disable=E1101
+ return int(os.sysconf('SC_NPROCESSORS_ONLN'))
« no previous file with comments | « gclient.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698