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