8221764: Reduce make Init.gmk logging overhead
Reviewed-by: tbell
This commit is contained in:
parent
004b3ee748
commit
18146afe7f
@ -238,11 +238,13 @@ else # HAS_SPEC=true
|
|||||||
ifeq ($(LOG_NOFILE), true)
|
ifeq ($(LOG_NOFILE), true)
|
||||||
# Disable build log if LOG=[level,]nofile was given
|
# Disable build log if LOG=[level,]nofile was given
|
||||||
override BUILD_LOG_PIPE :=
|
override BUILD_LOG_PIPE :=
|
||||||
|
override BUILD_LOG_PIPE_SIMPLE :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
|
ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
|
||||||
# We can't have a log file if we're about to remove it.
|
# We can't have a log file if we're about to remove it.
|
||||||
override BUILD_LOG_PIPE :=
|
override BUILD_LOG_PIPE :=
|
||||||
|
override BUILD_LOG_PIPE_SIMPLE :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
|
ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
|
||||||
@ -303,7 +305,7 @@ else # HAS_SPEC=true
|
|||||||
main: $(INIT_TARGETS)
|
main: $(INIT_TARGETS)
|
||||||
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
|
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
|
||||||
$(call RotateLogFiles)
|
$(call RotateLogFiles)
|
||||||
$(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
|
$(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
|
||||||
ifneq ($(SEQUENTIAL_TARGETS), )
|
ifneq ($(SEQUENTIAL_TARGETS), )
|
||||||
# Don't touch build output dir since we might be cleaning. That
|
# Don't touch build output dir since we might be cleaning. That
|
||||||
# means no log pipe.
|
# means no log pipe.
|
||||||
@ -325,7 +327,7 @@ else # HAS_SPEC=true
|
|||||||
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
|
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
|
||||||
( exitcode=$$? && \
|
( exitcode=$$? && \
|
||||||
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
|
$(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 \
|
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
|
||||||
HAS_SPEC=true on-failure ; \
|
HAS_SPEC=true on-failure ; \
|
||||||
exit $$exitcode ) )
|
exit $$exitcode ) )
|
||||||
@ -336,7 +338,7 @@ else # HAS_SPEC=true
|
|||||||
if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
|
if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
|
||||||
exit 1 ; \
|
exit 1 ; \
|
||||||
fi
|
fi
|
||||||
$(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
|
$(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
|
||||||
$(call ReportProfileTimes)
|
$(call ReportProfileTimes)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -296,6 +296,9 @@ else # $(HAS_SPEC)=true
|
|||||||
BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
|
BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
|
||||||
|
|
||||||
BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait
|
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), )
|
ifneq ($(CUSTOM_ROOT), )
|
||||||
topdir=$(CUSTOM_ROOT)
|
topdir=$(CUSTOM_ROOT)
|
||||||
@ -514,7 +517,7 @@ else # $(HAS_SPEC)=true
|
|||||||
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
|
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
|
||||||
$(XARGS) $(CAT) | $(SORT) -k 2`" \
|
$(XARGS) $(CAT) | $(SORT) -k 2`" \
|
||||||
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
|
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
|
||||||
$(BUILD_LOG_PIPE)
|
$(BUILD_LOG_PIPE_SIMPLE)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ReportProfileTimes
|
define ReportProfileTimes
|
||||||
@ -524,7 +527,7 @@ else # $(HAS_SPEC)=true
|
|||||||
$(CAT) $(BUILD_PROFILE_LOG) && \
|
$(CAT) $(BUILD_PROFILE_LOG) && \
|
||||||
$(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
|
$(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
|
||||||
} \
|
} \
|
||||||
$(BUILD_LOG_PIPE)
|
$(BUILD_LOG_PIPE_SIMPLE)
|
||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user