blob: 5ce854241e7552c3c8121d336d57115fd8d4ad7d [file] [log] [blame]
Colin Crossbd3efbc2013-11-15 17:49:47 -08001#
2# Copyright (C) 2013 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17ifneq ($(BUILD_TINY_ANDROID), true)
18
19LOCAL_PATH := $(call my-dir)
20
21# -----------------------------------------------------------------------------
22# Benchmarks.
23# -----------------------------------------------------------------------------
24
25benchmark_c_flags = \
26 -O2 \
Elliott Hughesd2867962014-06-03 15:22:34 -070027 -Wall -Wextra -Wunused \
Colin Crossbd3efbc2013-11-15 17:49:47 -080028 -Werror \
29 -fno-builtin \
Serban Constantinescu282e2322013-10-22 11:30:12 +010030 -std=gnu++11 \
Colin Crossbd3efbc2013-11-15 17:49:47 -080031
32benchmark_src_files = \
33 benchmark_main.cpp \
34 math_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070035 pthread_benchmark.cpp \
36 semaphore_benchmark.cpp \
37 stdio_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080038 string_benchmark.cpp \
39 time_benchmark.cpp \
Elliott Hughesb28e4902014-03-11 11:19:06 -070040 unistd_benchmark.cpp \
Colin Crossbd3efbc2013-11-15 17:49:47 -080041
42# Build benchmarks for the device (with bionic's .so). Run with:
Elliott Hughes212e0e32014-12-01 16:43:51 -080043# adb shell bionic-benchmarks32
44# adb shell bionic-benchmarks64
Colin Crossbd3efbc2013-11-15 17:49:47 -080045include $(CLEAR_VARS)
46LOCAL_MODULE := bionic-benchmarks
Christopher Ferris345b49a2014-04-22 10:42:12 -070047LOCAL_MODULE_STEM_32 := bionic-benchmarks32
48LOCAL_MODULE_STEM_64 := bionic-benchmarks64
49LOCAL_MULTILIB := both
Colin Crossbd3efbc2013-11-15 17:49:47 -080050LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
51LOCAL_CFLAGS += $(benchmark_c_flags)
Elliott Hughes212e0e32014-12-01 16:43:51 -080052LOCAL_SRC_FILES := $(benchmark_src_files) property_benchmark.cpp
Dan Albert3a5aeba2014-09-26 15:37:52 -070053LOCAL_CXX_STL := libc++
Colin Crossbd3efbc2013-11-15 17:49:47 -080054include $(BUILD_EXECUTABLE)
55
Elliott Hughes212e0e32014-12-01 16:43:51 -080056# We don't build a static benchmark executable because it's not usually
57# useful. If you're trying to run the current benchmarks on an older
58# release, it's (so far at least) always because you want to measure the
59# performance of the old release's libc, and a static benchmark isn't
60# going to let you do that.
61
62# Build benchmarks for the host (against glibc!). Run with:
63include $(CLEAR_VARS)
64LOCAL_MODULE := bionic-benchmarks-glibc
65LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
66LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
67LOCAL_MULTILIB := both
68LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
69LOCAL_CFLAGS += $(benchmark_c_flags)
70LOCAL_LDFLAGS += -lrt
71LOCAL_SRC_FILES := $(benchmark_src_files)
72LOCAL_CXX_STL := libc++
73include $(BUILD_HOST_EXECUTABLE)
74
Elliott Hughes625993d2014-07-15 16:53:13 -070075ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080076include $(LOCAL_PATH)/../build/run-on-host.mk
Christopher Ferris3347a792014-05-01 13:44:57 -070077
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080078ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
79bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
Christopher Ferris3347a792014-05-01 13:44:57 -070080 ANDROID_DATA=$(TARGET_OUT_DATA) \
81 ANDROID_ROOT=$(TARGET_OUT) \
Dmitriy Ivanov06b1b8c2014-12-02 14:00:13 -080082 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
83endif
84
85ifeq ($(TARGET_IS_64_BIT),true)
86bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
87 ANDROID_DATA=$(TARGET_OUT_DATA) \
88 ANDROID_ROOT=$(TARGET_OUT) \
89 $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
90endif
91
92endif
Christopher Ferris3347a792014-05-01 13:44:57 -070093
Colin Crossbd3efbc2013-11-15 17:49:47 -080094endif # !BUILD_TINY_ANDROID