summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKito Cheng <kito@0xlab.org>2012-06-15 15:15:50 +0800
committerKito Cheng <kito@0xlab.org>2012-06-15 15:16:50 +0800
commit70dc3e1d3d58647a7c9e4173d7a7fefd28ad81e3 (patch)
tree4358a82576c5dcaa64a6d1df77313f7ee0f08403 /core
parent3f8ff030e0c693ca0b1758612ecb571711ec2667 (diff)
downloadbuild-70dc3e1d3d58647a7c9e4173d7a7fefd28ad81e3.zip
build-70dc3e1d3d58647a7c9e4173d7a7fefd28ad81e3.tar.gz
build-70dc3e1d3d58647a7c9e4173d7a7fefd28ad81e3.tar.bz2
Profiling use aprof, enable by LOCAL_ENABLE_APROF or LOCAL_ENABLE_APROF_JNI
Change-Id: Ia95dc7318e17c0804867b22e239edccc5cbec0af
Diffstat (limited to 'core')
-rw-r--r--core/binary.mk9
-rw-r--r--core/clear_vars.mk2
-rw-r--r--core/executable.mk12
-rw-r--r--core/shared_library.mk13
-rw-r--r--core/static_library.mk7
5 files changed, 43 insertions, 0 deletions
diff --git a/core/binary.mk b/core/binary.mk
index e488200..efcec71 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -133,6 +133,15 @@ ifeq ($(strip $(LOCAL_NO_FDO_SUPPORT)),)
LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
endif
+####################################################
+## Add profiling flags if aprof is turned on
+####################################################
+ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
+ # -ffunction-sections and -fomit-frame-pointer are conflict with -pg
+ LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
+ LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
+endif
+
###########################################################
## Explicitly declare assembly-only __ASSEMBLY__ macro for
## assembly source
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 66e6232..d4d55d4 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -78,6 +78,8 @@ LOCAL_COPY_HEADERS_TO:=
LOCAL_COPY_HEADERS:=
LOCAL_FORCE_STATIC_EXECUTABLE:=
LOCAL_ADDITIONAL_DEPENDENCIES:=
+LOCAL_ENABLE_APROF:=
+LOCAL_ENABLE_APROF_JNI:=
LOCAL_COMPRESS_MODULE_SYMBOLS:=
LOCAL_STRIP_MODULE:=
LOCAL_POST_PROCESS_COMMAND:=true
diff --git a/core/executable.mk b/core/executable.mk
index 6138adb..baebc3b 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -12,6 +12,18 @@ ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
endif
+####################################################
+## Add profiling libraries if aprof is turned
+####################################################
+ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
+ ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE), true)
+ LOCAL_STATIC_LIBRARIES += libaprof libaprof_static libc libcutils
+ else
+ LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime libc
+ endif
+ LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_aux
+endif
+
include $(BUILD_SYSTEM)/dynamic_binary.mk
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
diff --git a/core/shared_library.mk b/core/shared_library.mk
index ca639eb..1c51346 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -17,12 +17,25 @@ ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
+####################################################
+## Add profiling libraries if aprof is turned
+####################################################
+ifeq ($(strip $(LOCAL_ENABLE_APROF_JNI)),true)
+ LOCAL_ENABLE_APROF := true
+ LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_jni
+endif
+
+ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
+ LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime
+endif
+
# Put the built targets of all shared libraries in a common directory
# to simplify the link line.
OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_SYSTEM)/dynamic_binary.mk
+
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
diff --git a/core/static_library.mk b/core/static_library.mk
index 4ff5a34..315c497 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -15,6 +15,13 @@ LOCAL_MODULE_SUFFIX := .a
endif
LOCAL_UNINSTALLABLE_MODULE := true
+####################################################
+## Add profiling libraries if aprof is turned
+####################################################
+ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
+ LOCAL_WHOLE_STATIC_LIBRARIES += libaprof
+endif
+
include $(BUILD_SYSTEM)/binary.mk
ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)