Skip to content

Commit

Permalink
Merge branch 'ak/profile-feedback-build'
Browse files Browse the repository at this point in the history
* ak/profile-feedback-build:
  Fix profile feedback with -jN and add profile-fast
  Run the perf test suite for profile feedback too
  Don't define away __attribute__ on gcc
  Use BASIC_FLAGS for profile feedback
  • Loading branch information
Junio C Hamano committed Jul 21, 2014
2 parents dadb89d + 066dd26 commit 3b3b61c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
14 changes: 12 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,28 @@ set up install paths (via config.mak.autogen), so you can write instead
If you're willing to trade off (much) longer build time for a later
faster git you can also do a profile feedback build with

$ make prefix=/usr PROFILE=BUILD all
$ make prefix=/usr profile
# make prefix=/usr PROFILE=BUILD install

This will run the complete test suite as training workload and then
rebuild git with the generated profile feedback. This results in a git
which is a few percent faster on CPU intensive workloads. This
may be a good tradeoff for distribution packagers.

Alternatively you can run profile feedback only with the git benchmark
suite. This runs significantly faster than the full test suite, but
has less coverage:

$ make prefix=/usr profile-fast
# make prefix=/usr PROFILE=BUILD install

Or if you just want to install a profile-optimized version of git into
your home directory, you could run:

$ make PROFILE=BUILD install
$ make profile-install

or
$ make profile-fast-install

As a caveat: a profile-optimized build takes a *lot* longer since the
git tree must be built twice, and in order for the profiling
Expand Down
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1555,13 +1555,13 @@ endif
PROFILE_DIR := $(CURDIR)

ifeq ("$(PROFILE)","GEN")
CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
EXTLIBS += -lgcov
export CCACHE_DISABLE = t
V = 1
else
ifneq ("$(PROFILE)","")
CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
export CCACHE_DISABLE = t
V = 1
endif
Expand Down Expand Up @@ -1646,12 +1646,20 @@ SHELL = $(SHELL_PATH)
all:: shell_compatibility_test

ifeq "$(PROFILE)" "BUILD"
ifeq ($(filter all,$(MAKECMDGOALS)),all)
all:: profile-clean
all:: profile
endif

profile:: profile-clean
$(MAKE) PROFILE=GEN all
$(MAKE) PROFILE=GEN -j1 test
endif
endif
$(MAKE) PROFILE=GEN -j1 perf
$(MAKE) PROFILE=USE all

profile-fast: profile-clean
$(MAKE) PROFILE=GEN all
$(MAKE) PROFILE=GEN -j1 perf
$(MAKE) PROFILE=USE all


all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
ifneq (,$X)
Expand Down Expand Up @@ -2338,6 +2346,12 @@ mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))

install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)

profile-install: profile
$(MAKE) install

profile-fast-install: profile-fast
$(MAKE) install

install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Expand Down
2 changes: 2 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,12 @@ extern char *gitbasename(char *);
#else
#define NORETURN
#define NORETURN_PTR
#ifndef __GNUC__
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
#endif

/* The sentinel attribute is valid from gcc version 4.0 */
#if defined(__GNUC__) && (__GNUC__ >= 4)
Expand Down

0 comments on commit 3b3b61c

Please sign in to comment.