From cb873084d0a29db4de571c01041f64ad390e1a2f Mon Sep 17 00:00:00 2001 From: Shane Wang Date: Thu, 23 Feb 2012 21:47:19 +0800 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index a26635a19a..d7cefb245f 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() -- cgit v1.2.3-54-g00ecf