Skip to content

Commit 066dd26

Browse files
Andi Kleengitster
Andi Kleen
authored andcommitted
Fix profile feedback with -jN and add profile-fast
Profile feedback always failed for me with -jN. The problem was that there was no implicit ordering between the profile generate stage and the profile use stage. So some objects in the later stage would be linked with profile generate objects, and fail due to the missing -lgcov. This adds a new profile target that implicitely enforces the correct ordering by using submakes. Plus a profile-install target to also install. This is also nicer to type that PROFILE=... Plus I always run the performance test suite now for the full profile run. In addition I also added a profile-fast / profile-fast-install target the only runs the performance test suite instead of the whole test suite. This significantly speeds up the profile build, which was totally dominated by test suite run time. However it may have less coverage of course. Signed-off-by: Andi Kleen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5d7fd6d commit 066dd26

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

INSTALL

+12-2
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,28 @@ set up install paths (via config.mak.autogen), so you can write instead
2828
If you're willing to trade off (much) longer build time for a later
2929
faster git you can also do a profile feedback build with
3030

31-
$ make prefix=/usr PROFILE=BUILD all
31+
$ make prefix=/usr profile
3232
# make prefix=/usr PROFILE=BUILD install
3333

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

39+
Alternatively you can run profile feedback only with the git benchmark
40+
suite. This runs significantly faster than the full test suite, but
41+
has less coverage:
42+
43+
$ make prefix=/usr profile-fast
44+
# make prefix=/usr PROFILE=BUILD install
45+
3946
Or if you just want to install a profile-optimized version of git into
4047
your home directory, you could run:
4148

42-
$ make PROFILE=BUILD install
49+
$ make profile-install
50+
51+
or
52+
$ make profile-fast-install
4353

4454
As a caveat: a profile-optimized build takes a *lot* longer since the
4555
git tree must be built twice, and in order for the profiling

Makefile

+17-4
Original file line numberDiff line numberDiff line change
@@ -1643,13 +1643,20 @@ SHELL = $(SHELL_PATH)
16431643
all:: shell_compatibility_test
16441644

16451645
ifeq "$(PROFILE)" "BUILD"
1646-
ifeq ($(filter all,$(MAKECMDGOALS)),all)
1647-
all:: profile-clean
1646+
all:: profile
1647+
endif
1648+
1649+
profile:: profile-clean
16481650
$(MAKE) PROFILE=GEN all
16491651
$(MAKE) PROFILE=GEN -j1 test
16501652
$(MAKE) PROFILE=GEN -j1 perf
1651-
endif
1652-
endif
1653+
$(MAKE) PROFILE=USE all
1654+
1655+
profile-fast: profile-clean
1656+
$(MAKE) PROFILE=GEN all
1657+
$(MAKE) PROFILE=GEN -j1 perf
1658+
$(MAKE) PROFILE=USE all
1659+
16531660

16541661
all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
16551662
ifneq (,$X)
@@ -2336,6 +2343,12 @@ mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
23362343

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

2346+
profile-install: profile
2347+
$(MAKE) install
2348+
2349+
profile-fast-install: profile-fast
2350+
$(MAKE) install
2351+
23392352
install: all
23402353
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
23412354
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'

0 commit comments

Comments
 (0)