summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-02-23 21:47:19 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-23 22:52:16 +0000
commitcb873084d0a29db4de571c01041f64ad390e1a2f (patch)
treed1af254c8bfdddd8ebb3925a8d755ef7e0954034 /bitbake
parentc42f973180d2e2dd959cfd416bbd5a71aa60cffa (diff)
downloadast2050-yocto-poky-cb873084d0a29db4de571c01041f64ad390e1a2f.zip
ast2050-yocto-poky-cb873084d0a29db4de571c01041f64ad390e1a2f.tar.gz
command.py: add new API to get the cpu count on the server
Add a new API in command.py to get the cpu count in order to set the appropriate default BB_NUMBER_THREADS and PARALLEL_MAKE variables. (Bitbake rev: 335047b2e440e65713e88fabb24b47a9c82f939b) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/command.py6
-rw-r--r--bitbake/lib/bb/utils.py4
2 files changed, 10 insertions, 0 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 2a3a3af..4e9e8d6 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -173,6 +173,12 @@ class CommandsSync:
"""
command.cooker.reset()
+ def getCpuCount(self, command, params):
+ """
+ Get the CPU count on the bitbake server
+ """
+ return bb.utils.cpu_count()
+
class CommandsAsync:
"""
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index a26635a..d7cefb2 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -25,6 +25,7 @@ import errno
import logging
import bb
import bb.msg
+import multiprocessing
from commands import getstatusoutput
from contextlib import contextmanager
@@ -862,3 +863,6 @@ def contains(variable, checkvalues, truevalue, falsevalue, d):
if checkvalues.issubset(val):
return truevalue
return falsevalue
+
+def cpu_count():
+ return multiprocessing.cpu_count()
OpenPOWER on IntegriCloud