!bmakelib.timed
Times the execution of a given target and report the duration with milliseconds precision.
The following variables will be populated:
* stdlib.vars.timed.begin-ts.TARGET_NAME (nanos)*stdlib.vars.timed.end-ts.TARGET_NAME(nanos)
* stdlib.vars.timed.duration.TARGET_NAME (millis)`
Example 1
Makefile:
Shell:
$ make my-target!bmakelib.timed
Using default value 'yes' for variable 'stdlib.conf.timed.SILENT'
😴 I slept for 2 seconds.
Target 'my-target' took 2009ms to complete.
Example 2
Makefile:
some-target :
@sleep 2
my-target : stdlib.conf.timed.SILENT = yes
my-target : some-target!bmakelib.timed
@echo ✅ Made some-target in $(stdlib.vars.timed.duration.some-target)ms 🙌
Shell:
Notes
See !timed below for a shorter name.
bmakelib.conf.timed.convenience-target
Whether to define the convenience target !timed.
Set to 'no' before including bmakelib to disable.
Precedence:
1. bmakelib.conf.timed.convenience-target (Make variable)
2. BMAKELIB_CONF_TIMED_CONVENIENCE_TARGET (environment variable)
3. yes (default)
!timed
Convenice target with a shorter and more intuitive name. It's a drop-in replacement for
!bmakelib.timed.
Lets you write
or
See also bmakelib.conf.timed.convenience-target.
# bmakelib.conf.timed.SILENT
If set to yes, causes !bmakelib.timed to emit an info containing the duration of the target.
Precedence:
1. bmakelib.conf.timed.SILENT (Make variable)
2. BMAKELIB_CONF_TIMED_SILENT (environment variable)
3. no (default)