From 49e015b8de3727910e215079a8a3941098e71c23 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Fri, 16 Jun 2017 14:06:48 +0200 Subject: Choose # of threads based on system info (#3644) --- compile.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile.sh b/compile.sh index 05a83db04..5076be7fe 100755 --- a/compile.sh +++ b/compile.sh @@ -56,7 +56,7 @@ errorArguments () echo "options:" echo " -m The compilation mode. Either \"Release\" or \"Debug\". Defaults to \"$DEFAULT_BUILDTYPE\"" echo ' -t The number of threads to use for compiling' - echo ' If unspecified, a "smart guess" is attempted (Currently simply picks 2)' + echo ' If unspecified, a "smart guess" is attempted' echo ' -b The branch to compile. (Currently unused and pinned to MASTER)' echo ' -n Prevent interactive mode' echo ' -d Dry run. Print the chosen settings and exit' @@ -361,7 +361,13 @@ fi autoChooseThreads() { - echo "$DEFAULT_THREADS" # Todo choose based on system info, and fallback to DEFAULT_THREADS. + KERNEL=$(uname -s) + + if [ "$KERNEL" = "Linux" ] || [ "$KERNEL" = "Darwin" ]; then + echo $(getconf _NPROCESSORS_ONLN) + else + echo "$DEFAULT_THREADS" + fi } if [ $STATE_INTERACTIVE -eq 1 ]; then -- cgit v1.2.3