Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2019 11:05:04 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Wolfram Schneider <wosch@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r345238 - head
Message-ID:  <69b2f7e10f7cc3db29432e6bf90214e2f297312d.camel@freebsd.org>
In-Reply-To: <CAMWY7CAXDQ67K0fo_vVd=5BU=WHo8xEX5DCuh%2BT9fTDkP88jtA@mail.gmail.com>
References:  <201903162002.x2GK2vmA013275@repo.freebsd.org> <0ea3a53f64016afa9dbc6f1b2d2ee25f09df00b8.camel@freebsd.org> <CAMWY7CAXDQ67K0fo_vVd=5BU=WHo8xEX5DCuh%2BT9fTDkP88jtA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2019-03-17 at 10:32 +0100, Wolfram Schneider wrote:
> On Sat, 16 Mar 2019 at 23:37, Ian Lepore <ian@freebsd.org> wrote:
> > 
> > On Sat, 2019-03-16 at 20:02 +0000, Wolfram Schneider wrote:
> > > Author: wosch
> > > Date: Sat Mar 16 20:02:57 2019
> > > New Revision: 345238
> > > URL: https://svnweb.freebsd.org/changeset/base/345238
> > > 
> > > Log:
> > >   `make buildkernel' should display the build time in seconds
> > > 
> > >   PR:         224433
> > >   Approved by:        cem
> > >   Differential Revision:      https://reviews.freebsd.org/D13910
> > > 
> > > Modified:
> > >   head/Makefile.inc1
> > > 
> > > Modified: head/Makefile.inc1
> > > =================================================================
> > > CMSG====
> > > =========
> > > --- head/Makefile.inc1        Sat Mar 16 17:55:22
> > > 2019        (r345237)
> > > +++ head/Makefile.inc1        Sat Mar 16 20:02:57
> > > 2019        (r345238)
> > > @@ -1584,6 +1584,11 @@ _cleankernobj_fast_depend_hack: .PHONY
> > > 
> > >  ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}}
> > > ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY
> > > 
> > > +# record kernel(s) build time in seconds
> > > +.if make(buildkernel)
> > > +_BUILDKERNEL_START!= date '+%s'
> > > +.endif
> > > +
> > >  #
> > >  # buildkernel
> > >  #
> > > @@ -1640,7 +1645,12 @@ buildkernel: .MAKE .PHONY
> > >       @echo "--------------------------------------------------
> > > ----
> > > --------"
> > >       @echo ">>> Kernel build for ${_kernel} completed on
> > > `LC_ALL=C
> > > date`"
> > >       @echo "--------------------------------------------------
> > > ----
> > > --------"
> > > +
> > >  .endfor
> > > +     @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \
> > > +       echo -n ">>> Kernel(s) build for${BUILDKERNELS} in
> > > $$seconds
> > > seconds, "; \
> > > +       echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make
> > > -j/}"
> > > +     @echo "--------------------------------------------------
> > > ----
> > > --------"
> > > 
> > >  NO_INSTALLEXTRAKERNELS?=     yes
> > > 
> > > 
> > 
> > Does this really report the buildkernel time, or the time from when
> > make starts until when the kernel portion of the make
> > finishes?  Will
> > the result be right when you do "make buildworld buildkernel"?
> 
> Good point, I didn't checked this yet. The handbook at
> https://www.freebsd.org/doc/handbook/makeworld.html
> 
> recommends to run buildworld and buildkernel in 2 steps:
> 
> make -j4 buildworld ; make -j4 kernel
> 
> 
> 
> PS: it seems to work fine. The time will be recorded when the make
> target is called, not when make is called.
> 

_BUILDKERNEL_START will be set to the time when the makefile is parsed,
before any target is run.  My questions were basically rhetorical; what
you've done is make it report the time from when make is launched until
when various targets complete, and each report will include the
cumulative time of any targets that ran before that point.  If the goal
is to time the entire run of make (which is effectively what this is
doing), then that is probably best addressed with .BEGIN and .END
targets in Makefile, rather than multiple duplicated entries in
Makefile.inc1.

-- Ian

> $ grep ncpu build.log
> > > > World build in 2004 seconds, ncpu: 32, make -j33
> > > > Kernel(s) build for GENERIC in 138 seconds, ncpu: 32, make -j33
> 
> -Wolfram
> 




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