[openwrt/openwrt] build: log time taken by each packages/steps

LEDE Commits lede-commits at lists.infradead.org
Mon May 7 01:40:11 PDT 2018


blogic pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/ff6e62b288cab103f9dd4200b49ec6dc47375eb8

commit ff6e62b288cab103f9dd4200b49ec6dc47375eb8
Author: Etienne Champetier <champetier.etienne at gmail.com>
AuthorDate: Mon Apr 30 12:55:12 2018 -0700

    build: log time taken by each packages/steps
    
    The idea is to easily get the list of packages taking the most time to build,
    and see if we can improve them
    
    v1: Use SetupHostCommand as recommended by John
    v2: add space after 'time:', remove useless /usr/bin/time from SetupHostCommand
    
    Signed-off-by: Etienne Champetier <champetier.etienne at gmail.com>
---
 include/prereq-build.mk | 4 ++++
 include/subdir.mk       | 1 +
 2 files changed, 5 insertions(+)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 5b9a7e0..bac5fdc 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -138,6 +138,10 @@ $(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, \
+	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 79a8052..ed4f753 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)
 



More information about the lede-commits mailing list