blob: 58943931ea0fa0cce119eb55d61d8b8c9cc1294e [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 },
68}
69
Yabin Cuifc9da9b2019-08-08 18:15:14 -070070// linked as a separate library because using OpenCSD headers needs to enable exception
71cc_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 Weksteen21a99322020-10-23 10:20:33 +020097 },
98 },
Yabin Cuifc9da9b2019-08-08 18:15:14 -070099}
100
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800101cc_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 Cuifc9da9b2019-08-08 18:15:14 -0700109 "libsimpleperf_etm_decoder",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800110 "libbase",
111 "liblog",
112 "libutils",
113 "libprotobuf-cpp-lite",
Yabin Cuifc9da9b2019-08-08 18:15:14 -0700114 "libopencsd_decoder",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800115 ],
116 target: {
117 linux: {
118 static_libs: [
119 "libunwindstack",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800120 "libcutils",
121 "libprocinfo",
122 "libevent",
Yabin Cuiea105c82020-07-22 13:01:31 -0700123 "libc++fs",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800124 ],
125 },
126 android: {
127 static_libs: [
128 "libc",
129 ],
130 },
Yabin Cuidf13edf2022-01-25 13:35:24 -0800131 linux_glibc_x86_64: {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800132 stl: "libc++_static",
133 },
Colin Crossa2b046a2022-03-24 16:25:09 -0700134 linux_musl_x86_64: {
135 stl: "libc++_static",
136 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800137 windows: {
138 enabled: true,
Yabin Cuidf13edf2022-01-25 13:35:24 -0800139 stl: "libc++_static",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800140 },
141 },
142 use_version_lib: true,
143}
144
145cc_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 Cuifc9da9b2019-08-08 18:15:14 -0700157 static_libs: [
158 "libsimpleperf_etm_decoder",
159 "libopencsd_decoder",
160 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800161 target: {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800162 linux: {
163 shared_libs: [
164 "libcutils",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800165 "libevent",
Martin Stjernholm48af21a2021-05-14 17:58:41 +0100166 "liblog",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800167 "libprocinfo",
168 "libunwindstack",
169 ],
Yabin Cuiea105c82020-07-22 13:01:31 -0700170 static_libs: [
171 "libc++fs",
Martin Stjernholm48af21a2021-05-14 17:58:41 +0100172 "libdexfile_support",
Yabin Cuiea105c82020-07-22 13:01:31 -0700173 ],
Martin Stjernholmc2b24092021-08-26 21:18:08 +0100174 runtime_libs: [
175 "libdexfile", // libdexfile_support dependency
176 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800177 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800178 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
195cc_defaults {
Yabin Cuibcbffab2019-02-27 10:53:16 -0800196 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
213cc_defaults {
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800214 name: "libsimpleperf_srcs",
215 srcs: [
Yabin Cui4192f462019-01-17 15:10:51 -0800216 "cmd_dumprecord.cpp",
217 "cmd_help.cpp",
Yabin Cuic573eaa2019-08-21 16:05:07 -0700218 "cmd_inject.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800219 "cmd_kmem.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700220 "cmd_merge.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800221 "cmd_report.cpp",
222 "cmd_report_sample.cpp",
Yabin Cuie0a19802021-03-16 17:24:11 -0700223 "cmd_report_sample.proto",
Yabin Cui4192f462019-01-17 15:10:51 -0800224 "command.cpp",
225 "dso.cpp",
Yabin Cui193f2382020-04-01 14:30:03 -0700226 "etm_branch_list.proto",
Yabin Cui4192f462019-01-17 15:10:51 -0800227 "event_attr.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800228 "event_type.cpp",
Yabin Cui36b57d92020-12-17 17:06:27 -0800229 "kallsyms.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800230 "perf_regs.cpp",
231 "read_apk.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800232 "read_elf.cpp",
Evgeny Eltsinc2dc7e52020-08-26 11:08:00 +0200233 "read_symbol_map.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800234 "record.cpp",
Yabin Cui5ea3bc12022-01-05 11:50:00 -0800235 "RecordFilter.cpp",
Yabin Cuifbbe9e52021-03-01 10:07:55 -0800236 "record_file.proto",
Yabin Cui4192f462019-01-17 15:10:51 -0800237 "record_file_reader.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700238 "record_file_writer.cpp",
Yabin Cuiac4b2492020-12-09 16:27:57 -0800239 "report_utils.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800240 "thread_tree.cpp",
241 "tracing.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800242 "utils.cpp",
Yabin Cui4192f462019-01-17 15:10:51 -0800243 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800244 target: {
Yabin Cui321bfe62022-01-15 14:09:46 -0800245 android: {
246 srcs: [
247 "cmd_boot_record.cpp",
248 ],
249 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800250 linux: {
251 srcs: [
252 "CallChainJoiner.cpp",
Yabin Cui1befe4f2019-02-25 15:22:43 -0800253 "cmd_api.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800254 "cmd_debug_unwind.cpp",
255 "cmd_list.cpp",
Thiébaud Weksteenf5c93be2020-10-19 13:07:20 +0200256 "cmd_monitor.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800257 "cmd_record.cpp",
258 "cmd_stat.cpp",
259 "cmd_trace_sched.cpp",
260 "environment.cpp",
Yabin Cuid5bccd12019-07-12 13:09:15 -0700261 "ETMRecorder.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800262 "event_fd.cpp",
263 "event_selection_set.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800264 "IOEventLoop.cpp",
265 "JITDebugReader.cpp",
Yabin Cui3ee97272020-10-28 09:23:24 -0700266 "MapRecordReader.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800267 "OfflineUnwinder.cpp",
Yabin Cui142acc82020-10-14 10:24:38 -0700268 "ProbeEvents.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800269 "read_dex_file.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800270 "RecordReadThread.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800271 "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
283cc_library_static {
284 name: "libsimpleperf",
285 defaults: [
286 "libsimpleperf_srcs",
287 "simpleperf_static_libs",
Yabin Cui4192f462019-01-17 15:10:51 -0800288 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800289 compile_multilib: "both",
290 proto: {
291 type: "lite",
292 },
293 static_libs: [
294 "libbuildversion",
295 ],
296 use_version_lib: false,
Martin Stjernholm54418f52020-03-18 01:15:51 +0000297
298 target: {
299 linux: {
Martin Stjernholm8a613512021-03-16 09:56:16 +0000300 // See note for libdexfile_static in simpleperf_ndk.
Martin Stjernholm54418f52020-03-18 01:15:51 +0000301 static_libs: ["libdexfile_support"],
Martin Stjernholmc2b24092021-08-26 21:18:08 +0100302 runtime_libs: ["libdexfile"], // libdexfile_support dependency
Martin Stjernholm54418f52020-03-18 01:15:51 +0000303 },
304 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800305}
306
307// simpleperf shipped in system image
308cc_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 Cuibcbffab2019-02-27 10:53:16 -0800318 target: {
319 android: {
320 shared_libs: [
321 "libLLVM_android",
322 ],
323 },
324 },
Yabin Cui321bfe62022-01-15 14:09:46 -0800325 init_rc: ["simpleperf.rc"],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800326}
327
Yi Konga86c7e32020-06-03 23:24:36 +0800328cc_library {
329 name: "libsimpleperf_profcollect",
Yi Kongf8abfdb2021-02-18 16:23:37 +0800330 defaults: ["simpleperf_shared_libs"],
Yi Konga86c7e32020-06-03 23:24:36 +0800331 srcs: ["profcollect.cpp"],
Yi Kongf8abfdb2021-02-18 16:23:37 +0800332 host_supported: false,
Thiébaud Weksteen21a99322020-10-23 10:20:33 +0200333 static_libs: ["libsimpleperf"],
Yabin Cui0d539c12022-02-17 09:57:42 -0800334 shared_libs: [
335 "libLLVM_android",
336 "libpower",
337 ],
Yi Kongf8abfdb2021-02-18 16:23:37 +0800338}
339
340rust_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
347rust_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 Konga86c7e32020-06-03 23:24:36 +0800353 visibility: ["//system/extras/profcollectd:__subpackages__"],
354}
355
Joel Galensonf8a52712021-08-23 13:46:38 -0700356rust_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 Cuif6e5e0a2019-01-22 10:54:13 -0800366// simpleperf released in ndk
367cc_binary {
368 name: "simpleperf_ndk",
369 defaults: [
370 "simpleperf_static_libs",
371 ],
372 dist: {
Yabin Cui7b0a9422019-08-20 10:32:56 -0700373 targets: ["simpleperf"],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800374 },
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 Stjernholm4d888102020-09-30 22:22:19 +0100423 linux: {
Martin Stjernholm8a613512021-03-16 09:56:16 +0000424 // 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 Stjernholm4d888102020-09-30 22:22:19 +0100429 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800430 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 Crossa2b046a2022-03-24 16:25:09 -0700440 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 Cuif6e5e0a2019-01-22 10:54:13 -0800450 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.
464cc_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 Weksteen21a99322020-10-23 10:20:33 +0200475 "libsimpleperf",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800476 ],
477 target: {
478 darwin: {
479 enabled: false,
480 },
481 windows: {
482 enabled: false,
483 },
Martin Stjernholm4d888102020-09-30 22:22:19 +0100484 linux: {
Martin Stjernholm8a613512021-03-16 09:56:16 +0000485 // See note for libdexfile_static in simpleperf_ndk.
486 static_libs: ["libdexfile_static"],
Martin Stjernholm4d888102020-09-30 22:22:19 +0100487 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800488 },
489}
490
491// It's the shared library used on host by python scripts to report samples in different ways.
492cc_library_shared {
493 name: "libsimpleperf_report",
494 defaults: [
495 "simpleperf_static_libs",
496 ],
497 dist: {
Yabin Cui7b0a9422019-08-20 10:32:56 -0700498 targets: ["simpleperf"],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800499 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800500 srcs: [
501 "report_lib_interface.cpp",
502 ],
503 static_libs: ["libsimpleperf"],
504
505 target: {
506 android: {
507 enabled: false,
508 },
Yabin Cui15fc25d2019-01-30 11:03:40 -0800509 linux: {
510 ldflags: ["-Wl,--exclude-libs,ALL"],
Martin Stjernholm8a613512021-03-16 09:56:16 +0000511 // See note for libdexfile_static in simpleperf_ndk.
512 static_libs: ["libdexfile_static"],
Yabin Cui15fc25d2019-01-30 11:03:40 -0800513 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800514 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 Crossa2b046a2022-03-24 16:25:09 -0700534 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 Cuif6e5e0a2019-01-22 10:54:13 -0800544 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 Cuif6e5e0a2019-01-22 10:54:13 -0800557cc_defaults {
558 name: "simpleperf_test_srcs",
Chih-Hung Hsiehfd1e5742022-02-17 17:24:21 -0800559 tidy_timeout_srcs: [
560 "record_test.cpp",
561 "cmd_report_sample_test.cpp",
562 "cmd_report_test.cpp",
563 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800564 srcs: [
Yabin Cuic573eaa2019-08-21 16:05:07 -0700565 "cmd_inject_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800566 "cmd_kmem_test.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700567 "cmd_merge_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800568 "cmd_report_test.cpp",
569 "cmd_report_sample_test.cpp",
570 "command_test.cpp",
571 "dso_test.cpp",
572 "gtest_main.cpp",
Yabin Cui36b57d92020-12-17 17:06:27 -0800573 "kallsyms_test.cpp",
Yabin Cuif227b6d2021-01-06 14:01:53 -0800574 "perf_regs_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800575 "read_apk_test.cpp",
576 "read_elf_test.cpp",
Evgeny Eltsinc2dc7e52020-08-26 11:08:00 +0200577 "read_symbol_map_test.cpp",
Yabin Cui5ea3bc12022-01-05 11:50:00 -0800578 "RecordFilter_test.cpp",
Yabin Cui8d005de2020-10-21 13:48:53 -0700579 "record_file_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800580 "record_test.cpp",
Yabin Cuiac4b2492020-12-09 16:27:57 -0800581 "report_utils_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800582 "sample_tree_test.cpp",
583 "thread_tree_test.cpp",
Thiébaud Weksteen90a68252020-10-27 15:05:33 +0100584 "test_util.cpp",
Yabin Cuia9cfcde2020-06-29 14:04:44 -0700585 "tracing_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800586 "utils_test.cpp",
587 ],
588 target: {
Yabin Cui321bfe62022-01-15 14:09:46 -0800589 android: {
590 srcs: [
591 "cmd_boot_record_test.cpp",
592 ],
593 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800594 linux: {
Chih-Hung Hsiehfd1e5742022-02-17 17:24:21 -0800595 tidy_timeout_srcs: [
596 "cmd_stat_test.cpp",
597 "cmd_record_test.cpp",
598 ],
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800599 srcs: [
600 "CallChainJoiner_test.cpp",
Yabin Cuidc1a4752020-02-10 17:53:34 -0800601 "cmd_api_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800602 "cmd_debug_unwind_test.cpp",
603 "cmd_dumprecord_test.cpp",
604 "cmd_list_test.cpp",
605 "cmd_record_test.cpp",
Thiébaud Weksteenf5c93be2020-10-19 13:07:20 +0200606 "cmd_monitor_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800607 "cmd_stat_test.cpp",
608 "cmd_trace_sched_test.cpp",
609 "environment_test.cpp",
610 "IOEventLoop_test.cpp",
Yabin Cuicac8eb02022-01-20 11:27:53 -0800611 "JITDebugReader_test.cpp",
Yabin Cui3ee97272020-10-28 09:23:24 -0700612 "MapRecordReader_test.cpp",
Yabin Cui39e59792020-01-23 12:32:26 -0800613 "OfflineUnwinder_test.cpp",
Yabin Cui142acc82020-10-14 10:24:38 -0700614 "ProbeEvents_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800615 "read_dex_file_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800616 "RecordReadThread_test.cpp",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800617 "workload_test.cpp",
618 ],
619 },
620 },
621}
622
623cc_test {
624 name: "simpleperf_unit_test",
625 defaults: [
626 "simpleperf_test_srcs",
Yabin Cuibcbffab2019-02-27 10:53:16 -0800627 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800628 ],
629 static_libs: [
630 "libgmock",
Thiébaud Weksteen21a99322020-10-23 10:20:33 +0200631 "libsimpleperf",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800632 ],
633 target: {
634 android: {
635 test_suites: ["device-tests"],
636 },
637 },
638 data: [
639 "testdata/**/*",
640 ],
Yabin Cui0def1322022-01-11 17:47:33 -0800641 sanitize: {
642 memtag_heap: false,
643 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800644}
645
646cc_test {
647 name: "simpleperf_cpu_hotplug_test",
648 defaults: [
Yabin Cuibcbffab2019-02-27 10:53:16 -0800649 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800650 ],
Julien Desprezce5b22b2021-02-07 21:35:50 +0000651 test_options: {
652 unit_test: true,
653 },
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800654 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
671cc_library_static {
672 name: "libsimpleperf_cts_test",
673 defaults: [
674 "simpleperf_test_srcs",
Yabin Cuibcbffab2019-02-27 10:53:16 -0800675 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800676 ],
677 host_supported: false,
678 cflags: [
Yabin Cuia24cf962019-01-29 17:06:42 -0800679 "-DIN_CTS_TEST",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800680 ],
681 static_libs: [
682 "libgtest",
683 ],
684 whole_static_libs: [
685 "libgmock",
686 "libsimpleperf",
687 ],
688}
689
690cc_test {
691 name: "simpleperf_record_test",
692 defaults: [
Yabin Cuibcbffab2019-02-27 10:53:16 -0800693 "simpleperf_libs_for_tests",
Yabin Cuif6e5e0a2019-01-22 10:54:13 -0800694 ],
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 Stjernholm31eb7a02019-01-24 15:38:49 +0000710}
Emma Lagiera96327f2020-08-14 14:06:58 +0000711
712python_library_host {
713 name: "simpleperf_report_lib",
714 srcs: [
715 "scripts/simpleperf_report_lib.py",
Yabin Cui27f37562020-10-15 10:18:35 -0700716 "scripts/simpleperf_utils.py",
Emma Lagiera96327f2020-08-14 14:06:58 +0000717 ],
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 Xu7bcda342021-07-07 19:40:37 -0700724
725filegroup {
726 name: "system-extras-simpleperf-testdata",
727 srcs: ["CtsSimpleperfTestCases_testdata/**/*"],
728}
Yabin Cuifd4e08c2021-10-28 15:34:30 -0700729
730cc_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}