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
17cc_defaults {
18    name: "bionic-benchmarks-defaults",
19    cflags: [
20        "-O2",
21        "-fno-builtin",
22        "-Wall",
23        "-Wextra",
24        "-Werror",
25        "-Wno-gcc-compat",
26        "-Wunused",
27    ],
28    srcs: [
29        "bionic_benchmarks.cpp",
30        "atomic_benchmark.cpp",
31        "ctype_benchmark.cpp",
32        "dlfcn_benchmark.cpp",
33        "get_heap_size_benchmark.cpp",
34        "inttypes_benchmark.cpp",
35        "malloc_benchmark.cpp",
36        "malloc_sql_benchmark.cpp",
37        "malloc_map_benchmark.cpp",
38        "math_benchmark.cpp",
39        "property_benchmark.cpp",
40        "pthread_benchmark.cpp",
41        "semaphore_benchmark.cpp",
42        "stdio_benchmark.cpp",
43        "stdlib_benchmark.cpp",
44        "string_benchmark.cpp",
45        "time_benchmark.cpp",
46        "unistd_benchmark.cpp",
47        "wctype_benchmark.cpp",
48    ],
49    shared_libs: ["liblog"],
50    static_libs: [
51        "libbase",
52        "libBionicBenchmarksUtils",
53        "libtinyxml2",
54    ],
55    stl: "libc++_static",
56
57    target: {
58        android: {
59            static_libs: [
60                "libmeminfo",
61                "libprocinfo",
62            ],
63        },
64    },
65}
66
67cc_defaults {
68    name: "bionic-benchmarks-extras-defaults",
69    cflags: [
70        "-Wall",
71        "-Wextra",
72        "-Werror",
73        "-Wunused",
74    ],
75}
76
77// Build benchmarks for the device (with bionic's .so). Run with:
78//   adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks
79//   adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks
80cc_benchmark {
81    name: "bionic-benchmarks",
82    defaults: ["bionic-benchmarks-defaults"],
83    data: ["suites/*"],
84    static_libs: [
85        "libsystemproperties",
86        "libasync_safe",
87    ],
88    include_dirs: ["bionic/libc"],
89}
90
91// We don't build a static benchmark executable because it's not usually
92// useful. If you're trying to run the current benchmarks on an older
93// release, it's (so far at least) always because you want to measure the
94// performance of the old release's libc, and a static benchmark isn't
95// going to let you do that.
96
97// Build benchmarks for the host (against glibc!). Run with:
98cc_benchmark_host {
99    name: "bionic-benchmarks-glibc",
100    defaults: ["bionic-benchmarks-defaults"],
101    target: {
102        darwin: {
103            // Only supported on linux systems.
104            enabled: false,
105        },
106    },
107    data: ["suites/*"],
108}
109
110cc_library_static {
111    name: "libBionicBenchmarksUtils",
112    defaults: ["bionic-benchmarks-extras-defaults"],
113    srcs: ["util.cpp"],
114    host_supported: true,
115}
116
117cc_test {
118    name: "bionic-benchmarks-tests",
119    isolated: true,
120    defaults: ["bionic-benchmarks-extras-defaults"],
121    srcs: [
122        "tests/benchmark_test.cpp",
123        "tests/interface_test.cpp",
124    ],
125    static_libs: [
126        "libbase",
127        "libBionicBenchmarksUtils",
128    ],
129    data: ["test_suites/*"],
130}
131