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