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>
This commit is contained in:
parent
c42f973180
commit
cb873084d0
|
@ -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:
|
||||
"""
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue