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
17package {
18    default_applicable_licenses: ["bionic_benchmarks_license"],
19}
20
21license {
22    name: "bionic_benchmarks_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-Apache-2.0",
26        "SPDX-license-identifier-BSD",
27    ],
28    license_text: [
29        "NOTICE",
30    ],
31}
32
33cc_defaults {
34    name: "bionic-benchmarks-defaults",
35    cflags: [
36        "-O2",
37        "-fno-builtin",
38        "-Wall",
39        "-Wextra",
40        "-Werror",
41        "-Wno-gcc-compat",
42        "-Wunused",
43    ],
44    srcs: [
45        "bionic_benchmarks.cpp",
46        "atomic_benchmark.cpp",
47        "ctype_benchmark.cpp",
48        "get_heap_size_benchmark.cpp",
49        "inttypes_benchmark.cpp",
50        "malloc_benchmark.cpp",
51        "malloc_sql_benchmark.cpp",
52        "malloc_map_benchmark.cpp",
53        "math_benchmark.cpp",
54        "property_benchmark.cpp",
55        "pthread_benchmark.cpp",
56        "semaphore_benchmark.cpp",
57        "stdio_benchmark.cpp",
58        "stdlib_benchmark.cpp",
59        "string_benchmark.cpp",
60        "time_benchmark.cpp",
61        "unistd_benchmark.cpp",
62        "wctype_benchmark.cpp",
63    ],
64    shared_libs: ["liblog"],
65    static_libs: [
66        "libbase",
67        "libBionicBenchmarksUtils",
68        "libtinyxml2",
69    ],
70    stl: "libc++_static",
71
72    target: {
73        android: {
74            static_libs: [
75                "libmeminfo",
76                "libprocinfo",
77            ],
78        },
79    },
80}
81
82cc_defaults {
83    name: "bionic-benchmarks-extras-defaults",
84    cflags: [
85        "-Wall",
86        "-Wextra",
87        "-Werror",
88        "-Wunused",
89    ],
90}
91
92// Build benchmarks for the device (with bionic's .so). Run with:
93//   adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks
94//   adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks
95cc_benchmark {
96    name: "bionic-benchmarks",
97    defaults: ["bionic-benchmarks-defaults"],
98    srcs: [
99        "dlfcn_benchmark.cpp",
100    ],
101    data: ["suites/*"],
102    static_libs: [
103        "libsystemproperties",
104        "libasync_safe",
105    ],
106    include_dirs: ["bionic/libc"],
107}
108
109cc_benchmark {
110    name: "bionic-benchmarks-static",
111    defaults: ["bionic-benchmarks-defaults"],
112    data: ["suites/*"],
113    static_libs: [
114        "liblog",
115        "libsystemproperties",
116        "libasync_safe",
117    ],
118    include_dirs: ["bionic/libc"],
119    static_executable: true,
120}
121
122// Build benchmarks for the host (against glibc!). Run with:
123cc_benchmark_host {
124    name: "bionic-benchmarks-glibc",
125    defaults: ["bionic-benchmarks-defaults"],
126    srcs: [
127        "dlfcn_benchmark.cpp",
128    ],
129    target: {
130        darwin: {
131            // Only supported on linux systems.
132            enabled: false,
133        },
134    },
135    data: ["suites/*"],
136}
137
138cc_library_static {
139    name: "libBionicBenchmarksUtils",
140    defaults: ["bionic-benchmarks-extras-defaults"],
141    srcs: ["util.cpp"],
142    host_supported: true,
143}
144
145cc_test {
146    name: "bionic-benchmarks-tests",
147    isolated: true,
148    defaults: ["bionic-benchmarks-extras-defaults"],
149    srcs: [
150        "tests/benchmark_test.cpp",
151        "tests/interface_test.cpp",
152    ],
153    static_libs: [
154        "libbase",
155        "libBionicBenchmarksUtils",
156    ],
157    data: ["test_suites/*"],
158}
159