cpu_count() returns multiprocessing.cpu_count() but that is simply returns
os.cpu_count() so we could use that directly.
However this returns the number of CPUs on the host, not the number of
usable CPUs on the host. If the user is using scheduler affinity then
the number of usable CPUs may be less, so when determining how many cores
we can use check the affinity instead.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
return trimmed
def cpu_count(at_least=1):
- import multiprocessing
- cpus = multiprocessing.cpu_count()
+ cpus = len(os.sched_getaffinity(0))
return max(cpus, at_least)
def execute_pre_post_process(d, cmds):