blob: 75e607cd1379b8ad8ae748af233b64cd5913ca90 [file] [log] [blame]
Colin Cross2722ebb2016-07-11 16:20:06 -07001//
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
Bob Badouraa7d8352021-02-19 13:06:22 -080017package {
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
Colin Cross2722ebb2016-07-11 16:20:06 -070033cc_defaults {
34 name: "bionic-benchmarks-defaults",
35 cflags: [
36 "-O2",
37 "-fno-builtin",
38 "-Wall",
39 "-Wextra",
40 "-Werror",
Elliott Hughes7063a832017-12-19 08:55:40 -080041 "-Wno-gcc-compat",
Colin Cross2722ebb2016-07-11 16:20:06 -070042 "-Wunused",
43 ],
44 srcs: [
Anders Lewisa7b0f882017-07-24 20:01:13 -070045 "bionic_benchmarks.cpp",
Hans Boehm3f557872017-01-23 17:30:44 -080046 "atomic_benchmark.cpp",
Elliott Hughes9ff7d092019-09-26 21:47:01 -070047 "ctype_benchmark.cpp",
Hans Boehm3e5754c2018-10-18 10:37:34 -070048 "get_heap_size_benchmark.cpp",
Elliott Hughes7063a832017-12-19 08:55:40 -080049 "inttypes_benchmark.cpp",
Christopher Ferris0dc78442018-08-09 15:19:57 -070050 "malloc_benchmark.cpp",
Christopher Ferris5a3c9202019-12-04 15:57:07 -080051 "malloc_sql_benchmark.cpp",
Christopher Ferrisd613f892020-02-20 17:12:48 -080052 "malloc_map_benchmark.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070053 "math_benchmark.cpp",
54 "property_benchmark.cpp",
55 "pthread_benchmark.cpp",
56 "semaphore_benchmark.cpp",
57 "stdio_benchmark.cpp",
Christopher Ferris858e3362017-11-30 08:53:15 -080058 "stdlib_benchmark.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070059 "string_benchmark.cpp",
Suren Baghdasaryan9a0a3602023-08-17 21:52:50 +000060 "syscall_mmap_benchmark.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070061 "time_benchmark.cpp",
62 "unistd_benchmark.cpp",
Elliott Hughesbab9cfd2019-09-25 18:17:17 -070063 "wctype_benchmark.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070064 ],
Elliott Hughes62732992018-09-24 16:45:13 -070065 shared_libs: ["liblog"],
Anders Lewisa7b0f882017-07-24 20:01:13 -070066 static_libs: [
67 "libbase",
68 "libBionicBenchmarksUtils",
Elliott Hughes62732992018-09-24 16:45:13 -070069 "libtinyxml2",
Anders Lewisa7b0f882017-07-24 20:01:13 -070070 ],
Elliott Hughes62732992018-09-24 16:45:13 -070071 stl: "libc++_static",
Christopher Ferrisd613f892020-02-20 17:12:48 -080072
73 target: {
74 android: {
Christopher Ferrisb4e560e2023-10-26 17:00:00 -070075 header_libs: ["bionic_libc_platform_headers"],
Christopher Ferrisd613f892020-02-20 17:12:48 -080076 static_libs: [
77 "libmeminfo",
78 "libprocinfo",
79 ],
80 },
81 },
Anders Lewisf4447b92017-06-23 15:53:59 -070082}
83
84cc_defaults {
85 name: "bionic-benchmarks-extras-defaults",
86 cflags: [
87 "-Wall",
88 "-Wextra",
89 "-Werror",
90 "-Wunused",
91 ],
Colin Cross2722ebb2016-07-11 16:20:06 -070092}
93
94// Build benchmarks for the device (with bionic's .so). Run with:
Elliott Hughesd655bc62019-04-23 11:49:13 -070095// adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks
96// adb shell /data/benchmarktest64/bionic-benchmarks/bionic-benchmarks
Colin Cross2722ebb2016-07-11 16:20:06 -070097cc_benchmark {
98 name: "bionic-benchmarks",
99 defaults: ["bionic-benchmarks-defaults"],
Peter Collingbourne2cefcb12020-12-08 14:37:58 -0800100 srcs: [
101 "dlfcn_benchmark.cpp",
102 ],
Anders Lewisa7b0f882017-07-24 20:01:13 -0700103 data: ["suites/*"],
Tom Cherrye275d6d2017-12-11 23:31:33 -0800104 static_libs: [
105 "libsystemproperties",
106 "libasync_safe",
107 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800108 include_dirs: ["bionic/libc"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700109}
110
Peter Collingbourne2cefcb12020-12-08 14:37:58 -0800111cc_benchmark {
112 name: "bionic-benchmarks-static",
113 defaults: ["bionic-benchmarks-defaults"],
114 data: ["suites/*"],
115 static_libs: [
116 "liblog",
117 "libsystemproperties",
118 "libasync_safe",
119 ],
120 include_dirs: ["bionic/libc"],
121 static_executable: true,
122}
Colin Cross2722ebb2016-07-11 16:20:06 -0700123
124// Build benchmarks for the host (against glibc!). Run with:
125cc_benchmark_host {
126 name: "bionic-benchmarks-glibc",
127 defaults: ["bionic-benchmarks-defaults"],
Peter Collingbourne2cefcb12020-12-08 14:37:58 -0800128 srcs: [
129 "dlfcn_benchmark.cpp",
130 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700131 target: {
132 darwin: {
133 // Only supported on linux systems.
134 enabled: false,
135 },
136 },
Christopher Ferrisd9d39be2017-08-23 18:03:51 -0700137 data: ["suites/*"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700138}
Anders Lewisf4447b92017-06-23 15:53:59 -0700139
140cc_library_static {
141 name: "libBionicBenchmarksUtils",
142 defaults: ["bionic-benchmarks-extras-defaults"],
143 srcs: ["util.cpp"],
144 host_supported: true,
145}
146
147cc_test {
148 name: "bionic-benchmarks-tests",
Christopher Ferris18cbed72018-10-19 13:54:11 -0700149 isolated: true,
Anders Lewisf4447b92017-06-23 15:53:59 -0700150 defaults: ["bionic-benchmarks-extras-defaults"],
151 srcs: [
152 "tests/benchmark_test.cpp",
Anders Lewisa7b0f882017-07-24 20:01:13 -0700153 "tests/interface_test.cpp",
Anders Lewisf4447b92017-06-23 15:53:59 -0700154 ],
Anders Lewis4b26f712017-08-11 15:56:18 -0700155 static_libs: [
156 "libbase",
157 "libBionicBenchmarksUtils",
158 ],
Christopher Ferris80b551d2023-05-25 15:44:54 -0700159 data: [
160 "test_suites/*",
161 "suites/*",
162 ":bionic-benchmarks",
163 ],
164 test_suites: ["device-tests"],
165 require_root: true,
Anders Lewisf4447b92017-06-23 15:53:59 -0700166}
Chia-hung Duana15d5c42022-08-09 01:55:44 +0000167
168cc_binary {
169 name: "malloc-rss-benchmark",
170 srcs: [
171 "malloc_rss_benchmark.cpp",
172 ],
173
174 shared_libs: [
175 "libbase",
176 ],
177
178 target: {
179 android: {
180 static_libs: [
181 "libmeminfo",
182 "libprocinfo",
183 ],
184 },
185 },
186}