python/makeproject: set appropriate build jobs count depending on the number of CPUs

This commit is contained in:
Felix Hädicke 2017-09-30 00:10:24 +02:00 committed by Max Kellermann
parent 4ab8a677dc
commit 302432e157
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import subprocess import subprocess, multiprocessing
from build.project import Project from build.project import Project
@ -10,7 +10,12 @@ class MakeProject(Project):
self.install_target = install_target self.install_target = install_target
def get_simultaneous_jobs(self): def get_simultaneous_jobs(self):
return 12 try:
# use twice as many simultaneous jobs as we have CPU cores
return multiprocessing.cpu_count() * 2
except NotImplementedError:
# default to 12, if multiprocessing.cpu_count() is not implemented
return 12
def get_make_args(self, toolchain): def get_make_args(self, toolchain):
return ['--quiet', '-j' + str(self.get_simultaneous_jobs())] return ['--quiet', '-j' + str(self.get_simultaneous_jobs())]