From 18146afe7fec9ba255443077ee8af7b310f74e5d Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 3 Apr 2019 12:52:37 -0700 Subject: [PATCH] 8221764: Reduce make Init.gmk logging overhead Reviewed-by: tbell --- make/Init.gmk | 8 +++++--- make/InitSupport.gmk | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/make/Init.gmk b/make/Init.gmk index b8b78fbd5e0..474fa5b49b1 100644 --- a/make/Init.gmk +++ b/make/Init.gmk @@ -238,11 +238,13 @@ else # HAS_SPEC=true ifeq ($(LOG_NOFILE), true) # Disable build log if LOG=[level,]nofile was given override BUILD_LOG_PIPE := + override BUILD_LOG_PIPE_SIMPLE := endif ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean) # We can't have a log file if we're about to remove it. override BUILD_LOG_PIPE := + override BUILD_LOG_PIPE_SIMPLE := endif ifeq ($(OUTPUT_SYNC_SUPPORTED), true) @@ -303,7 +305,7 @@ else # HAS_SPEC=true main: $(INIT_TARGETS) ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), ) $(call RotateLogFiles) - $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE) + $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE) ifneq ($(SEQUENTIAL_TARGETS), ) # Don't touch build output dir since we might be cleaning. That # means no log pipe. @@ -325,7 +327,7 @@ else # HAS_SPEC=true $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \ ( exitcode=$$? && \ $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \ - $(BUILD_LOG_PIPE) && \ + $(BUILD_LOG_PIPE_SIMPLE) && \ cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \ HAS_SPEC=true on-failure ; \ exit $$exitcode ) ) @@ -336,7 +338,7 @@ else # HAS_SPEC=true if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \ exit 1 ; \ fi - $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE) + $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE) $(call ReportProfileTimes) endif diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 005d12dae63..57d22812ad5 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -296,6 +296,9 @@ else # $(HAS_SPEC)=true BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait + # Use this for simple echo/printf commands that are never expected to print + # to stderr. + BUILD_LOG_PIPE_SIMPLE := | $(TEE) -a $(BUILD_LOG) ifneq ($(CUSTOM_ROOT), ) topdir=$(CUSTOM_ROOT) @@ -514,7 +517,7 @@ else # $(HAS_SPEC)=true "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \ $(XARGS) $(CAT) | $(SORT) -k 2`" \ "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \ - $(BUILD_LOG_PIPE) + $(BUILD_LOG_PIPE_SIMPLE) endef define ReportProfileTimes @@ -524,7 +527,7 @@ else # $(HAS_SPEC)=true $(CAT) $(BUILD_PROFILE_LOG) && \ $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \ } \ - $(BUILD_LOG_PIPE) + $(BUILD_LOG_PIPE_SIMPLE) ) endef