Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 1 | # |
| 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 | |
| 17 | ifneq ($(BUILD_TINY_ANDROID), true) |
| 18 | |
| 19 | LOCAL_PATH := $(call my-dir) |
| 20 | |
| 21 | # ----------------------------------------------------------------------------- |
Colin Cross | 7b9df19 | 2013-11-15 14:34:22 -0800 | [diff] [blame^] | 22 | # Benchmarks library, usable by projects outside this directory. |
| 23 | # ----------------------------------------------------------------------------- |
| 24 | |
| 25 | include $(CLEAR_VARS) |
| 26 | LOCAL_MODULE := libbenchmark |
| 27 | LOCAL_CFLAGS += -O2 -Wall -Wextra -Werror |
| 28 | LOCAL_SRC_FILES := benchmark_main.cpp |
| 29 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include |
| 30 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include |
| 31 | include $(BUILD_STATIC_LIBRARY) |
| 32 | |
| 33 | include $(CLEAR_VARS) |
| 34 | LOCAL_MODULE := libbenchmark |
| 35 | LOCAL_CFLAGS += -O2 -Wall -Wextra -Werror |
| 36 | LOCAL_SRC_FILES := benchmark_main.cpp |
| 37 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include |
| 38 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include |
| 39 | LOCAL_MULTILIB := both |
| 40 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 41 | |
| 42 | # ----------------------------------------------------------------------------- |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 43 | # Benchmarks. |
| 44 | # ----------------------------------------------------------------------------- |
| 45 | |
| 46 | benchmark_c_flags = \ |
| 47 | -O2 \ |
Elliott Hughes | d286796 | 2014-06-03 15:22:34 -0700 | [diff] [blame] | 48 | -Wall -Wextra -Wunused \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 49 | -Werror \ |
| 50 | -fno-builtin \ |
Serban Constantinescu | 282e232 | 2013-10-22 11:30:12 +0100 | [diff] [blame] | 51 | -std=gnu++11 \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 52 | |
| 53 | benchmark_src_files = \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 54 | math_benchmark.cpp \ |
Elliott Hughes | b28e490 | 2014-03-11 11:19:06 -0700 | [diff] [blame] | 55 | pthread_benchmark.cpp \ |
| 56 | semaphore_benchmark.cpp \ |
| 57 | stdio_benchmark.cpp \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 58 | string_benchmark.cpp \ |
| 59 | time_benchmark.cpp \ |
Elliott Hughes | b28e490 | 2014-03-11 11:19:06 -0700 | [diff] [blame] | 60 | unistd_benchmark.cpp \ |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 61 | |
| 62 | # Build benchmarks for the device (with bionic's .so). Run with: |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 63 | # adb shell bionic-benchmarks32 |
| 64 | # adb shell bionic-benchmarks64 |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 65 | include $(CLEAR_VARS) |
| 66 | LOCAL_MODULE := bionic-benchmarks |
Christopher Ferris | 345b49a | 2014-04-22 10:42:12 -0700 | [diff] [blame] | 67 | LOCAL_MODULE_STEM_32 := bionic-benchmarks32 |
| 68 | LOCAL_MODULE_STEM_64 := bionic-benchmarks64 |
| 69 | LOCAL_MULTILIB := both |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 70 | LOCAL_CFLAGS += $(benchmark_c_flags) |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 71 | LOCAL_SRC_FILES := $(benchmark_src_files) property_benchmark.cpp |
Colin Cross | 7b9df19 | 2013-11-15 14:34:22 -0800 | [diff] [blame^] | 72 | LOCAL_STATIC_LIBRARIES += libbenchmark |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 73 | include $(BUILD_EXECUTABLE) |
| 74 | |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 75 | # We don't build a static benchmark executable because it's not usually |
| 76 | # useful. If you're trying to run the current benchmarks on an older |
| 77 | # release, it's (so far at least) always because you want to measure the |
| 78 | # performance of the old release's libc, and a static benchmark isn't |
| 79 | # going to let you do that. |
| 80 | |
| 81 | # Build benchmarks for the host (against glibc!). Run with: |
| 82 | include $(CLEAR_VARS) |
| 83 | LOCAL_MODULE := bionic-benchmarks-glibc |
| 84 | LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32 |
| 85 | LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64 |
| 86 | LOCAL_MULTILIB := both |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 87 | LOCAL_CFLAGS += $(benchmark_c_flags) |
| 88 | LOCAL_LDFLAGS += -lrt |
| 89 | LOCAL_SRC_FILES := $(benchmark_src_files) |
Colin Cross | 7b9df19 | 2013-11-15 14:34:22 -0800 | [diff] [blame^] | 90 | LOCAL_STATIC_LIBRARIES += libbenchmark |
Elliott Hughes | 212e0e3 | 2014-12-01 16:43:51 -0800 | [diff] [blame] | 91 | include $(BUILD_HOST_EXECUTABLE) |
| 92 | |
Elliott Hughes | 625993d | 2014-07-15 16:53:13 -0700 | [diff] [blame] | 93 | ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) |
Dmitriy Ivanov | 06b1b8c | 2014-12-02 14:00:13 -0800 | [diff] [blame] | 94 | include $(LOCAL_PATH)/../build/run-on-host.mk |
Christopher Ferris | 3347a79 | 2014-05-01 13:44:57 -0700 | [diff] [blame] | 95 | |
Dmitriy Ivanov | 06b1b8c | 2014-12-02 14:00:13 -0800 | [diff] [blame] | 96 | ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) |
| 97 | bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host |
Christopher Ferris | 3347a79 | 2014-05-01 13:44:57 -0700 | [diff] [blame] | 98 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 99 | ANDROID_ROOT=$(TARGET_OUT) \ |
Dmitriy Ivanov | 06b1b8c | 2014-12-02 14:00:13 -0800 | [diff] [blame] | 100 | $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS) |
| 101 | endif |
| 102 | |
| 103 | ifeq ($(TARGET_IS_64_BIT),true) |
| 104 | bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host |
| 105 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 106 | ANDROID_ROOT=$(TARGET_OUT) \ |
| 107 | $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS) |
| 108 | endif |
| 109 | |
| 110 | endif |
Christopher Ferris | 3347a79 | 2014-05-01 13:44:57 -0700 | [diff] [blame] | 111 | |
Colin Cross | bd3efbc | 2013-11-15 17:49:47 -0800 | [diff] [blame] | 112 | endif # !BUILD_TINY_ANDROID |