Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 09:20:39 +0000 (UTC)
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364650 - head
Message-ID:  <202008240920.07O9Kd5H004044@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arichardson
Date: Mon Aug 24 09:20:38 2020
New Revision: 364650
URL: https://svnweb.freebsd.org/changeset/base/364650

Log:
  Also print number of available CPUs on Linux
  
  Without this change the buildworld/buildkernel epilogue looks like this:
  >>> World built in 249 seconds, sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory
  ncpu: , make -j72.
  
  Reviewed By:	emaste, bdrewery
  Differential Revision: https://reviews.freebsd.org/D26056

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Mon Aug 24 09:20:33 2020	(r364649)
+++ head/Makefile.inc1	Mon Aug 24 09:20:38 2020	(r364650)
@@ -1136,6 +1136,8 @@ _BUILDWORLD_START!= date '+%s'
 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY
 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
 
+_ncpu_cmd=sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo unknown
+
 buildworld_prologue: .PHONY
 	@echo "--------------------------------------------------------------"
 	@echo ">>> World build started on `LC_ALL=C date`"
@@ -1147,7 +1149,7 @@ buildworld_epilogue: .PHONY
 	@echo ">>> World build completed on `LC_ALL=C date`"
 	@seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \
 	  echo -n ">>> World built in $$seconds seconds, "; \
-	  echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}"
+	  echo "ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
 	@echo "--------------------------------------------------------------"
 
 #
@@ -1656,7 +1658,7 @@ buildkernel: .MAKE .PHONY
 .endfor
 	@seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \
 	  echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \
-	  echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}"
+	  echo "ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
 	@echo "--------------------------------------------------------------"
 
 NO_INSTALLEXTRAKERNELS?=	yes



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008240920.07O9Kd5H004044>