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
This commit is contained in:
Alex Richardson 2020-08-24 09:20:38 +00:00
parent 0b862b0399
commit ebae797c82

View File

@ -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