diff options
| author | Shane Wang <shane.wang@intel.com> | 2012-02-23 21:47:19 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-23 22:52:16 +0000 |
| commit | cb873084d0a29db4de571c01041f64ad390e1a2f (patch) | |
| tree | d1af254c8bfdddd8ebb3925a8d755ef7e0954034 /bitbake/lib/bb/utils.py | |
| parent | c42f973180d2e2dd959cfd416bbd5a71aa60cffa (diff) | |
| download | 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/lib/bb/utils.py')
| -rw-r--r-- | bitbake/lib/bb/utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
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 | |||
| 25 | import logging | 25 | import logging |
| 26 | import bb | 26 | import bb |
| 27 | import bb.msg | 27 | import bb.msg |
| 28 | import multiprocessing | ||
| 28 | from commands import getstatusoutput | 29 | from commands import getstatusoutput |
| 29 | from contextlib import contextmanager | 30 | from contextlib import contextmanager |
| 30 | 31 | ||
| @@ -862,3 +863,6 @@ def contains(variable, checkvalues, truevalue, falsevalue, d): | |||
| 862 | if checkvalues.issubset(val): | 863 | if checkvalues.issubset(val): |
| 863 | return truevalue | 864 | return truevalue |
| 864 | return falsevalue | 865 | return falsevalue |
| 866 | |||
| 867 | def cpu_count(): | ||
| 868 | return multiprocessing.cpu_count() | ||
