blob: 475213b35eb475ac3cabb43d42931216b36a9143 [file] [log] [blame]
Yabin Cuie1deac52018-01-23 15:04:44 -08001//
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 Badour4e060082021-02-16 18:59:28 -080017package {
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
23license {
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 Cuie1deac52018-01-23 15:04:44 -080034cc_defaults {
Andreas Gampeb0172702018-09-17 13:33:02 -070035 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 Gampea3b752c2018-09-18 19:25:24 -070049cc_defaults {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -080050 name: "simpleperf_cflags",
51 target: {
52 host: {
53 cflags: [
54 "-DUSE_BIONIC_UAPI_HEADERS",
Thiébaud Weksteen21a99322020-10-23 10:20:33 +020055 "-fvisibility=hidden",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -080056 ],
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 Weksteen21a99322020-10-23 10:20:33 +020066 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -080067 },
Colin Cross11829852022-11-01 11:51:46 -070068 arch: {
69 riscv64: {
70 enabled: false,
71 },
72 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -080073}
74
Yabin Cuifc9da9b2019-08-08 18:15:14 -070075// linked as a separate library because using OpenCSD headers needs to enable exception
76cc_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 Weksteen21a99322020-10-23 10:20:33 +0200102 },
103 },
Yabin Cuifc9da9b2019-08-08 18:15:14 -0700104}
105
Yabin Cuif00f4fc2022-11-23 15:15:30 -0800106// Build regex support in a separate library to catch std::regex_error exception.
107cc_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 Cuif6e5e0a2019-01-22 10:54:13 -0800120cc_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 Cuifc9da9b2019-08-08 18:15:14 -0700128 "libsimpleperf_etm_decoder",
Yabin Cuif00f4fc2022-11-23 15:15:30 -0800129 "libsimpleperf_regex",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800130 "libbase",
131 "liblog",
132 "libutils",
133 "libprotobuf-cpp-lite",
Yabin Cuifc9da9b2019-08-08 18:15:14 -0700134 "libopencsd_decoder",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800135 ],
136 target: {
137 linux: {
138 static_libs: [
139 "libunwindstack",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800140 "libcutils",
141 "libprocinfo",
142 "libevent",
Yabin Cuiea105c82020-07-22 13:01:31 -0700143 "libc++fs",
Yabin Cui4d8137f2023-02-14 17:00:25 -0800144 "librustc_demangle_static",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800145 ],
146 },
Yabin Cuidf13edf2022-01-25 13:35:24 -0800147 linux_glibc_x86_64: {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800148 stl: "libc++_static",
149 },
Colin Crossa2b046a2022-03-24 16:25:09 -0700150 linux_musl_x86_64: {
151 stl: "libc++_static",
152 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800153 windows: {
154 enabled: true,
Yabin Cuidf13edf2022-01-25 13:35:24 -0800155 stl: "libc++_static",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800156 },
157 },
158 use_version_lib: true,
159}
160
161cc_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 Cuifc9da9b2019-08-08 18:15:14 -0700173 static_libs: [
174 "libsimpleperf_etm_decoder",
Yabin Cuif00f4fc2022-11-23 15:15:30 -0800175 "libsimpleperf_regex",
Yabin Cuifc9da9b2019-08-08 18:15:14 -0700176 "libopencsd_decoder",
177 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800178 target: {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800179 linux: {
180 shared_libs: [
181 "libcutils",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800182 "libevent",
Martin Stjernholm48af21a2021-05-14 17:58:41 +0100183 "liblog",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800184 "libprocinfo",
185 "libunwindstack",
186 ],
Yabin Cuiea105c82020-07-22 13:01:31 -0700187 static_libs: [
188 "libc++fs",
Martin Stjernholm48af21a2021-05-14 17:58:41 +0100189 "libdexfile_support",
Yabin Cui4d8137f2023-02-14 17:00:25 -0800190 "librustc_demangle_static",
Yabin Cuiea105c82020-07-22 13:01:31 -0700191 ],
Martin Stjernholmc2b24092021-08-26 21:18:08 +0100192 runtime_libs: [
193 "libdexfile", // libdexfile_support dependency
194 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800195 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800196 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
213cc_defaults {
Yabin Cuibcbffab2019-02-27 10:53:16 -0800214 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
231cc_defaults {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800232 name: "libsimpleperf_srcs",
233 srcs: [
Yabin Cui4192f462019-01-17 15:10:51 -0800234 "cmd_dumprecord.cpp",
235 "cmd_help.cpp",
Yabin Cuic573eaa2019-08-21 16:05:07 -0700236 "cmd_inject.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800237 "cmd_kmem.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700238 "cmd_merge.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800239 "cmd_report.cpp",
240 "cmd_report_sample.cpp",
Yabin Cuie0a19802021-03-16 17:24:11 -0700241 "cmd_report_sample.proto",
Yabin Cui4192f462019-01-17 15:10:51 -0800242 "command.cpp",
243 "dso.cpp",
Yabin Cui193f2382020-04-01 14:30:03 -0700244 "etm_branch_list.proto",
Yabin Cuida3b6ce2023-04-28 17:42:02 -0700245 "ETMBranchListFile.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800246 "event_attr.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800247 "event_type.cpp",
Yabin Cui36b57d92020-12-17 17:06:27 -0800248 "kallsyms.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800249 "perf_regs.cpp",
250 "read_apk.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800251 "read_elf.cpp",
Evgeny Eltsinc2dc7e52020-08-26 11:08:00 +0200252 "read_symbol_map.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800253 "record.cpp",
Yabin Cui5ea3bc12022-01-05 11:50:00 -0800254 "RecordFilter.cpp",
Yabin Cuifbbe9e52021-03-01 10:07:55 -0800255 "record_file.proto",
Yabin Cui4192f462019-01-17 15:10:51 -0800256 "record_file_reader.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700257 "record_file_writer.cpp",
Yabin Cuiac4b2492020-12-09 16:27:57 -0800258 "report_utils.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800259 "thread_tree.cpp",
260 "tracing.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800261 "utils.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800262 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800263 target: {
Yabin Cui321bfe62022-01-15 14:09:46 -0800264 android: {
265 srcs: [
266 "cmd_boot_record.cpp",
267 ],
268 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800269 linux: {
270 srcs: [
271 "CallChainJoiner.cpp",
Yabin Cui1befe4f2019-02-25 15:22:43 -0800272 "cmd_api.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800273 "cmd_debug_unwind.cpp",
274 "cmd_list.cpp",
Thiébaud Weksteenf5c93be2020-10-19 13:07:20 +0200275 "cmd_monitor.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800276 "cmd_record.cpp",
277 "cmd_stat.cpp",
278 "cmd_trace_sched.cpp",
279 "environment.cpp",
Yabin Cuid5bccd12019-07-12 13:09:15 -0700280 "ETMRecorder.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800281 "event_fd.cpp",
282 "event_selection_set.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800283 "IOEventLoop.cpp",
284 "JITDebugReader.cpp",
Yabin Cui3ee97272020-10-28 09:23:24 -0700285 "MapRecordReader.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800286 "OfflineUnwinder.cpp",
Yabin Cui142acc82020-10-14 10:24:38 -0700287 "ProbeEvents.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800288 "read_dex_file.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800289 "RecordReadThread.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800290 "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
302cc_library_static {
303 name: "libsimpleperf",
304 defaults: [
305 "libsimpleperf_srcs",
306 "simpleperf_static_libs",
Yabin Cui4192f462019-01-17 15:10:51 -0800307 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800308 compile_multilib: "both",
309 proto: {
310 type: "lite",
311 },
312 static_libs: [
313 "libbuildversion",
314 ],
315 use_version_lib: false,
Martin Stjernholm54418f52020-03-18 01:15:51 +0000316
317 target: {
318 linux: {
Martin Stjernholm8a613512021-03-16 09:56:16 +0000319 // See note for libdexfile_static in simpleperf_ndk.
Martin Stjernholm54418f52020-03-18 01:15:51 +0000320 static_libs: ["libdexfile_support"],
Martin Stjernholmc2b24092021-08-26 21:18:08 +0100321 runtime_libs: ["libdexfile"], // libdexfile_support dependency
Martin Stjernholm54418f52020-03-18 01:15:51 +0000322 },
323 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800324}
325
326// simpleperf shipped in system image
327cc_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 Cuibcbffab2019-02-27 10:53:16 -0800337 target: {
338 android: {
339 shared_libs: [
340 "libLLVM_android",
341 ],
342 },
343 },
Yabin Cui321bfe62022-01-15 14:09:46 -0800344 init_rc: ["simpleperf.rc"],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800345}
346
Yi Konga86c7e32020-06-03 23:24:36 +0800347cc_library {
348 name: "libsimpleperf_profcollect",
Yi Kongf8abfdb2021-02-18 16:23:37 +0800349 defaults: ["simpleperf_shared_libs"],
Yi Konga86c7e32020-06-03 23:24:36 +0800350 srcs: ["profcollect.cpp"],
Yi Kongf8abfdb2021-02-18 16:23:37 +0800351 host_supported: false,
Thiébaud Weksteen21a99322020-10-23 10:20:33 +0200352 static_libs: ["libsimpleperf"],
Yabin Cui0d539c12022-02-17 09:57:42 -0800353 shared_libs: [
354 "libLLVM_android",
355 "libpower",
356 ],
Yi Kongf8abfdb2021-02-18 16:23:37 +0800357}
358
359rust_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
366rust_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 Konga86c7e32020-06-03 23:24:36 +0800372 visibility: ["//system/extras/profcollectd:__subpackages__"],
373}
374
Joel Galensonf8a52712021-08-23 13:46:38 -0700375rust_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 Cuif6e5e0a2019-01-22 10:54:13 -0800385// simpleperf released in ndk
386cc_binary {
387 name: "simpleperf_ndk",
388 defaults: [
389 "simpleperf_static_libs",
390 ],
391 dist: {
Yabin Cui7b0a9422019-08-20 10:32:56 -0700392 targets: ["simpleperf"],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800393 },
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 Cuid9d49b42022-10-05 11:29:19 -0700411 static_libs: [
412 "libc",
413 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800414 },
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 Stjernholm4d888102020-09-30 22:22:19 +0100445 linux: {
Martin Stjernholm8a613512021-03-16 09:56:16 +0000446 // 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 Stjernholm4d888102020-09-30 22:22:19 +0100451 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800452 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 Crossa2b046a2022-03-24 16:25:09 -0700462 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 Cuif6e5e0a2019-01-22 10:54:13 -0800472 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.
486cc_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 Weksteen21a99322020-10-23 10:20:33 +0200497 "libsimpleperf",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800498 ],
499 target: {
500 darwin: {
501 enabled: false,
502 },
503 windows: {
504 enabled: false,
505 },
Martin Stjernholm4d888102020-09-30 22:22:19 +0100506 linux: {
Martin Stjernholm8a613512021-03-16 09:56:16 +0000507 // See note for libdexfile_static in simpleperf_ndk.
508 static_libs: ["libdexfile_static"],
Martin Stjernholm4d888102020-09-30 22:22:19 +0100509 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800510 },
511}
512
513// It's the shared library used on host by python scripts to report samples in different ways.
514cc_library_shared {
515 name: "libsimpleperf_report",
516 defaults: [
517 "simpleperf_static_libs",
518 ],
519 dist: {
Yabin Cui7b0a9422019-08-20 10:32:56 -0700520 targets: ["simpleperf"],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800521 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800522 srcs: [
523 "report_lib_interface.cpp",
524 ],
525 static_libs: ["libsimpleperf"],
526
527 target: {
528 android: {
529 enabled: false,
530 },
Yabin Cui15fc25d2019-01-30 11:03:40 -0800531 linux: {
532 ldflags: ["-Wl,--exclude-libs,ALL"],
Martin Stjernholm8a613512021-03-16 09:56:16 +0000533 // See note for libdexfile_static in simpleperf_ndk.
534 static_libs: ["libdexfile_static"],
Yabin Cui15fc25d2019-01-30 11:03:40 -0800535 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800536 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 Crossa2b046a2022-03-24 16:25:09 -0700556 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 Cuif6e5e0a2019-01-22 10:54:13 -0800566 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 Cuif6e5e0a2019-01-22 10:54:13 -0800579cc_defaults {
580 name: "simpleperf_test_srcs",
Chih-Hung Hsiehfd1e5742022-02-17 17:24:21 -0800581 tidy_timeout_srcs: [
582 "record_test.cpp",
583 "cmd_report_sample_test.cpp",
584 "cmd_report_test.cpp",
585 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800586 srcs: [
Yabin Cuic573eaa2019-08-21 16:05:07 -0700587 "cmd_inject_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800588 "cmd_kmem_test.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700589 "cmd_merge_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800590 "cmd_report_test.cpp",
591 "cmd_report_sample_test.cpp",
592 "command_test.cpp",
593 "dso_test.cpp",
594 "gtest_main.cpp",
Yabin Cui36b57d92020-12-17 17:06:27 -0800595 "kallsyms_test.cpp",
Yabin Cuif227b6d2021-01-06 14:01:53 -0800596 "perf_regs_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800597 "read_apk_test.cpp",
598 "read_elf_test.cpp",
Evgeny Eltsinc2dc7e52020-08-26 11:08:00 +0200599 "read_symbol_map_test.cpp",
Yabin Cui5ea3bc12022-01-05 11:50:00 -0800600 "RecordFilter_test.cpp",
Yabin Cuif00f4fc2022-11-23 15:15:30 -0800601 "RegEx_test.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700602 "record_file_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800603 "record_test.cpp",
Yabin Cuiac4b2492020-12-09 16:27:57 -0800604 "report_utils_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800605 "sample_tree_test.cpp",
606 "thread_tree_test.cpp",
Thiébaud Weksteen90a68252020-10-27 15:05:33 +0100607 "test_util.cpp",
Yabin Cuia9cfcde2020-06-29 14:04:44 -0700608 "tracing_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800609 "utils_test.cpp",
610 ],
611 target: {
Yabin Cui321bfe62022-01-15 14:09:46 -0800612 android: {
613 srcs: [
614 "cmd_boot_record_test.cpp",
615 ],
616 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800617 linux: {
Chih-Hung Hsiehfd1e5742022-02-17 17:24:21 -0800618 tidy_timeout_srcs: [
619 "cmd_stat_test.cpp",
620 "cmd_record_test.cpp",
621 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800622 srcs: [
623 "CallChainJoiner_test.cpp",
Yabin Cuidc1a4752020-02-10 17:53:34 -0800624 "cmd_api_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800625 "cmd_debug_unwind_test.cpp",
626 "cmd_dumprecord_test.cpp",
627 "cmd_list_test.cpp",
628 "cmd_record_test.cpp",
Thiébaud Weksteenf5c93be2020-10-19 13:07:20 +0200629 "cmd_monitor_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800630 "cmd_stat_test.cpp",
631 "cmd_trace_sched_test.cpp",
632 "environment_test.cpp",
633 "IOEventLoop_test.cpp",
Yabin Cuicac8eb02022-01-20 11:27:53 -0800634 "JITDebugReader_test.cpp",
Yabin Cui3ee97272020-10-28 09:23:24 -0700635 "MapRecordReader_test.cpp",
Yabin Cui39e59792020-01-23 12:32:26 -0800636 "OfflineUnwinder_test.cpp",
Yabin Cui142acc82020-10-14 10:24:38 -0700637 "ProbeEvents_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800638 "read_dex_file_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800639 "RecordReadThread_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800640 "workload_test.cpp",
641 ],
642 },
643 },
644}
645
646cc_test {
647 name: "simpleperf_unit_test",
648 defaults: [
649 "simpleperf_test_srcs",
Yabin Cuibcbffab2019-02-27 10:53:16 -0800650 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800651 ],
652 static_libs: [
653 "libgmock",
Thiébaud Weksteen21a99322020-10-23 10:20:33 +0200654 "libsimpleperf",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800655 ],
656 target: {
657 android: {
658 test_suites: ["device-tests"],
659 },
660 },
661 data: [
662 "testdata/**/*",
663 ],
Yabin Cui0def1322022-01-11 17:47:33 -0800664 sanitize: {
665 memtag_heap: false,
666 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800667}
668
669cc_test {
670 name: "simpleperf_cpu_hotplug_test",
671 defaults: [
Yabin Cuibcbffab2019-02-27 10:53:16 -0800672 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800673 ],
Julien Desprezce5b22b2021-02-07 21:35:50 +0000674 test_options: {
675 unit_test: true,
676 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800677 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
694cc_library_static {
695 name: "libsimpleperf_cts_test",
696 defaults: [
697 "simpleperf_test_srcs",
Yabin Cuibcbffab2019-02-27 10:53:16 -0800698 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800699 ],
700 host_supported: false,
701 cflags: [
Yabin Cuia24cf962019-01-29 17:06:42 -0800702 "-DIN_CTS_TEST",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800703 ],
704 static_libs: [
705 "libgtest",
706 ],
707 whole_static_libs: [
708 "libgmock",
709 "libsimpleperf",
Yabin Cuif00f4fc2022-11-23 15:15:30 -0800710 "libsimpleperf_regex",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800711 ],
712}
713
714cc_test {
715 name: "simpleperf_record_test",
716 defaults: [
Yabin Cuibcbffab2019-02-27 10:53:16 -0800717 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800718 ],
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 Stjernholm31eb7a02019-01-24 15:38:49 +0000734}
Emma Lagiera96327f2020-08-14 14:06:58 +0000735
Yuntao Xu7bcda342021-07-07 19:40:37 -0700736filegroup {
737 name: "system-extras-simpleperf-testdata",
738 srcs: ["CtsSimpleperfTestCases_testdata/**/*"],
739}
Yabin Cuifd4e08c2021-10-28 15:34:30 -0700740
741cc_fuzz {
742 name: "libsimpleperf_report_fuzzer",
743 defaults: [
Yabin Cuid9d49b42022-10-05 11:29:19 -0700744 "simpleperf_static_libs",
Yabin Cuifd4e08c2021-10-28 15:34:30 -0700745 ],
746 host_supported: true,
747 srcs: [
748 "libsimpleperf_report_fuzzer.cpp",
749 ],
750 static_libs: [
751 "libsimpleperf",
Yabin Cuifd4e08c2021-10-28 15:34:30 -0700752 ],
753 target: {
Yabin Cuid9d49b42022-10-05 11:29:19 -0700754 linux: {
755 // Fuzzer may not be able to load libdexfile. So statically link it.
756 static_libs: ["libdexfile_static"],
757 },
Yabin Cuifd4e08c2021-10-28 15:34:30 -0700758 windows: {
759 enabled: false,
760 },
761 },
Yabin Cui2302d9c2022-11-22 15:26:05 -0800762 corpus: ["testdata/**/*.data"],
Yabin Cuifd4e08c2021-10-28 15:34:30 -0700763}