Yabin Cui | e1deac5 | 2018-01-23 15:04:44 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2018 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 Badour | 4e06008 | 2021-02-16 18:59:28 -0800 | [diff] [blame] | 17 | package { |
| 18 | default_applicable_licenses: ["system_extras_simpleperf_license"], |
| 19 | } |
| 20 | |
| 21 | // Added automatically by a large-scale-change |
| 22 | // See: http://go/android-license-faq |
| 23 | license { |
| 24 | name: "system_extras_simpleperf_license", |
| 25 | visibility: [":__subpackages__"], |
| 26 | license_kinds: [ |
| 27 | "SPDX-license-identifier-Apache-2.0", |
| 28 | ], |
| 29 | license_text: [ |
| 30 | "NOTICE", |
| 31 | ], |
| 32 | } |
| 33 | |
Yabin Cui | e1deac5 | 2018-01-23 15:04:44 -0800 | [diff] [blame] | 34 | cc_defaults { |
Andreas Gampe | b017270 | 2018-09-17 13:33:02 -0700 | [diff] [blame] | 35 | name: "libsimpleperf_elf_read_static_reqs_defaults", |
| 36 | static_libs: [ |
| 37 | "libLLVMObject", |
| 38 | "libLLVMBitReader", |
| 39 | "libLLVMMC", |
| 40 | "libLLVMMCParser", |
| 41 | "libLLVMCore", |
| 42 | "libLLVMSupport", |
| 43 | "liblzma", |
| 44 | "libz", |
| 45 | "libziparchive", |
| 46 | ], |
| 47 | } |
| 48 | |
Andreas Gampe | a3b752c | 2018-09-18 19:25:24 -0700 | [diff] [blame] | 49 | cc_defaults { |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 50 | name: "simpleperf_cflags", |
| 51 | target: { |
| 52 | host: { |
| 53 | cflags: [ |
| 54 | "-DUSE_BIONIC_UAPI_HEADERS", |
Thiébaud Weksteen | 21a9932 | 2020-10-23 10:20:33 +0200 | [diff] [blame] | 55 | "-fvisibility=hidden", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 56 | ], |
| 57 | include_dirs: ["bionic/libc/kernel"], |
| 58 | }, |
| 59 | darwin: { |
| 60 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], |
| 61 | local_include_dirs: ["nonlinux_support/include"], |
| 62 | }, |
| 63 | windows: { |
| 64 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], |
| 65 | local_include_dirs: ["nonlinux_support/include"], |
Thiébaud Weksteen | 21a9932 | 2020-10-23 10:20:33 +0200 | [diff] [blame] | 66 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 67 | }, |
Colin Cross | 1182985 | 2022-11-01 11:51:46 -0700 | [diff] [blame] | 68 | arch: { |
| 69 | riscv64: { |
| 70 | enabled: false, |
| 71 | }, |
| 72 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 73 | } |
| 74 | |
Yabin Cui | fc9da9b | 2019-08-08 18:15:14 -0700 | [diff] [blame] | 75 | // linked as a separate library because using OpenCSD headers needs to enable exception |
| 76 | cc_library_static { |
| 77 | name: "libsimpleperf_etm_decoder", |
| 78 | defaults: [ |
| 79 | "simpleperf_cflags", |
| 80 | "libsimpleperf_elf_read_static_reqs_defaults", |
| 81 | ], |
| 82 | host_supported: true, |
| 83 | srcs: ["ETMDecoder.cpp"], |
| 84 | cppflags: [ |
| 85 | // flags needed to include libopencsd_decoder headers |
| 86 | "-Wno-ignored-qualifiers", |
| 87 | "-Wno-unused-parameter", |
| 88 | "-Wno-switch", |
| 89 | "-Wno-unused-private-field", |
| 90 | "-Wno-implicit-fallthrough", |
| 91 | "-fexceptions", |
| 92 | ], |
| 93 | rtti: true, |
| 94 | static_libs: [ |
| 95 | "libopencsd_decoder", |
| 96 | "libbase", |
| 97 | "liblog", |
| 98 | ], |
| 99 | target: { |
| 100 | windows: { |
| 101 | enabled: true, |
Thiébaud Weksteen | 21a9932 | 2020-10-23 10:20:33 +0200 | [diff] [blame] | 102 | }, |
| 103 | }, |
Yabin Cui | fc9da9b | 2019-08-08 18:15:14 -0700 | [diff] [blame] | 104 | } |
| 105 | |
Yabin Cui | f00f4fc | 2022-11-23 15:15:30 -0800 | [diff] [blame] | 106 | // Build regex support in a separate library to catch std::regex_error exception. |
| 107 | cc_library_static { |
| 108 | name: "libsimpleperf_regex", |
| 109 | host_supported: true, |
| 110 | srcs: ["RegEx.cpp"], |
| 111 | cppflags: ["-fexceptions"], |
| 112 | static_libs: ["libbase"], |
| 113 | target: { |
| 114 | windows: { |
| 115 | enabled: true, |
| 116 | }, |
| 117 | }, |
| 118 | } |
| 119 | |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 120 | cc_defaults { |
| 121 | name: "simpleperf_static_libs", |
| 122 | defaults: [ |
| 123 | "libsimpleperf_elf_read_static_reqs_defaults", |
| 124 | "simpleperf_cflags", |
| 125 | ], |
| 126 | host_supported: true, |
| 127 | static_libs: [ |
Yabin Cui | fc9da9b | 2019-08-08 18:15:14 -0700 | [diff] [blame] | 128 | "libsimpleperf_etm_decoder", |
Yabin Cui | f00f4fc | 2022-11-23 15:15:30 -0800 | [diff] [blame] | 129 | "libsimpleperf_regex", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 130 | "libbase", |
| 131 | "liblog", |
| 132 | "libutils", |
| 133 | "libprotobuf-cpp-lite", |
Yabin Cui | fc9da9b | 2019-08-08 18:15:14 -0700 | [diff] [blame] | 134 | "libopencsd_decoder", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 135 | ], |
| 136 | target: { |
| 137 | linux: { |
| 138 | static_libs: [ |
| 139 | "libunwindstack", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 140 | "libcutils", |
| 141 | "libprocinfo", |
| 142 | "libevent", |
Yabin Cui | ea105c8 | 2020-07-22 13:01:31 -0700 | [diff] [blame] | 143 | "libc++fs", |
Yabin Cui | 4d8137f | 2023-02-14 17:00:25 -0800 | [diff] [blame] | 144 | "librustc_demangle_static", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 145 | ], |
| 146 | }, |
Yabin Cui | df13edf | 2022-01-25 13:35:24 -0800 | [diff] [blame] | 147 | linux_glibc_x86_64: { |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 148 | stl: "libc++_static", |
| 149 | }, |
Colin Cross | a2b046a | 2022-03-24 16:25:09 -0700 | [diff] [blame] | 150 | linux_musl_x86_64: { |
| 151 | stl: "libc++_static", |
| 152 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 153 | windows: { |
| 154 | enabled: true, |
Yabin Cui | df13edf | 2022-01-25 13:35:24 -0800 | [diff] [blame] | 155 | stl: "libc++_static", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 156 | }, |
| 157 | }, |
| 158 | use_version_lib: true, |
| 159 | } |
| 160 | |
| 161 | cc_defaults { |
| 162 | name: "simpleperf_shared_libs", |
| 163 | defaults: [ |
| 164 | "simpleperf_cflags", |
| 165 | ], |
| 166 | host_supported: true, |
| 167 | shared_libs: [ |
| 168 | "libbase", |
| 169 | "liblzma", |
| 170 | "libprotobuf-cpp-lite", |
| 171 | "libziparchive", |
| 172 | ], |
Yabin Cui | fc9da9b | 2019-08-08 18:15:14 -0700 | [diff] [blame] | 173 | static_libs: [ |
| 174 | "libsimpleperf_etm_decoder", |
Yabin Cui | f00f4fc | 2022-11-23 15:15:30 -0800 | [diff] [blame] | 175 | "libsimpleperf_regex", |
Yabin Cui | fc9da9b | 2019-08-08 18:15:14 -0700 | [diff] [blame] | 176 | "libopencsd_decoder", |
| 177 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 178 | target: { |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 179 | linux: { |
| 180 | shared_libs: [ |
| 181 | "libcutils", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 182 | "libevent", |
Martin Stjernholm | 48af21a | 2021-05-14 17:58:41 +0100 | [diff] [blame] | 183 | "liblog", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 184 | "libprocinfo", |
| 185 | "libunwindstack", |
| 186 | ], |
Yabin Cui | ea105c8 | 2020-07-22 13:01:31 -0700 | [diff] [blame] | 187 | static_libs: [ |
| 188 | "libc++fs", |
Martin Stjernholm | 48af21a | 2021-05-14 17:58:41 +0100 | [diff] [blame] | 189 | "libdexfile_support", |
Yabin Cui | 4d8137f | 2023-02-14 17:00:25 -0800 | [diff] [blame] | 190 | "librustc_demangle_static", |
Yabin Cui | ea105c8 | 2020-07-22 13:01:31 -0700 | [diff] [blame] | 191 | ], |
Martin Stjernholm | c2b2409 | 2021-08-26 21:18:08 +0100 | [diff] [blame] | 192 | runtime_libs: [ |
| 193 | "libdexfile", // libdexfile_support dependency |
| 194 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 195 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 196 | host: { |
| 197 | static_libs: [ |
| 198 | "libLLVMObject", |
| 199 | "libLLVMBitReader", |
| 200 | "libLLVMMC", |
| 201 | "libLLVMMCParser", |
| 202 | "libLLVMCore", |
| 203 | "libLLVMSupport", |
| 204 | ], |
| 205 | }, |
| 206 | windows: { |
| 207 | enabled: true, |
| 208 | }, |
| 209 | }, |
| 210 | use_version_lib: true, |
| 211 | } |
| 212 | |
| 213 | cc_defaults { |
Yabin Cui | bcbffab | 2019-02-27 10:53:16 -0800 | [diff] [blame] | 214 | name: "simpleperf_libs_for_tests", |
| 215 | defaults: ["simpleperf_shared_libs"], |
| 216 | target: { |
| 217 | android: { |
| 218 | // 32-bit libLLVM_android isn't shipped on device. So use static llvm libs in tests. |
| 219 | static_libs: [ |
| 220 | "libLLVMObject", |
| 221 | "libLLVMBitReader", |
| 222 | "libLLVMMC", |
| 223 | "libLLVMMCParser", |
| 224 | "libLLVMCore", |
| 225 | "libLLVMSupport", |
| 226 | ], |
| 227 | }, |
| 228 | }, |
| 229 | } |
| 230 | |
| 231 | cc_defaults { |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 232 | name: "libsimpleperf_srcs", |
| 233 | srcs: [ |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 234 | "cmd_dumprecord.cpp", |
| 235 | "cmd_help.cpp", |
Yabin Cui | c573eaa | 2019-08-21 16:05:07 -0700 | [diff] [blame] | 236 | "cmd_inject.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 237 | "cmd_kmem.cpp", |
Yabin Cui | 8d005de | 2020-10-21 13:48:53 -0700 | [diff] [blame] | 238 | "cmd_merge.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 239 | "cmd_report.cpp", |
| 240 | "cmd_report_sample.cpp", |
Yabin Cui | e0a1980 | 2021-03-16 17:24:11 -0700 | [diff] [blame] | 241 | "cmd_report_sample.proto", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 242 | "command.cpp", |
| 243 | "dso.cpp", |
Yabin Cui | 193f238 | 2020-04-01 14:30:03 -0700 | [diff] [blame] | 244 | "etm_branch_list.proto", |
Yabin Cui | da3b6ce | 2023-04-28 17:42:02 -0700 | [diff] [blame] | 245 | "ETMBranchListFile.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 246 | "event_attr.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 247 | "event_type.cpp", |
Yabin Cui | 36b57d9 | 2020-12-17 17:06:27 -0800 | [diff] [blame] | 248 | "kallsyms.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 249 | "perf_regs.cpp", |
| 250 | "read_apk.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 251 | "read_elf.cpp", |
Evgeny Eltsin | c2dc7e5 | 2020-08-26 11:08:00 +0200 | [diff] [blame] | 252 | "read_symbol_map.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 253 | "record.cpp", |
Yabin Cui | 5ea3bc1 | 2022-01-05 11:50:00 -0800 | [diff] [blame] | 254 | "RecordFilter.cpp", |
Yabin Cui | fbbe9e5 | 2021-03-01 10:07:55 -0800 | [diff] [blame] | 255 | "record_file.proto", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 256 | "record_file_reader.cpp", |
Yabin Cui | 8d005de | 2020-10-21 13:48:53 -0700 | [diff] [blame] | 257 | "record_file_writer.cpp", |
Yabin Cui | ac4b249 | 2020-12-09 16:27:57 -0800 | [diff] [blame] | 258 | "report_utils.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 259 | "thread_tree.cpp", |
| 260 | "tracing.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 261 | "utils.cpp", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 262 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 263 | target: { |
Yabin Cui | 321bfe6 | 2022-01-15 14:09:46 -0800 | [diff] [blame] | 264 | android: { |
| 265 | srcs: [ |
| 266 | "cmd_boot_record.cpp", |
| 267 | ], |
| 268 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 269 | linux: { |
| 270 | srcs: [ |
| 271 | "CallChainJoiner.cpp", |
Yabin Cui | 1befe4f | 2019-02-25 15:22:43 -0800 | [diff] [blame] | 272 | "cmd_api.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 273 | "cmd_debug_unwind.cpp", |
| 274 | "cmd_list.cpp", |
Thiébaud Weksteen | f5c93be | 2020-10-19 13:07:20 +0200 | [diff] [blame] | 275 | "cmd_monitor.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 276 | "cmd_record.cpp", |
| 277 | "cmd_stat.cpp", |
| 278 | "cmd_trace_sched.cpp", |
| 279 | "environment.cpp", |
Yabin Cui | d5bccd1 | 2019-07-12 13:09:15 -0700 | [diff] [blame] | 280 | "ETMRecorder.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 281 | "event_fd.cpp", |
| 282 | "event_selection_set.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 283 | "IOEventLoop.cpp", |
| 284 | "JITDebugReader.cpp", |
Yabin Cui | 3ee9727 | 2020-10-28 09:23:24 -0700 | [diff] [blame] | 285 | "MapRecordReader.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 286 | "OfflineUnwinder.cpp", |
Yabin Cui | 142acc8 | 2020-10-14 10:24:38 -0700 | [diff] [blame] | 287 | "ProbeEvents.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 288 | "read_dex_file.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 289 | "RecordReadThread.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 290 | "workload.cpp", |
| 291 | ], |
| 292 | }, |
| 293 | darwin: { |
| 294 | srcs: ["nonlinux_support/nonlinux_support.cpp"], |
| 295 | }, |
| 296 | windows: { |
| 297 | srcs: ["nonlinux_support/nonlinux_support.cpp"], |
| 298 | }, |
| 299 | }, |
| 300 | } |
| 301 | |
| 302 | cc_library_static { |
| 303 | name: "libsimpleperf", |
| 304 | defaults: [ |
| 305 | "libsimpleperf_srcs", |
| 306 | "simpleperf_static_libs", |
Yabin Cui | 4192f46 | 2019-01-17 15:10:51 -0800 | [diff] [blame] | 307 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 308 | compile_multilib: "both", |
| 309 | proto: { |
| 310 | type: "lite", |
| 311 | }, |
| 312 | static_libs: [ |
| 313 | "libbuildversion", |
| 314 | ], |
| 315 | use_version_lib: false, |
Martin Stjernholm | 54418f5 | 2020-03-18 01:15:51 +0000 | [diff] [blame] | 316 | |
| 317 | target: { |
| 318 | linux: { |
Martin Stjernholm | 8a61351 | 2021-03-16 09:56:16 +0000 | [diff] [blame] | 319 | // See note for libdexfile_static in simpleperf_ndk. |
Martin Stjernholm | 54418f5 | 2020-03-18 01:15:51 +0000 | [diff] [blame] | 320 | static_libs: ["libdexfile_support"], |
Martin Stjernholm | c2b2409 | 2021-08-26 21:18:08 +0100 | [diff] [blame] | 321 | runtime_libs: ["libdexfile"], // libdexfile_support dependency |
Martin Stjernholm | 54418f5 | 2020-03-18 01:15:51 +0000 | [diff] [blame] | 322 | }, |
| 323 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | // simpleperf shipped in system image |
| 327 | cc_binary { |
| 328 | name: "simpleperf", |
| 329 | defaults: [ |
| 330 | "simpleperf_shared_libs", |
| 331 | ], |
| 332 | host_supported: false, |
| 333 | srcs: [ |
| 334 | "main.cpp", |
| 335 | ], |
| 336 | static_libs: ["libsimpleperf"], |
Yabin Cui | bcbffab | 2019-02-27 10:53:16 -0800 | [diff] [blame] | 337 | target: { |
| 338 | android: { |
| 339 | shared_libs: [ |
| 340 | "libLLVM_android", |
| 341 | ], |
| 342 | }, |
| 343 | }, |
Yabin Cui | 321bfe6 | 2022-01-15 14:09:46 -0800 | [diff] [blame] | 344 | init_rc: ["simpleperf.rc"], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 345 | } |
| 346 | |
Yi Kong | a86c7e3 | 2020-06-03 23:24:36 +0800 | [diff] [blame] | 347 | cc_library { |
| 348 | name: "libsimpleperf_profcollect", |
Yi Kong | f8abfdb | 2021-02-18 16:23:37 +0800 | [diff] [blame] | 349 | defaults: ["simpleperf_shared_libs"], |
Yi Kong | a86c7e3 | 2020-06-03 23:24:36 +0800 | [diff] [blame] | 350 | srcs: ["profcollect.cpp"], |
Yi Kong | f8abfdb | 2021-02-18 16:23:37 +0800 | [diff] [blame] | 351 | host_supported: false, |
Thiébaud Weksteen | 21a9932 | 2020-10-23 10:20:33 +0200 | [diff] [blame] | 352 | static_libs: ["libsimpleperf"], |
Yabin Cui | 0d539c1 | 2022-02-17 09:57:42 -0800 | [diff] [blame] | 353 | shared_libs: [ |
| 354 | "libLLVM_android", |
| 355 | "libpower", |
| 356 | ], |
Yi Kong | f8abfdb | 2021-02-18 16:23:37 +0800 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | rust_bindgen { |
| 360 | name: "libsimpleperf_profcollect_bindgen", |
| 361 | wrapper_src: "include/simpleperf_profcollect.hpp", |
| 362 | crate_name: "simpleperf_profcollect_bindgen", |
| 363 | source_stem: "bindings", |
| 364 | } |
| 365 | |
| 366 | rust_library { |
| 367 | name: "libsimpleperf_profcollect_rust", |
| 368 | crate_name: "simpleperf_profcollect", |
| 369 | srcs: ["rust/lib.rs"], |
| 370 | rlibs: ["libsimpleperf_profcollect_bindgen"], |
| 371 | shared_libs: ["libsimpleperf_profcollect"], |
Yi Kong | a86c7e3 | 2020-06-03 23:24:36 +0800 | [diff] [blame] | 372 | visibility: ["//system/extras/profcollectd:__subpackages__"], |
| 373 | } |
| 374 | |
Joel Galenson | f8a5271 | 2021-08-23 13:46:38 -0700 | [diff] [blame] | 375 | rust_test { |
| 376 | name: "libsimpleperf_profcollect_bindgen_test", |
| 377 | srcs: [":libsimpleperf_profcollect_bindgen"], |
| 378 | crate_name: "simpleperf_profcollect_bindgen_test", |
| 379 | test_suites: ["general-tests"], |
| 380 | auto_gen_config: true, |
| 381 | clippy_lints: "none", |
| 382 | lints: "none", |
| 383 | } |
| 384 | |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 385 | // simpleperf released in ndk |
| 386 | cc_binary { |
| 387 | name: "simpleperf_ndk", |
| 388 | defaults: [ |
| 389 | "simpleperf_static_libs", |
| 390 | ], |
| 391 | dist: { |
Yabin Cui | 7b0a942 | 2019-08-20 10:32:56 -0700 | [diff] [blame] | 392 | targets: ["simpleperf"], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 393 | }, |
| 394 | srcs: [ |
| 395 | "main.cpp", |
| 396 | ], |
| 397 | static_libs: [ |
| 398 | "libsimpleperf", |
| 399 | ], |
| 400 | |
| 401 | compile_multilib: "both", |
| 402 | multilib: { |
| 403 | lib64: { |
| 404 | suffix: "64", |
| 405 | }, |
| 406 | }, |
| 407 | |
| 408 | target: { |
| 409 | android: { |
| 410 | static_executable: true, |
Yabin Cui | d9d49b4 | 2022-10-05 11:29:19 -0700 | [diff] [blame] | 411 | static_libs: [ |
| 412 | "libc", |
| 413 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 414 | }, |
| 415 | android_arm: { |
| 416 | dist: { |
| 417 | dir: "simpleperf/android/arm", |
| 418 | }, |
| 419 | }, |
| 420 | android_arm64: { |
| 421 | dist: { |
| 422 | dir: "simpleperf/android/arm64", |
| 423 | }, |
| 424 | }, |
| 425 | android_x86: { |
| 426 | dist: { |
| 427 | dir: "simpleperf/android/x86", |
| 428 | }, |
| 429 | }, |
| 430 | android_x86_64: { |
| 431 | dist: { |
| 432 | dir: "simpleperf/android/x86_64", |
| 433 | }, |
| 434 | }, |
| 435 | darwin: { |
| 436 | dist: { |
| 437 | dir: "simpleperf/darwin/x86", |
| 438 | }, |
| 439 | }, |
| 440 | darwin_x86_64: { |
| 441 | dist: { |
| 442 | dir: "simpleperf/darwin/x86_64", |
| 443 | }, |
| 444 | }, |
Martin Stjernholm | 4d88810 | 2020-09-30 22:22:19 +0100 | [diff] [blame] | 445 | linux: { |
Martin Stjernholm | 8a61351 | 2021-03-16 09:56:16 +0000 | [diff] [blame] | 446 | // In the NDK we need libdexfile_static which links libdexfile and |
| 447 | // its ART dependencies statically. However in other libraries we |
| 448 | // must use libdexfile_support, which dlopen's libdexfile.so from |
| 449 | // the ART APEX, to avoid getting ART internals in the system image. |
| 450 | static_libs: ["libdexfile_static"], |
Martin Stjernholm | 4d88810 | 2020-09-30 22:22:19 +0100 | [diff] [blame] | 451 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 452 | linux_glibc_x86: { |
| 453 | dist: { |
| 454 | dir: "simpleperf/linux/x86", |
| 455 | }, |
| 456 | }, |
| 457 | linux_glibc_x86_64: { |
| 458 | dist: { |
| 459 | dir: "simpleperf/linux/x86_64", |
| 460 | }, |
| 461 | }, |
Colin Cross | a2b046a | 2022-03-24 16:25:09 -0700 | [diff] [blame] | 462 | linux_musl_x86: { |
| 463 | dist: { |
| 464 | dir: "simpleperf/linux_musl/x86", |
| 465 | }, |
| 466 | }, |
| 467 | linux_musl_x86_64: { |
| 468 | dist: { |
| 469 | dir: "simpleperf/linux_musl/x86_64", |
| 470 | }, |
| 471 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 472 | windows_x86: { |
| 473 | dist: { |
| 474 | dir: "simpleperf/windows/x86", |
| 475 | }, |
| 476 | }, |
| 477 | windows_x86_64: { |
| 478 | dist: { |
| 479 | dir: "simpleperf/windows/x86_64", |
| 480 | }, |
| 481 | }, |
| 482 | }, |
| 483 | } |
| 484 | |
| 485 | // It's linked to user's program, to get profile counters and samples for specific code ranges. |
| 486 | cc_library { |
| 487 | name: "libsimpleperf_record", |
| 488 | defaults: [ |
| 489 | "simpleperf_static_libs", |
| 490 | ], |
| 491 | export_include_dirs: ["include"], |
| 492 | ldflags: ["-Wl,--exclude-libs,ALL"], |
| 493 | srcs: [ |
| 494 | "record_lib_interface.cpp", |
| 495 | ], |
| 496 | static_libs: [ |
Thiébaud Weksteen | 21a9932 | 2020-10-23 10:20:33 +0200 | [diff] [blame] | 497 | "libsimpleperf", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 498 | ], |
| 499 | target: { |
| 500 | darwin: { |
| 501 | enabled: false, |
| 502 | }, |
| 503 | windows: { |
| 504 | enabled: false, |
| 505 | }, |
Martin Stjernholm | 4d88810 | 2020-09-30 22:22:19 +0100 | [diff] [blame] | 506 | linux: { |
Martin Stjernholm | 8a61351 | 2021-03-16 09:56:16 +0000 | [diff] [blame] | 507 | // See note for libdexfile_static in simpleperf_ndk. |
| 508 | static_libs: ["libdexfile_static"], |
Martin Stjernholm | 4d88810 | 2020-09-30 22:22:19 +0100 | [diff] [blame] | 509 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 510 | }, |
| 511 | } |
| 512 | |
| 513 | // It's the shared library used on host by python scripts to report samples in different ways. |
| 514 | cc_library_shared { |
| 515 | name: "libsimpleperf_report", |
| 516 | defaults: [ |
| 517 | "simpleperf_static_libs", |
| 518 | ], |
| 519 | dist: { |
Yabin Cui | 7b0a942 | 2019-08-20 10:32:56 -0700 | [diff] [blame] | 520 | targets: ["simpleperf"], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 521 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 522 | srcs: [ |
| 523 | "report_lib_interface.cpp", |
| 524 | ], |
| 525 | static_libs: ["libsimpleperf"], |
| 526 | |
| 527 | target: { |
| 528 | android: { |
| 529 | enabled: false, |
| 530 | }, |
Yabin Cui | 15fc25d | 2019-01-30 11:03:40 -0800 | [diff] [blame] | 531 | linux: { |
| 532 | ldflags: ["-Wl,--exclude-libs,ALL"], |
Martin Stjernholm | 8a61351 | 2021-03-16 09:56:16 +0000 | [diff] [blame] | 533 | // See note for libdexfile_static in simpleperf_ndk. |
| 534 | static_libs: ["libdexfile_static"], |
Yabin Cui | 15fc25d | 2019-01-30 11:03:40 -0800 | [diff] [blame] | 535 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 536 | darwin: { |
| 537 | dist: { |
| 538 | dir: "simpleperf/darwin/x86", |
| 539 | }, |
| 540 | }, |
| 541 | darwin_x86_64: { |
| 542 | dist: { |
| 543 | dir: "simpleperf/darwin/x86_64", |
| 544 | }, |
| 545 | }, |
| 546 | linux_glibc_x86: { |
| 547 | dist: { |
| 548 | dir: "simpleperf/linux/x86", |
| 549 | }, |
| 550 | }, |
| 551 | linux_glibc_x86_64: { |
| 552 | dist: { |
| 553 | dir: "simpleperf/linux/x86_64", |
| 554 | }, |
| 555 | }, |
Colin Cross | a2b046a | 2022-03-24 16:25:09 -0700 | [diff] [blame] | 556 | linux_musl_x86: { |
| 557 | dist: { |
| 558 | dir: "simpleperf/linux_musl/x86", |
| 559 | }, |
| 560 | }, |
| 561 | linux_musl_x86_64: { |
| 562 | dist: { |
| 563 | dir: "simpleperf/linux_musl/x86_64", |
| 564 | }, |
| 565 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 566 | windows_x86: { |
| 567 | dist: { |
| 568 | dir: "simpleperf/windows/x86", |
| 569 | }, |
| 570 | }, |
| 571 | windows_x86_64: { |
| 572 | dist: { |
| 573 | dir: "simpleperf/windows/x86_64", |
| 574 | }, |
| 575 | }, |
| 576 | }, |
| 577 | } |
| 578 | |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 579 | cc_defaults { |
| 580 | name: "simpleperf_test_srcs", |
Chih-Hung Hsieh | fd1e574 | 2022-02-17 17:24:21 -0800 | [diff] [blame] | 581 | tidy_timeout_srcs: [ |
| 582 | "record_test.cpp", |
| 583 | "cmd_report_sample_test.cpp", |
| 584 | "cmd_report_test.cpp", |
| 585 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 586 | srcs: [ |
Yabin Cui | c573eaa | 2019-08-21 16:05:07 -0700 | [diff] [blame] | 587 | "cmd_inject_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 588 | "cmd_kmem_test.cpp", |
Yabin Cui | 8d005de | 2020-10-21 13:48:53 -0700 | [diff] [blame] | 589 | "cmd_merge_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 590 | "cmd_report_test.cpp", |
| 591 | "cmd_report_sample_test.cpp", |
| 592 | "command_test.cpp", |
| 593 | "dso_test.cpp", |
| 594 | "gtest_main.cpp", |
Yabin Cui | 36b57d9 | 2020-12-17 17:06:27 -0800 | [diff] [blame] | 595 | "kallsyms_test.cpp", |
Yabin Cui | f227b6d | 2021-01-06 14:01:53 -0800 | [diff] [blame] | 596 | "perf_regs_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 597 | "read_apk_test.cpp", |
| 598 | "read_elf_test.cpp", |
Evgeny Eltsin | c2dc7e5 | 2020-08-26 11:08:00 +0200 | [diff] [blame] | 599 | "read_symbol_map_test.cpp", |
Yabin Cui | 5ea3bc1 | 2022-01-05 11:50:00 -0800 | [diff] [blame] | 600 | "RecordFilter_test.cpp", |
Yabin Cui | f00f4fc | 2022-11-23 15:15:30 -0800 | [diff] [blame] | 601 | "RegEx_test.cpp", |
Yabin Cui | 8d005de | 2020-10-21 13:48:53 -0700 | [diff] [blame] | 602 | "record_file_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 603 | "record_test.cpp", |
Yabin Cui | ac4b249 | 2020-12-09 16:27:57 -0800 | [diff] [blame] | 604 | "report_utils_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 605 | "sample_tree_test.cpp", |
| 606 | "thread_tree_test.cpp", |
Thiébaud Weksteen | 90a6825 | 2020-10-27 15:05:33 +0100 | [diff] [blame] | 607 | "test_util.cpp", |
Yabin Cui | a9cfcde | 2020-06-29 14:04:44 -0700 | [diff] [blame] | 608 | "tracing_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 609 | "utils_test.cpp", |
| 610 | ], |
| 611 | target: { |
Yabin Cui | 321bfe6 | 2022-01-15 14:09:46 -0800 | [diff] [blame] | 612 | android: { |
| 613 | srcs: [ |
| 614 | "cmd_boot_record_test.cpp", |
| 615 | ], |
| 616 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 617 | linux: { |
Chih-Hung Hsieh | fd1e574 | 2022-02-17 17:24:21 -0800 | [diff] [blame] | 618 | tidy_timeout_srcs: [ |
| 619 | "cmd_stat_test.cpp", |
| 620 | "cmd_record_test.cpp", |
| 621 | ], |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 622 | srcs: [ |
| 623 | "CallChainJoiner_test.cpp", |
Yabin Cui | dc1a475 | 2020-02-10 17:53:34 -0800 | [diff] [blame] | 624 | "cmd_api_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 625 | "cmd_debug_unwind_test.cpp", |
| 626 | "cmd_dumprecord_test.cpp", |
| 627 | "cmd_list_test.cpp", |
| 628 | "cmd_record_test.cpp", |
Thiébaud Weksteen | f5c93be | 2020-10-19 13:07:20 +0200 | [diff] [blame] | 629 | "cmd_monitor_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 630 | "cmd_stat_test.cpp", |
| 631 | "cmd_trace_sched_test.cpp", |
| 632 | "environment_test.cpp", |
| 633 | "IOEventLoop_test.cpp", |
Yabin Cui | cac8eb0 | 2022-01-20 11:27:53 -0800 | [diff] [blame] | 634 | "JITDebugReader_test.cpp", |
Yabin Cui | 3ee9727 | 2020-10-28 09:23:24 -0700 | [diff] [blame] | 635 | "MapRecordReader_test.cpp", |
Yabin Cui | 39e5979 | 2020-01-23 12:32:26 -0800 | [diff] [blame] | 636 | "OfflineUnwinder_test.cpp", |
Yabin Cui | 142acc8 | 2020-10-14 10:24:38 -0700 | [diff] [blame] | 637 | "ProbeEvents_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 638 | "read_dex_file_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 639 | "RecordReadThread_test.cpp", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 640 | "workload_test.cpp", |
| 641 | ], |
| 642 | }, |
| 643 | }, |
| 644 | } |
| 645 | |
| 646 | cc_test { |
| 647 | name: "simpleperf_unit_test", |
| 648 | defaults: [ |
| 649 | "simpleperf_test_srcs", |
Yabin Cui | bcbffab | 2019-02-27 10:53:16 -0800 | [diff] [blame] | 650 | "simpleperf_libs_for_tests", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 651 | ], |
| 652 | static_libs: [ |
| 653 | "libgmock", |
Thiébaud Weksteen | 21a9932 | 2020-10-23 10:20:33 +0200 | [diff] [blame] | 654 | "libsimpleperf", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 655 | ], |
| 656 | target: { |
| 657 | android: { |
| 658 | test_suites: ["device-tests"], |
| 659 | }, |
| 660 | }, |
| 661 | data: [ |
| 662 | "testdata/**/*", |
| 663 | ], |
Yabin Cui | 0def132 | 2022-01-11 17:47:33 -0800 | [diff] [blame] | 664 | sanitize: { |
| 665 | memtag_heap: false, |
| 666 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 667 | } |
| 668 | |
| 669 | cc_test { |
| 670 | name: "simpleperf_cpu_hotplug_test", |
| 671 | defaults: [ |
Yabin Cui | bcbffab | 2019-02-27 10:53:16 -0800 | [diff] [blame] | 672 | "simpleperf_libs_for_tests", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 673 | ], |
Julien Desprez | ce5b22b | 2021-02-07 21:35:50 +0000 | [diff] [blame] | 674 | test_options: { |
| 675 | unit_test: true, |
| 676 | }, |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 677 | srcs: [ |
| 678 | "cpu_hotplug_test.cpp", |
| 679 | ], |
| 680 | static_libs: ["libsimpleperf"], |
| 681 | target: { |
| 682 | android: { |
| 683 | test_suites: ["device-tests"], |
| 684 | }, |
| 685 | darwin: { |
| 686 | enabled: false, |
| 687 | }, |
| 688 | windows: { |
| 689 | enabled: false, |
| 690 | }, |
| 691 | }, |
| 692 | } |
| 693 | |
| 694 | cc_library_static { |
| 695 | name: "libsimpleperf_cts_test", |
| 696 | defaults: [ |
| 697 | "simpleperf_test_srcs", |
Yabin Cui | bcbffab | 2019-02-27 10:53:16 -0800 | [diff] [blame] | 698 | "simpleperf_libs_for_tests", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 699 | ], |
| 700 | host_supported: false, |
| 701 | cflags: [ |
Yabin Cui | a24cf96 | 2019-01-29 17:06:42 -0800 | [diff] [blame] | 702 | "-DIN_CTS_TEST", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 703 | ], |
| 704 | static_libs: [ |
| 705 | "libgtest", |
| 706 | ], |
| 707 | whole_static_libs: [ |
| 708 | "libgmock", |
| 709 | "libsimpleperf", |
Yabin Cui | f00f4fc | 2022-11-23 15:15:30 -0800 | [diff] [blame] | 710 | "libsimpleperf_regex", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 711 | ], |
| 712 | } |
| 713 | |
| 714 | cc_test { |
| 715 | name: "simpleperf_record_test", |
| 716 | defaults: [ |
Yabin Cui | bcbffab | 2019-02-27 10:53:16 -0800 | [diff] [blame] | 717 | "simpleperf_libs_for_tests", |
Yabin Cui | f6e5e0a | 2019-01-22 10:54:13 -0800 | [diff] [blame] | 718 | ], |
| 719 | srcs: [ |
| 720 | "record_lib_test.cpp", |
| 721 | ], |
| 722 | shared_libs: ["libsimpleperf_record"], |
| 723 | target: { |
| 724 | android: { |
| 725 | test_suites: ["device-tests"], |
| 726 | }, |
| 727 | darwin: { |
| 728 | enabled: false, |
| 729 | }, |
| 730 | windows: { |
| 731 | enabled: false, |
| 732 | }, |
| 733 | }, |
Martin Stjernholm | 31eb7a0 | 2019-01-24 15:38:49 +0000 | [diff] [blame] | 734 | } |
Emma Lagier | a96327f | 2020-08-14 14:06:58 +0000 | [diff] [blame] | 735 | |
Yuntao Xu | 7bcda34 | 2021-07-07 19:40:37 -0700 | [diff] [blame] | 736 | filegroup { |
| 737 | name: "system-extras-simpleperf-testdata", |
| 738 | srcs: ["CtsSimpleperfTestCases_testdata/**/*"], |
| 739 | } |
Yabin Cui | fd4e08c | 2021-10-28 15:34:30 -0700 | [diff] [blame] | 740 | |
| 741 | cc_fuzz { |
| 742 | name: "libsimpleperf_report_fuzzer", |
| 743 | defaults: [ |
Yabin Cui | d9d49b4 | 2022-10-05 11:29:19 -0700 | [diff] [blame] | 744 | "simpleperf_static_libs", |
Yabin Cui | fd4e08c | 2021-10-28 15:34:30 -0700 | [diff] [blame] | 745 | ], |
| 746 | host_supported: true, |
| 747 | srcs: [ |
| 748 | "libsimpleperf_report_fuzzer.cpp", |
| 749 | ], |
| 750 | static_libs: [ |
| 751 | "libsimpleperf", |
Yabin Cui | fd4e08c | 2021-10-28 15:34:30 -0700 | [diff] [blame] | 752 | ], |
| 753 | target: { |
Yabin Cui | d9d49b4 | 2022-10-05 11:29:19 -0700 | [diff] [blame] | 754 | linux: { |
| 755 | // Fuzzer may not be able to load libdexfile. So statically link it. |
| 756 | static_libs: ["libdexfile_static"], |
| 757 | }, |
Yabin Cui | fd4e08c | 2021-10-28 15:34:30 -0700 | [diff] [blame] | 758 | windows: { |
| 759 | enabled: false, |
| 760 | }, |
| 761 | }, |
Yabin Cui | 2302d9c | 2022-11-22 15:26:05 -0800 | [diff] [blame] | 762 | corpus: ["testdata/**/*.data"], |
Yabin Cui | fd4e08c | 2021-10-28 15:34:30 -0700 | [diff] [blame] | 763 | } |