From 146db77025373e48dd743bbf9b526c9e1ca2d570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4dicke?= Date: Sat, 30 Sep 2017 00:10:24 +0200 Subject: [PATCH] python/makeproject: set appropriate build jobs count depending on the number of CPUs --- python/build/makeproject.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/build/makeproject.py b/python/build/makeproject.py index 667a10243..9ec95e27f 100644 --- a/python/build/makeproject.py +++ b/python/build/makeproject.py @@ -1,4 +1,4 @@ -import subprocess +import subprocess, multiprocessing from build.project import Project @@ -10,7 +10,12 @@ class MakeProject(Project): self.install_target = install_target 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): return ['--quiet', '-j' + str(self.get_simultaneous_jobs())]