summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2011-06-19 01:07:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-06-20 21:17:57 (GMT)
commit7ddc2710b97f223a13d9ff757948cdf9c8a22f66 (patch)
tree7969d3f06521ccf0a7ae22c92496d5085b52b0f1 /Makefile
parent6520c84685660fc995a405d7b7511a903fc12e18 (diff)
downloadgit-7ddc2710b97f223a13d9ff757948cdf9c8a22f66.zip
git-7ddc2710b97f223a13d9ff757948cdf9c8a22f66.tar.gz
git-7ddc2710b97f223a13d9ff757948cdf9c8a22f66.tar.bz2
Add profile feedback build to git
Add a gcc profile feedback build option "profile-all" to the main Makefile. It simply runs the test suite to generate feedback data and the recompiles the main executables with that. The basic structure is similar to the existing gcov code. gcc is often able to generate better code with profile feedback data. The training load also doesn't need to be too similar to the actual load, it still gives benefits. The test suite run is unfortunately quite long. It would be good to find a suitable subset that runs faster and still gives reasonable feedback. For now the test suite runs single threaded (I had some trouble running the test suite with -jX) I tested it with git gc and git blame kernel/sched.c on a Linux kernel tree. For gc I get about 2.7% improvement in wall clock time by using the feedback build, for blame about 2.4%. That's not gigantic, but not shabby either for a very small patch. If anyone has any favourite CPU intensive git benchmarks feel free to try them too. I hope distributors will switch to use a feedback build in their packages. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 16 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 03b4499..2d7f6ba 100644
--- a/Makefile
+++ b/Makefile
@@ -2492,3 +2492,19 @@ cover_db: coverage-report
cover_db_html: cover_db
cover -report html -outputdir cover_db_html cover_db
+
+### profile feedback build
+#
+.PHONY: profile-all profile-clean
+
+PROFILE_GEN_CFLAGS := $(CFLAGS) -fprofile-generate -DNO_NORETURN=1
+PROFILE_USE_CFLAGS := $(CFLAGS) -fprofile-use -fprofile-correction -DNO_NORETURN=1
+
+profile-clean:
+ $(RM) $(addsuffix *.gcda,$(object_dirs))
+ $(RM) $(addsuffix *.gcno,$(object_dirs))
+
+profile-all: profile-clean
+ $(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" all
+ $(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" -j1 test
+ $(MAKE) CFLAGS="$(PROFILE_USE_CFLAGS)" all