From 53128274804e0030c8e780bf571b30282be6687c Mon Sep 17 00:00:00 2001 From: Ellis kenyo Date: Tue, 9 Apr 2013 22:34:46 +0200 Subject: [PATCH] Update install.sh Added more efficient option to detect number of cores on running system via nproc --- install.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 7a4d3687..968e97d5 100755 --- a/install.sh +++ b/install.sh @@ -47,16 +47,21 @@ function python_finder { } function num_cores { - num_cpus=1 - if [[ `uname -s` == "Linux" ]]; then - num_cpus=$(grep -c ^processor /proc/cpuinfo) + if [[ -e /bin/nproc ]]; then + num_cpus=$(nproc) else - # Works on Mac and FreeBSD - num_cpus=$(sysctl -n hw.ncpu) + num_cpus=1 + if [[ `uname -s` == "Linux" ]]; then + num_cpus=$(grep -c ^processor /proc/cpuinfo) + else + # Works on Mac and FreeBSD + num_cpus=$(sysctl -n hw.ncpu) + fi fi echo $num_cpus } + function install { ycm_dir=`pwd` build_dir=`mktemp -d -t ycm_build.XXXXXX`