Skip to contentSkip to conversation

build-all: Simplify determination of number of CPUs

PATCH New Sedat Dilek 1 participant 1 message Mar 28, 2014 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build-all: Simplify determination of number of CPUs

Use 'getconf _NPROCESSORS_ONLN' to determine the total number of available ("online") CPUs.

I have seen this 1st in some build-scripts of Grml project and had some discussions with Thorsten Glaser on this topic.

---
 build-all | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
build-all +1 -2
index 9d2959e..50b3d45 100755
@@ -6,8 +6,7 @@ else
 	. config
 fi
 
-nr_cpus=$(expr 1 + $(grep ^processor /proc/cpuinfo | tail -1 | \
-		sed -e 's/.*://') )
+nr_cpus=$(getconf _NPROCESSORS_ONLN)
 J=-j$(expr $nr_cpus \* 2)
 
 DESTDIR=$(pwd)/bld
Signature · 1 line
1.9.1