The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=afa70490ee779646fa0e936801cb28795580bf01
commit afa70490ee779646fa0e936801cb28795580bf01 Author: Wolfram Schneider <wo...@freebsd.org> AuthorDate: 2025-06-29 10:48:55 +0000 Commit: Wolfram Schneider <wo...@freebsd.org> CommitDate: 2025-06-29 10:48:55 +0000 src/Makefile: log real/user/system time for build targets For some of our build targets such as buildworld, buildkernel etc. we log the real time in seconds how long the build runs. Now we log the user and system time as well in milliseconds for most build targets. Example output: make buildworld [....] >>> Time spent on target buildworld: real 2286.42 user 62870.84 sys 2294.22 PR: 287274 --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4afec2a80c60..d600eb69ed4b 100644 --- a/Makefile +++ b/Makefile @@ -376,13 +376,22 @@ buildworld: upgrade_checks kernel-toolchain: upgrade_checks .endif +# we need the system time(1) command, not from the shell +time_cmd= /usr/bin/time + +# mktemp(1) is not portable +mktemp_cmd= mktemp /tmp/_time-logging-XXXXXXXXX + # # Handle the user-driven targets, using the source relative mk files. # tinderbox toolchains kernel-toolchains: .MAKE ${TGTS}: .PHONY .MAKE - ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} + ${_+_}@cd ${.CURDIR}; _time_tmp=$$(${mktemp_cmd}); \ + ${time_cmd} -o $${_time_tmp} -p env ${_MAKE} ${.TARGET}; \ + echo ">>> Time spent on target ${.TARGET}: $$(tr '\n' ' ' < $${_time_tmp})"; \ + rm -f $${_time_tmp} # The historic default "all" target creates files which may cause stale # or (in the cross build case) unlinkable results. Fail with an error