aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-03-17 16:08:14 -0700
committerJeff Brown <jeffbrown@google.com>2011-04-05 13:04:39 -0700
commitc3efb236108cf27a97d4cf7f05ee4a9a02f8e5fa (patch)
treeff9d77baf9b5e8f0f19e46b98bf26d737a7816ab
parentc26010c3ef84ee69a148788e17c75d12d23fadbd (diff)
downloadoprofile-c3efb236108cf27a97d4cf7f05ee4a9a02f8e5fa.tar.gz
Build oprofile tools on the host.
Change-Id: I9911afe75ad24b5d39aedee4cf4c27ce418d033c
-rw-r--r--Android.mk14
-rw-r--r--common.mk51
-rw-r--r--daemon/Android.mk28
-rw-r--r--libabi/Android.mk38
-rw-r--r--libdb/Android.mk31
-rw-r--r--libop/Android.mk28
-rw-r--r--libopt++/Android.mk22
-rw-r--r--libpopt/Android.mk22
-rw-r--r--libpp/Android.mk31
-rw-r--r--libregex/Android.mk23
-rw-r--r--libutil++/Android.mk27
-rw-r--r--libutil/Android.mk26
-rw-r--r--opcontrol/Android.mk22
-rw-r--r--opcontrol_remote94
-rwxr-xr-xopimport_pull19
-rwxr-xr-xoprofile_android5
-rw-r--r--pp/Android.mk51
17 files changed, 321 insertions, 211 deletions
diff --git a/Android.mk b/Android.mk
index 56c23dd..4b19765 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,17 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
ifeq ($(TARGET_SIMULATOR),false)
include $(call all-subdir-makefiles)
endif
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000..62f215a
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,51 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Common flags
+common_c_includes := \
+ external/oprofile \
+ external/oprofile/libabi \
+ external/oprofile/libdb \
+ external/oprofile/libop \
+ external/oprofile/libop++ \
+ external/oprofile/libopt++ \
+ external/oprofile/libpp \
+ external/oprofile/libregex \
+ external/oprofile/libutil \
+ external/oprofile/libutil++
+
+common_cflags := -DHAVE_CONFIG_H
+
+# Common target flags
+common_target_c_includes := $(common_c_includes)
+common_target_cflags := $(common_cflags)
+
+# Common host flags
+ifeq ($(strip $(TARGET_ARCH)),arm)
+toolchain := prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x
+HAVE_LIBBFD := true
+else
+HAVE_LIBBFD := false
+endif
+
+ifeq ($(HAVE_LIBBFD),true)
+common_host_c_includes := $(common_c_includes) $(toolchain)/include
+
+common_host_cflags = $(common_cflags) -fexceptions -DANDROID_HOST -DHAVE_XCALLOC
+ifneq ($(HOST_OS),linux)
+common_host_cflags += -DMISSING_MREMAP
+endif
+
+common_host_ldflags := -L$(toolchain)/lib
+endif
diff --git a/daemon/Android.mk b/daemon/Android.mk
index 322c76e..c68c3fe 100644
--- a/daemon/Android.mk
+++ b/daemon/Android.mk
@@ -1,4 +1,21 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
+
+# Build oprofiled on the target
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
@@ -19,15 +36,10 @@ LOCAL_SRC_FILES:= \
opd_trans.c \
oprofiled.c
-LOCAL_STATIC_LIBRARIES := \
- libpopt libutil libdb libabi libop
+LOCAL_STATIC_LIBRARIES := libpopt libutil libdb libabi libop
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/.. \
- $(LOCAL_PATH)/../libdb \
- $(LOCAL_PATH)/../libutil \
- $(LOCAL_PATH)/../libop \
- $(LOCAL_PATH)/../libabi
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
diff --git a/libabi/Android.mk b/libabi/Android.mk
index 4f576ee..ba2f556 100644
--- a/libabi/Android.mk
+++ b/libabi/Android.mk
@@ -1,26 +1,34 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
libabi_common_src := \
op_abi.c
-common_includes := \
- external/oprofile \
- external/oprofile/libdb \
- external/oprofile/libutil \
- external/oprofile/libop \
- external/oprofile/libopt++
-
# Build libabi on target
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(libabi_common_src)
-LOCAL_C_INCLUDES := $(common_includes)
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libabi
include $(BUILD_STATIC_LIBRARY)
-
# Build libabi on host
include $(CLEAR_VARS)
@@ -28,8 +36,9 @@ LOCAL_SRC_FILES:= \
$(libabi_common_src) \
abi.cpp
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libabi
@@ -40,12 +49,13 @@ ifeq ($(HAVE_LIBBFD),true)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= opimport.cpp
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_STATIC_LIBRARIES := libabi libdb libopt++ libutil libutil++ libpopt
LOCAL_LDLIBS := -liberty
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := opimport
include $(BUILD_HOST_EXECUTABLE)
-endif
+endif \ No newline at end of file
diff --git a/libdb/Android.mk b/libdb/Android.mk
index fe359da..e52ef51 100644
--- a/libdb/Android.mk
+++ b/libdb/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
common_src := \
db_debug.c \
@@ -7,15 +22,12 @@ common_src := \
db_stat.c \
db_travel.c
-common_includes := \
- external/oprofile \
- external/oprofile/libutil
-
# Build libdb on target
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_C_INCLUDES := $(common_includes)
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libdb
@@ -25,12 +37,9 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
-
-ifneq ($(HOST_OS),linux)
-LOCAL_CFLAGS += -DMISSING_MREMAP
-endif
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libdb
diff --git a/libop/Android.mk b/libop/Android.mk
index 01ddea9..f3995ec 100644
--- a/libop/Android.mk
+++ b/libop/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
common_src := \
op_alloc_counter.c \
@@ -11,16 +26,12 @@ common_src := \
op_xml_events.c \
op_xml_out.c
-common_includes := \
- external/oprofile \
- external/oprofile/libutil
-
# Build libop on target
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libop
@@ -30,8 +41,9 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libop
diff --git a/libopt++/Android.mk b/libopt++/Android.mk
index 5901ef2..5b25c7d 100644
--- a/libopt++/Android.mk
+++ b/libopt++/Android.mk
@@ -1,13 +1,27 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
# Build libopt++ on host
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= popt_options.cpp
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/.. \
- $(LOCAL_PATH)/../libutil \
- $(LOCAL_PATH)/../libutil++
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libopt++
diff --git a/libpopt/Android.mk b/libpopt/Android.mk
index 4d513e8..8f2800d 100644
--- a/libpopt/Android.mk
+++ b/libpopt/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
common_src := \
findme.c \
@@ -11,7 +26,8 @@ common_src := \
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_CFLAGS += -DHAVE_CONFIG_H
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libpopt
@@ -21,7 +37,9 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_CFLAGS += -DHAVE_CONFIG_H
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libpopt
diff --git a/libpp/Android.mk b/libpp/Android.mk
index 77d00ee..5b39252 100644
--- a/libpp/Android.mk
+++ b/libpp/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
# Build libpp on host
ifeq ($(HAVE_LIBBFD),true)
@@ -27,19 +42,11 @@ LOCAL_SRC_FILES:= \
xml_utils.cpp \
populate_for_spu.cpp
-LOCAL_C_INCLUDES := \
- external/oprofile \
- external/oprofile/libop \
- external/oprofile/libutil \
- external/oprofile/libdb \
- external/oprofile/libopt++ \
- external/oprofile/libutil++ \
- external/oprofile/libop++ \
- external/oprofile/libregex
-
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libpp
include $(BUILD_HOST_STATIC_LIBRARY)
-endif
+endif \ No newline at end of file
diff --git a/libregex/Android.mk b/libregex/Android.mk
index 3303869..fc70ab3 100644
--- a/libregex/Android.mk
+++ b/libregex/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
# Build libregex on host
include $(CLEAR_VARS)
@@ -8,11 +23,9 @@ LOCAL_SRC_FILES:= \
demangle_symbol.cpp \
demangle_java_symbol.cpp
-LOCAL_C_INCLUDES := \
- external/oprofile \
- external/oprofile/libutil++
-
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libop_regex
diff --git a/libutil++/Android.mk b/libutil++/Android.mk
index 138ff7f..8657780 100644
--- a/libutil++/Android.mk
+++ b/libutil++/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
# Build libutil++ on host
ifeq ($(HAVE_LIBBFD),true)
@@ -20,15 +35,11 @@ LOCAL_SRC_FILES:= \
string_manip.cpp \
xml_output.cpp
-LOCAL_C_INCLUDES := \
- external/oprofile \
- external/oprofile/libutil \
- external/oprofile/libop \
- external/oprofile/libpp
-
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libutil++
include $(BUILD_HOST_STATIC_LIBRARY)
-endif
+endif \ No newline at end of file
diff --git a/libutil/Android.mk b/libutil/Android.mk
index 2fdf04b..4e4cde9 100644
--- a/libutil/Android.mk
+++ b/libutil/Android.mk
@@ -1,4 +1,19 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
common_src := \
op_cpufreq.c \
@@ -13,14 +28,12 @@ common_src := \
op_string.c \
op_version.c
-common_includes := \
- external/oprofile
-
# Build libutil on target
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_C_INCLUDES := $(common_includes)
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libutil
@@ -30,8 +43,9 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(common_src)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := -fexceptions -DANDROID_HOST -DHAVE_XCALLOC
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libutil
diff --git a/opcontrol/Android.mk b/opcontrol/Android.mk
index bc538ad..bf6ec53 100644
--- a/opcontrol/Android.mk
+++ b/opcontrol/Android.mk
@@ -1,4 +1,21 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
+
+# Build opcontrol executable on target
include $(CLEAR_VARS)
ifeq ($(ARCH_ARM_HAVE_ARMV7A), true)
@@ -11,9 +28,8 @@ LOCAL_SRC_FILES:= \
LOCAL_STATIC_LIBRARIES := \
libpopt libutil libdb libabi libop
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/.. \
- $(LOCAL_PATH)/../libop
+LOCAL_C_INCLUDES := $(common_target_c_includes)
+LOCAL_CFLAGS := $(common_target_cflags)
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
diff --git a/opcontrol_remote b/opcontrol_remote
deleted file mode 100644
index b095e77..0000000
--- a/opcontrol_remote
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python2.6
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Remotely controls an OProfile session on an Android device.
-#
-
-import os
-import sys
-import getopt
-
-class Adb:
- def __init__(self, serial_number):
- self._default_args = ''
- if serial_number != None:
- self._default_args = '-s ' + serial_number
-
- def shell(self, command):
- result = os.system('adb%s shell %s' % (self._default_args, command)
- return result
-
-def usage():
- print "Usage:" + sys.argv[0]
- print " -h, --help : show this help text"
- print " -s, --serial=number : the serial number of the device being profiled"
- print " --setup : setup profiler"
- print " --start : start profiling"
- print " --stop : stop profiling"
- print
-
-def main():
- try:
- opts, args - getopt.getopt(sys.argv[1:], "hs:", ["help", "serial=", "setup", "start", "stop"])
- except getopt.GetoptError, e:
- usage()
- print str(e)
- sys.exit(1)
-
- serial_number = None
- command = None
- for o, a in opts:
- if o in ('-h', '--help'):
- usage()
- sys.exit()
- elif o in ('-s', '--serial'):
- serial_number = a
- elif o in ('--setup'):
- command = 'setup'
- elif o in ('--start'):
- command = 'start'
- elif o in ('--stop'):
- command = 'stop'
- else:
- assert False, 'unhandled option' + o
-
- adb = Adb(serial_number)
-
- if command == 'setup':
- setup(adb)
- elif command == 'start':
- start(adb)
- elif command == 'stop':
- stop(adb)
- else:
- usage()
- print 'A command must be specified.'
- sys.exit(1)
-
-def setup(adb):
- adb.shell
-
- pass
-
-def start(adb):
- pass
-
-def stop(adb):
- pass
-
-main()
diff --git a/opimport_pull b/opimport_pull
index b3a257c..69796c9 100755
--- a/opimport_pull
+++ b/opimport_pull
@@ -14,23 +14,16 @@ if (len(sys.argv) <= 1 or len(sys.argv) > 5):
PrintUsage()
sys.exit(1)
-# find prebuilt event data
-try:
- oprofile_event_dir = os.environ['OPROFILE_EVENTS_DIR']
-except:
- # TODO: We can remove this in the future since we pull the abi data
- # off the device so we don't need it to be in the prebuilts directory.
- print "OPROFILE_EVENTS_DIR not set. Run \". envsetup.sh\" first"
- sys.exit(1)
-
# find binaries
try:
oprofile_bin_dir = os.environ['OPROFILE_BIN_DIR']
except:
- # TODO: This assumes that the bin dir is prebuilt.
- # When the host libbfd dependency is resolved and we can compile oprofile
- # on the host, we should use those binaries instead.
- oprofile_bin_dir = oprofile_event_dir + '/bin'
+ try:
+ android_host_out = os.environ['ANDROID_HOST_OUT']
+ except:
+ print "Either OPROFILE_BIN_DIR or ANDROID_HOST_OUT must be set. Run \". envsetup.sh\" first"
+ sys.exit(1)
+ oprofile_bin_dir = android_host_out + '/bin'
argv_next = 1
if sys.argv[1] == "-s":
diff --git a/oprofile_android b/oprofile_android
index afefe71..3373b0c 100755
--- a/oprofile_android
+++ b/oprofile_android
@@ -123,7 +123,8 @@ class Tool:
rc, output = self.adb.shell(['/system/xbin/opcontrol'] + self.opcontrol_verbose() + [
'--reset',
'--kernel-range=' + vma_start + '-' + vma_end,
- '--event=CPU_CYCLES:100000',
+ #'--event=CPU_CYCLES:100000',
+ '--timer',
'--setup',
'--status', '--verbose-log=all'])
@@ -159,4 +160,4 @@ class Tool:
# Main entry point
tool = Tool(sys.argv)
rc = tool.main()
-sys.exit(rc) \ No newline at end of file
+sys.exit(rc)
diff --git a/pp/Android.mk b/pp/Android.mk
index 869a1f5..16d119d 100644
--- a/pp/Android.mk
+++ b/pp/Android.mk
@@ -1,16 +1,22 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH:= $(call my-dir)
-common_src := common_option.cpp
+include $(LOCAL_PATH)/../common.mk
-common_includes := \
- external/oprofile \
- external/oprofile/libutil \
- external/oprofile/libop \
- external/oprofile/libdb \
- external/oprofile/libopt++ \
- external/oprofile/libutil++ \
- external/oprofile/libregex \
- external/oprofile/libpp
+common_src := common_option.cpp
common_libs := \
libpp \
@@ -23,12 +29,11 @@ common_libs := \
libpopt \
libz
-common_cflags := -fexceptions -DANDROID_HOST
common_ldlibs := -lbfd -liberty -lintl -liconv
ifeq ($(HAVE_LIBBFD),true)
-# Build opreport
+# Build opreport on host
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
@@ -37,15 +42,16 @@ LOCAL_SRC_FILES:= \
opreport_options.cpp
LOCAL_STATIC_LIBRARIES := $(common_libs)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(common_cflags)
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_LDLIBS := $(common_ldlibs)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:= opreport
include $(BUILD_HOST_EXECUTABLE)
-# Build opannotate
+# Build opannotate on host
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
@@ -54,8 +60,9 @@ LOCAL_SRC_FILES:= \
opannotate_options.cpp
LOCAL_STATIC_LIBRARIES := $(common_libs)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(common_cflags)
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_LDLIBS := $(common_ldlibs)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:= opannotate
@@ -71,8 +78,9 @@ LOCAL_SRC_FILES:= \
opgprof_options.cpp
LOCAL_STATIC_LIBRARIES := $(common_libs)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(common_cflags)
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_LDLIBS := $(common_ldlibs)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:= opgprof
@@ -88,8 +96,9 @@ LOCAL_SRC_FILES:= \
oparchive_options.cpp
LOCAL_STATIC_LIBRARIES := $(common_libs)
-LOCAL_C_INCLUDES := $(common_includes)
-LOCAL_CFLAGS := $(common_cflags)
+LOCAL_C_INCLUDES := $(common_host_c_includes)
+LOCAL_CFLAGS := $(common_host_cflags)
+LOCAL_LDFLAGS := $(common_host_ldflags)
LOCAL_LDLIBS := $(common_ldlibs)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:= oparchive