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