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 <ak@linux.intel.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Andi Kleen committed Jul 7, 2014 at 23:35 UTC 066dd2632acf11a348ff209b79f42c1a87a71fbb
2 files changed +29 -6
INSTALL
+12 -2
@@ -28,7 +28,7 @@ set up install paths (via config.mak.autogen), so you can write instead
28 If you're willing to trade off (much) longer build time for a later
29 faster git you can also do a profile feedback build with
30
31 - $ make prefix=/usr PROFILE=BUILD all
31 + $ make prefix=/usr profile
32 # make prefix=/usr PROFILE=BUILD install
33
34 This will run the complete test suite as training workload and then
@@ -36,10 +36,20 @@ rebuild git with the generated profile feedback. This results in a git
36 which is a few percent faster on CPU intensive workloads. This
37 may be a good tradeoff for distribution packagers.
38
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 +
46 Or if you just want to install a profile-optimized version of git into
47 your home directory, you could run:
48
42 - $ make PROFILE=BUILD install
49 + $ make profile-install
50 +
51 +or
52 + $ make profile-fast-install
53
54 As a caveat: a profile-optimized build takes a *lot* longer since the
55 git tree must be built twice, and in order for the profiling
Makefile
+17 -4
@@ -1643,13 +1643,20 @@ SHELL = $(SHELL_PATH)
1643 all:: shell_compatibility_test
1644
1645 ifeq "$(PROFILE)" "BUILD"
1646 -ifeq ($(filter all,$(MAKECMDGOALS)),all)
1647 -all:: profile-clean
1646 +all:: profile
1647 +endif
1648 +
1649 +profile:: profile-clean
1650 $(MAKE) PROFILE=GEN all
1651 $(MAKE) PROFILE=GEN -j1 test
1652 $(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 +
1660
1661 all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
1662 ifneq (,$X)
@@ -2336,6 +2343,12 @@ mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2343
2344 install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
2345
2346 +profile-install: profile
2347 + $(MAKE) install
2348 +
2349 +profile-fast-install: profile-fast
2350 + $(MAKE) install
2351 +
2352 install: all
2353 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
2354 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'