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