[CRIU] [PATCH] build: Add ability to generate gprof output

Cyrill Gorcunov gorcunov at gmail.com
Wed May 4 04:56:41 PDT 2016


Suitable for profiling. We've had this before 2.0.
As earlier, pie code is not profiled as well as
syscalls library.

So simply build as "make GMON=1".

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 Makefile        | 6 ++++++
 compel/Makefile | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 625cf31..57063c8 100644
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,12 @@ else
         CFLAGS		+= -O2 -g
 endif
 
+ifeq ($(GMON),1)
+        CFLAGS		+= -pg
+        GMONLDOPT	+= -pg
+export GMON GMONLDOPT
+endif
+
 CFLAGS			+= $(WARNINGS) $(DEFINES)
 
 #
diff --git a/compel/Makefile b/compel/Makefile
index 96709c6..5e4bd7b 100644
--- a/compel/Makefile
+++ b/compel/Makefile
@@ -4,9 +4,9 @@ ccflags-y	+= -iquote criu/include
 ccflags-y	+= -iquote compel/include
 ccflags-y	+= -DCOMPEL_VERSION=\"$(COMPEL_SO_VERSION_MAJOR).$(COMPEL_SO_VERSION_MINOR)\"
 
-host-ccflags-y	+= $(ccflags-y)
-HOSTCFLAGS	+= $(WARNINGS) $(DEFINES)
-HOSTLDFLAGS	+= $(LDFLAGS)
+host-ccflags-y	+= $(filter-out -pg $(CFLAGS-GCOV),$(ccflags-y))
+HOSTCFLAGS	+= $(filter-out -pg $(CFLAGS-GCOV),$(WARNINGS) $(DEFINES))
+HOSTLDFLAGS	+= $(filter-out -pg $(CFLAGS-GCOV),$(LDFLAGS))
 
 hostprogs-y	+= compel
 compel-objs	+= src/main.o
-- 
2.5.5



More information about the CRIU mailing list