Home | History | Annotate | Download | only in benchmarks
      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 LOCAL_PATH := $(call my-dir)
     18 
     19 benchmark_cflags := \
     20     -O2 \
     21     -fno-builtin \
     22     -Wall \
     23     -Wextra \
     24     -Werror \
     25     -Wunused \
     26 
     27 benchmark_cppflags := \
     28 
     29 benchmark_src_files := \
     30     math_benchmark.cpp \
     31     property_benchmark.cpp \
     32     pthread_benchmark.cpp \
     33     semaphore_benchmark.cpp \
     34     stdio_benchmark.cpp \
     35     string_benchmark.cpp \
     36     time_benchmark.cpp \
     37     unistd_benchmark.cpp \
     38 
     39 # Build benchmarks for the device (with bionic's .so). Run with:
     40 #   adb shell bionic-benchmarks32
     41 #   adb shell bionic-benchmarks64
     42 include $(CLEAR_VARS)
     43 LOCAL_MODULE := bionic-benchmarks
     44 LOCAL_MODULE_STEM_32 := bionic-benchmarks32
     45 LOCAL_MODULE_STEM_64 := bionic-benchmarks64
     46 LOCAL_MULTILIB := both
     47 LOCAL_CFLAGS := $(benchmark_cflags)
     48 LOCAL_CPPFLAGS := $(benchmark_cppflags)
     49 LOCAL_SRC_FILES := $(benchmark_src_files)
     50 include $(BUILD_NATIVE_BENCHMARK)
     51 
     52 # We don't build a static benchmark executable because it's not usually
     53 # useful. If you're trying to run the current benchmarks on an older
     54 # release, it's (so far at least) always because you want to measure the
     55 # performance of the old release's libc, and a static benchmark isn't
     56 # going to let you do that.
     57 
     58 # Only supported on linux systems.
     59 ifeq ($(HOST_OS),linux)
     60 
     61 # Build benchmarks for the host (against glibc!). Run with:
     62 include $(CLEAR_VARS)
     63 LOCAL_MODULE := bionic-benchmarks-glibc
     64 LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
     65 LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
     66 LOCAL_MULTILIB := both
     67 LOCAL_CFLAGS := $(benchmark_cflags)
     68 LOCAL_CPPFLAGS := $(benchmark_cppflags)
     69 LOCAL_LDFLAGS := -lrt
     70 LOCAL_SRC_FILES := $(benchmark_src_files)
     71 LOCAL_STATIC_LIBRARIES := libgoogle-benchmark
     72 # TODO: BUILD_HOST_NATIVE_BENCHMARK
     73 include $(BUILD_HOST_EXECUTABLE)
     74 
     75 endif
     76 
     77 ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
     78 include $(LOCAL_PATH)/../build/run-on-host.mk
     79 
     80 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
     81 bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
     82 	ANDROID_DATA=$(TARGET_OUT_DATA) \
     83 	ANDROID_ROOT=$(TARGET_OUT) \
     84 		$(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
     85 endif
     86 
     87 ifeq ($(TARGET_IS_64_BIT),true)
     88 bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
     89 	ANDROID_DATA=$(TARGET_OUT_DATA) \
     90 	ANDROID_ROOT=$(TARGET_OUT) \
     91 		$(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
     92 endif
     93 
     94 endif
     95