[LEDE-DEV] [PATCH] build: log time taken by each packages/steps

Etienne Champetier champetier.etienne at gmail.com
Fri Mar 30 21:22:28 PDT 2018


The idea is to easily get the list of packages taking the most time to build,
and see if we can improve them

Use SetupHostCommand as recommended by John

Signed-off-by: Etienne Champetier <champetier.etienne at gmail.com>
---
 include/prereq-build.mk | 5 +++++
 include/subdir.mk       | 1 +
 2 files changed, 6 insertions(+)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 6a423d2c7d..7d5b2f2b45 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -139,6 +139,11 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
 $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
 	wget --version | grep GNU))
 
+$(eval $(call SetupHostCommand,gtime,Please install GNU 'time', \
+	gtime --version 2>&1 | grep GNU, \
+	/usr/bin/time --version 2>&1 | grep GNU, \
+	time --version 2>&1 | grep GNU))
+
 $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
 	perl --version | grep "perl.*v5"))
 
diff --git a/include/subdir.mk b/include/subdir.mk
index 79a80528ae..546ed57ae6 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -43,6 +43,7 @@ log_make = \
 	 $(if $(BUILD_LOG), \
 		set -o pipefail; \
 		mkdir -p $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4));) \
+	gtime -f "time:$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2)\#%U\#%S\#%e" -- \
 	$$(SUBMAKE) $(subdir_make_opts) $(if $(3),$(3)-)$(2) \
 		$(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2).txt)
 
-- 
2.14.3




More information about the Lede-dev mailing list