{"thread":{"id":"37074","subject":"Profile feedback patchkit v2","startedAt":"2014-07-08T06:35:07Z","lastAt":"2014-07-08T06:35:11Z","messageCount":5,"participants":["Andi Kleen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"245511","messageId":"1404801311-15365-1-git-send-email-andi@firstfloor.org","threadId":"37074","inReplyTo":null,"subject":"Profile feedback patchkit v2","fromName":"Andi Kleen","fromEmail":"andi@firstfloor.org","sentAt":"2014-07-08T06:35:07Z","receivedAt":"2014-07-08T06:35:07Z","isPatch":false,"sender":{"key":"andi@firstfloor.org","avatar":null},"body":"Fix the bitrotted profile feedback support.\n\nChanges to v1:\n- Remove obsolete comment\n- Remove controversal diff script.\n"},{"id":"245515","messageId":"1404801311-15365-2-git-send-email-andi@firstfloor.org","threadId":"37074","inReplyTo":"1404801311-15365-1-git-send-email-andi@firstfloor.org","subject":"[PATCH 1/4] Use BASIC_FLAGS for profile feedback","fromName":"Andi Kleen","fromEmail":"andi@firstfloor.org","sentAt":"2014-07-08T06:35:08Z","receivedAt":"2014-07-08T06:35:08Z","isPatch":true,"sender":{"key":"andi@firstfloor.org","avatar":null},"body":"From: Andi Kleen <ak@linux.intel.com>\n\nUse BASIC_CFLAGS instead of CFLAGS to set up the profile feedback\noption in the Makefile.\n\nThis allows still overriding CFLAGS on the make command line\nwithout disabling profile feedback.\n\nSigned-off-by: Andi Kleen <ak@linux.intel.com>\n---\n Makefile | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 07ea105..a9770ac 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1552,13 +1552,13 @@ endif\n PROFILE_DIR := $(CURDIR)\n \n ifeq (\"$(PROFILE)\",\"GEN\")\n-\tCFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1\n+\tBASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1\n \tEXTLIBS += -lgcov\n \texport CCACHE_DISABLE = t\n \tV = 1\n else\n ifneq (\"$(PROFILE)\",\"\")\n-\tCFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1\n+\tBASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1\n \texport CCACHE_DISABLE = t\n \tV = 1\n endif\n-- \n2.0.1\n"},{"id":"245513","messageId":"1404801311-15365-3-git-send-email-andi@firstfloor.org","threadId":"37074","inReplyTo":"1404801311-15365-1-git-send-email-andi@firstfloor.org","subject":"[PATCH 2/4] Don't define away __attribute__ on gcc","fromName":"Andi Kleen","fromEmail":"andi@firstfloor.org","sentAt":"2014-07-08T06:35:09Z","receivedAt":"2014-07-08T06:35:09Z","isPatch":true,"sender":{"key":"andi@firstfloor.org","avatar":null},"body":"From: Andi Kleen <ak@linux.intel.com>\n\nProfile feedback sets -DNO_NORETURN, which causes the compat\nheader file to go into a default #else block. That #else\nblock defines away __attribute__(). Doing so causes all\nkinds of problems with the Linux and gcc system headers:\nin particular it makes the xmmintrin.h headers error out,\nbreaking the build.\n\nDon't define away __attribute__ when __GNUC__ is set.\n\nSigned-off-by: Andi Kleen <ak@linux.intel.com>\n---\n git-compat-util.h | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 96f5554..01e8695 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -291,10 +291,12 @@ extern char *gitbasename(char *);\n #else\n #define NORETURN\n #define NORETURN_PTR\n+#ifndef __GNUC__\n #ifndef __attribute__\n #define __attribute__(x)\n #endif\n #endif\n+#endif\n \n /* The sentinel attribute is valid from gcc version 4.0 */\n #if defined(__GNUC__) && (__GNUC__ >= 4)\n-- \n2.0.1\n"},{"id":"245512","messageId":"1404801311-15365-4-git-send-email-andi@firstfloor.org","threadId":"37074","inReplyTo":"1404801311-15365-1-git-send-email-andi@firstfloor.org","subject":"[PATCH 3/4] Run the perf test suite for profile feedback too","fromName":"Andi Kleen","fromEmail":"andi@firstfloor.org","sentAt":"2014-07-08T06:35:10Z","receivedAt":"2014-07-08T06:35:10Z","isPatch":true,"sender":{"key":"andi@firstfloor.org","avatar":null},"body":"From: Andi Kleen <ak@linux.intel.com>\n\nSigned-off-by: Andi Kleen <ak@linux.intel.com>\n---\n Makefile | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/Makefile b/Makefile\nindex a9770ac..ba64be9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1647,6 +1647,7 @@ ifeq ($(filter all,$(MAKECMDGOALS)),all)\n all:: profile-clean\n \t$(MAKE) PROFILE=GEN all\n \t$(MAKE) PROFILE=GEN -j1 test\n+\t$(MAKE) PROFILE=GEN -j1 perf\n endif\n endif\n \n-- \n2.0.1\n"},{"id":"245514","messageId":"1404801311-15365-5-git-send-email-andi@firstfloor.org","threadId":"37074","inReplyTo":"1404801311-15365-1-git-send-email-andi@firstfloor.org","subject":"[PATCH 4/4] Fix profile feedback with -jN and add profile-fast","fromName":"Andi Kleen","fromEmail":"andi@firstfloor.org","sentAt":"2014-07-08T06:35:11Z","receivedAt":"2014-07-08T06:35:11Z","isPatch":true,"sender":{"key":"andi@firstfloor.org","avatar":null},"body":"From: Andi Kleen <ak@linux.intel.com>\n\nProfile feedback always failed for me with -jN. The problem\nwas that there was no implicit ordering between the profile generate\nstage and the profile use stage. So some objects in the later stage\nwould be linked with profile generate objects, and fail due\nto the missing -lgcov.\n\nThis adds a new profile target that implicitely enforces the\ncorrect ordering by using submakes. Plus a profile-install target\nto also install. This is also nicer to type that PROFILE=...\n\nPlus I always run the performance test suite now for the full\nprofile run.\n\nIn addition I also added a profile-fast / profile-fast-install\ntarget the only runs the performance test suite instead of the\nwhole test suite. This significantly speeds up the profile build,\nwhich was totally dominated by test suite run time. However\nit may have less coverage of course.\n\nSigned-off-by: Andi Kleen <ak@linux.intel.com>\n---\n INSTALL  | 14 ++++++++++++--\n Makefile | 21 +++++++++++++++++----\n 2 files changed, 29 insertions(+), 6 deletions(-)\n\ndiff --git a/INSTALL b/INSTALL\nindex ba01e74..6ec7a24 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -28,7 +28,7 @@ set up install paths (via config.mak.autogen), so you can write instead\n If you're willing to trade off (much) longer build time for a later\n faster git you can also do a profile feedback build with\n \n-\t$ make prefix=/usr PROFILE=BUILD all\n+\t$ make prefix=/usr profile\n \t# make prefix=/usr PROFILE=BUILD install\n \n This will run the complete test suite as training workload and then\n@@ -36,10 +36,20 @@ rebuild git with the generated profile feedback. This results in a git\n which is a few percent faster on CPU intensive workloads.  This\n may be a good tradeoff for distribution packagers.\n \n+Alternatively you can run profile feedback only with the git benchmark\n+suite. This runs significantly faster than the full test suite, but\n+has less coverage:\n+\n+\t$ make prefix=/usr profile-fast\n+\t# make prefix=/usr PROFILE=BUILD install\n+\n Or if you just want to install a profile-optimized version of git into\n your home directory, you could run:\n \n-\t$ make PROFILE=BUILD install\n+\t$ make profile-install\n+\n+or\n+\t$ make profile-fast-install\n \n As a caveat: a profile-optimized build takes a *lot* longer since the\n git tree must be built twice, and in order for the profiling\ndiff --git a/Makefile b/Makefile\nindex ba64be9..a760402 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1643,13 +1643,20 @@ SHELL = $(SHELL_PATH)\n all:: shell_compatibility_test\n \n ifeq \"$(PROFILE)\" \"BUILD\"\n-ifeq ($(filter all,$(MAKECMDGOALS)),all)\n-all:: profile-clean\n+all:: profile\n+endif\n+\n+profile:: profile-clean\n \t$(MAKE) PROFILE=GEN all\n \t$(MAKE) PROFILE=GEN -j1 test\n \t$(MAKE) PROFILE=GEN -j1 perf\n-endif\n-endif\n+\t$(MAKE) PROFILE=USE all\n+\n+profile-fast: profile-clean\n+\t$(MAKE) PROFILE=GEN all\n+\t$(MAKE) PROFILE=GEN -j1 perf\n+\t$(MAKE) PROFILE=USE all\n+\n \n all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS\n ifneq (,$X)\n@@ -2336,6 +2343,12 @@ mergetools_instdir_SQ = $(subst ','\\'',$(mergetools_instdir))\n \n install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)\n \n+profile-install: profile\n+\t$(MAKE) install\n+\n+profile-fast-install: profile-fast\n+\t$(MAKE) install\n+\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n-- \n2.0.1\n"}]}