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')) |