xref: /aosp_15_r20/system/extras/simpleperf/Android.bp (revision 288bf5226967eb3dac5cce6c939ccc2a7f2b4fe5)
1*288bf522SAndroid Build Coastguard Worker//
2*288bf522SAndroid Build Coastguard Worker// Copyright (C) 2018 The Android Open Source Project
3*288bf522SAndroid Build Coastguard Worker//
4*288bf522SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
5*288bf522SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
6*288bf522SAndroid Build Coastguard Worker// You may obtain a copy of the License at
7*288bf522SAndroid Build Coastguard Worker//
8*288bf522SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
9*288bf522SAndroid Build Coastguard Worker//
10*288bf522SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
11*288bf522SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
12*288bf522SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*288bf522SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
14*288bf522SAndroid Build Coastguard Worker// limitations under the License.
15*288bf522SAndroid Build Coastguard Worker//
16*288bf522SAndroid Build Coastguard Worker
17*288bf522SAndroid Build Coastguard Workerpackage {
18*288bf522SAndroid Build Coastguard Worker    default_team: "trendy_team_llvm_and_toolchains",
19*288bf522SAndroid Build Coastguard Worker    default_applicable_licenses: ["system_extras_simpleperf_license"],
20*288bf522SAndroid Build Coastguard Worker}
21*288bf522SAndroid Build Coastguard Worker
22*288bf522SAndroid Build Coastguard Worker// Added automatically by a large-scale-change
23*288bf522SAndroid Build Coastguard Worker// See: http://go/android-license-faq
24*288bf522SAndroid Build Coastguard Workerlicense {
25*288bf522SAndroid Build Coastguard Worker    name: "system_extras_simpleperf_license",
26*288bf522SAndroid Build Coastguard Worker    visibility: [":__subpackages__"],
27*288bf522SAndroid Build Coastguard Worker    license_kinds: [
28*288bf522SAndroid Build Coastguard Worker        "SPDX-license-identifier-Apache-2.0",
29*288bf522SAndroid Build Coastguard Worker    ],
30*288bf522SAndroid Build Coastguard Worker    license_text: [
31*288bf522SAndroid Build Coastguard Worker        "NOTICE",
32*288bf522SAndroid Build Coastguard Worker    ],
33*288bf522SAndroid Build Coastguard Worker}
34*288bf522SAndroid Build Coastguard Worker
35*288bf522SAndroid Build Coastguard Workercc_defaults {
36*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_readelf_defaults",
37*288bf522SAndroid Build Coastguard Worker    static_libs: [
38*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_readelf",
39*288bf522SAndroid Build Coastguard Worker    ],
40*288bf522SAndroid Build Coastguard Worker    target: {
41*288bf522SAndroid Build Coastguard Worker        linux: {
42*288bf522SAndroid Build Coastguard Worker            ldflags: ["-Wl,--exclude-libs=libsimpleperf_readelf.a"],
43*288bf522SAndroid Build Coastguard Worker        },
44*288bf522SAndroid Build Coastguard Worker        windows: {
45*288bf522SAndroid Build Coastguard Worker            host_ldlibs: [
46*288bf522SAndroid Build Coastguard Worker                "-lole32",
47*288bf522SAndroid Build Coastguard Worker                "-luuid",
48*288bf522SAndroid Build Coastguard Worker            ],
49*288bf522SAndroid Build Coastguard Worker        },
50*288bf522SAndroid Build Coastguard Worker    },
51*288bf522SAndroid Build Coastguard Worker    sanitize: {
52*288bf522SAndroid Build Coastguard Worker        hwaddress: false,
53*288bf522SAndroid Build Coastguard Worker    },
54*288bf522SAndroid Build Coastguard Worker}
55*288bf522SAndroid Build Coastguard Worker
56*288bf522SAndroid Build Coastguard Workercc_defaults {
57*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_cflags",
58*288bf522SAndroid Build Coastguard Worker    target: {
59*288bf522SAndroid Build Coastguard Worker        host: {
60*288bf522SAndroid Build Coastguard Worker            cflags: [
61*288bf522SAndroid Build Coastguard Worker                "-DUSE_BIONIC_UAPI_HEADERS",
62*288bf522SAndroid Build Coastguard Worker                "-fvisibility=hidden",
63*288bf522SAndroid Build Coastguard Worker            ],
64*288bf522SAndroid Build Coastguard Worker            compile_multilib: "64",
65*288bf522SAndroid Build Coastguard Worker            include_dirs: ["bionic/libc/kernel"],
66*288bf522SAndroid Build Coastguard Worker        },
67*288bf522SAndroid Build Coastguard Worker        darwin: {
68*288bf522SAndroid Build Coastguard Worker            cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
69*288bf522SAndroid Build Coastguard Worker            local_include_dirs: ["nonlinux_support/include"],
70*288bf522SAndroid Build Coastguard Worker        },
71*288bf522SAndroid Build Coastguard Worker        windows: {
72*288bf522SAndroid Build Coastguard Worker            cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
73*288bf522SAndroid Build Coastguard Worker            local_include_dirs: ["nonlinux_support/include"],
74*288bf522SAndroid Build Coastguard Worker        },
75*288bf522SAndroid Build Coastguard Worker        android: {
76*288bf522SAndroid Build Coastguard Worker            compile_multilib: "both",
77*288bf522SAndroid Build Coastguard Worker        },
78*288bf522SAndroid Build Coastguard Worker    },
79*288bf522SAndroid Build Coastguard Worker}
80*288bf522SAndroid Build Coastguard Worker
81*288bf522SAndroid Build Coastguard Worker// linked as a separate library because using OpenCSD headers needs to enable exception
82*288bf522SAndroid Build Coastguard Workercc_library_static {
83*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_etm_decoder",
84*288bf522SAndroid Build Coastguard Worker    defaults: [
85*288bf522SAndroid Build Coastguard Worker        "simpleperf_cflags",
86*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_readelf_defaults",
87*288bf522SAndroid Build Coastguard Worker    ],
88*288bf522SAndroid Build Coastguard Worker    host_supported: true,
89*288bf522SAndroid Build Coastguard Worker    srcs: ["ETMDecoder.cpp"],
90*288bf522SAndroid Build Coastguard Worker    cppflags: [
91*288bf522SAndroid Build Coastguard Worker        // flags needed to include libopencsd_decoder headers
92*288bf522SAndroid Build Coastguard Worker        "-Wno-ignored-qualifiers",
93*288bf522SAndroid Build Coastguard Worker        "-Wno-unused-parameter",
94*288bf522SAndroid Build Coastguard Worker        "-Wno-switch",
95*288bf522SAndroid Build Coastguard Worker        "-Wno-unused-private-field",
96*288bf522SAndroid Build Coastguard Worker        "-Wno-implicit-fallthrough",
97*288bf522SAndroid Build Coastguard Worker        "-fexceptions",
98*288bf522SAndroid Build Coastguard Worker    ],
99*288bf522SAndroid Build Coastguard Worker    rtti: true,
100*288bf522SAndroid Build Coastguard Worker    static_libs: [
101*288bf522SAndroid Build Coastguard Worker        "libopencsd_decoder",
102*288bf522SAndroid Build Coastguard Worker        "libbase",
103*288bf522SAndroid Build Coastguard Worker        "liblog",
104*288bf522SAndroid Build Coastguard Worker    ],
105*288bf522SAndroid Build Coastguard Worker    target: {
106*288bf522SAndroid Build Coastguard Worker        windows: {
107*288bf522SAndroid Build Coastguard Worker            enabled: true,
108*288bf522SAndroid Build Coastguard Worker        },
109*288bf522SAndroid Build Coastguard Worker    },
110*288bf522SAndroid Build Coastguard Worker}
111*288bf522SAndroid Build Coastguard Worker
112*288bf522SAndroid Build Coastguard Worker// Build regex support in a separate library to catch std::regex_error exception.
113*288bf522SAndroid Build Coastguard Workercc_library_static {
114*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_regex",
115*288bf522SAndroid Build Coastguard Worker    host_supported: true,
116*288bf522SAndroid Build Coastguard Worker    srcs: ["RegEx.cpp"],
117*288bf522SAndroid Build Coastguard Worker    cppflags: ["-fexceptions"],
118*288bf522SAndroid Build Coastguard Worker    static_libs: ["libbase"],
119*288bf522SAndroid Build Coastguard Worker    target: {
120*288bf522SAndroid Build Coastguard Worker        windows: {
121*288bf522SAndroid Build Coastguard Worker            enabled: true,
122*288bf522SAndroid Build Coastguard Worker        },
123*288bf522SAndroid Build Coastguard Worker    },
124*288bf522SAndroid Build Coastguard Worker}
125*288bf522SAndroid Build Coastguard Worker
126*288bf522SAndroid Build Coastguard Workercc_defaults {
127*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_static_libs",
128*288bf522SAndroid Build Coastguard Worker    defaults: [
129*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_readelf_defaults",
130*288bf522SAndroid Build Coastguard Worker        "simpleperf_cflags",
131*288bf522SAndroid Build Coastguard Worker    ],
132*288bf522SAndroid Build Coastguard Worker    host_supported: true,
133*288bf522SAndroid Build Coastguard Worker    static_libs: [
134*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_etm_decoder",
135*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_regex",
136*288bf522SAndroid Build Coastguard Worker        "libbase",
137*288bf522SAndroid Build Coastguard Worker        "liblog",
138*288bf522SAndroid Build Coastguard Worker        "liblzma",
139*288bf522SAndroid Build Coastguard Worker        "libutils",
140*288bf522SAndroid Build Coastguard Worker        "libprotobuf-cpp-lite",
141*288bf522SAndroid Build Coastguard Worker        "libopencsd_decoder",
142*288bf522SAndroid Build Coastguard Worker        "libz",
143*288bf522SAndroid Build Coastguard Worker        "libziparchive",
144*288bf522SAndroid Build Coastguard Worker        "libzstd",
145*288bf522SAndroid Build Coastguard Worker    ],
146*288bf522SAndroid Build Coastguard Worker    target: {
147*288bf522SAndroid Build Coastguard Worker        host: {
148*288bf522SAndroid Build Coastguard Worker            stl: "libc++_static",
149*288bf522SAndroid Build Coastguard Worker        },
150*288bf522SAndroid Build Coastguard Worker        linux: {
151*288bf522SAndroid Build Coastguard Worker            static_libs: [
152*288bf522SAndroid Build Coastguard Worker                "libunwindstack",
153*288bf522SAndroid Build Coastguard Worker                "libcutils",
154*288bf522SAndroid Build Coastguard Worker                "libprocinfo",
155*288bf522SAndroid Build Coastguard Worker                "libevent",
156*288bf522SAndroid Build Coastguard Worker                "librustc_demangle_static",
157*288bf522SAndroid Build Coastguard Worker            ],
158*288bf522SAndroid Build Coastguard Worker        },
159*288bf522SAndroid Build Coastguard Worker        windows: {
160*288bf522SAndroid Build Coastguard Worker            enabled: true,
161*288bf522SAndroid Build Coastguard Worker        },
162*288bf522SAndroid Build Coastguard Worker    },
163*288bf522SAndroid Build Coastguard Worker    use_version_lib: true,
164*288bf522SAndroid Build Coastguard Worker}
165*288bf522SAndroid Build Coastguard Worker
166*288bf522SAndroid Build Coastguard Workercc_defaults {
167*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_shared_libs",
168*288bf522SAndroid Build Coastguard Worker    defaults: [
169*288bf522SAndroid Build Coastguard Worker        "simpleperf_cflags",
170*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_readelf_defaults",
171*288bf522SAndroid Build Coastguard Worker    ],
172*288bf522SAndroid Build Coastguard Worker    host_supported: true,
173*288bf522SAndroid Build Coastguard Worker    shared_libs: [
174*288bf522SAndroid Build Coastguard Worker        "libbase",
175*288bf522SAndroid Build Coastguard Worker        "liblog",
176*288bf522SAndroid Build Coastguard Worker        "liblzma",
177*288bf522SAndroid Build Coastguard Worker        "libprotobuf-cpp-lite",
178*288bf522SAndroid Build Coastguard Worker        "libz",
179*288bf522SAndroid Build Coastguard Worker        "libziparchive",
180*288bf522SAndroid Build Coastguard Worker    ],
181*288bf522SAndroid Build Coastguard Worker    static_libs: [
182*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_etm_decoder",
183*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_regex",
184*288bf522SAndroid Build Coastguard Worker        "libopencsd_decoder",
185*288bf522SAndroid Build Coastguard Worker        "libzstd",
186*288bf522SAndroid Build Coastguard Worker    ],
187*288bf522SAndroid Build Coastguard Worker    target: {
188*288bf522SAndroid Build Coastguard Worker        linux: {
189*288bf522SAndroid Build Coastguard Worker            shared_libs: [
190*288bf522SAndroid Build Coastguard Worker                "libcutils",
191*288bf522SAndroid Build Coastguard Worker                "libevent",
192*288bf522SAndroid Build Coastguard Worker                "libprocinfo",
193*288bf522SAndroid Build Coastguard Worker                "libunwindstack",
194*288bf522SAndroid Build Coastguard Worker            ],
195*288bf522SAndroid Build Coastguard Worker            static_libs: [
196*288bf522SAndroid Build Coastguard Worker                "libdexfile_support",
197*288bf522SAndroid Build Coastguard Worker                "librustc_demangle_static",
198*288bf522SAndroid Build Coastguard Worker            ],
199*288bf522SAndroid Build Coastguard Worker            runtime_libs: [
200*288bf522SAndroid Build Coastguard Worker                "libdexfile", // libdexfile_support dependency
201*288bf522SAndroid Build Coastguard Worker            ],
202*288bf522SAndroid Build Coastguard Worker        },
203*288bf522SAndroid Build Coastguard Worker        windows: {
204*288bf522SAndroid Build Coastguard Worker            enabled: true,
205*288bf522SAndroid Build Coastguard Worker        },
206*288bf522SAndroid Build Coastguard Worker    },
207*288bf522SAndroid Build Coastguard Worker    use_version_lib: true,
208*288bf522SAndroid Build Coastguard Worker}
209*288bf522SAndroid Build Coastguard Worker
210*288bf522SAndroid Build Coastguard Workerpython_binary_host {
211*288bf522SAndroid Build Coastguard Worker    name: "event_table_generator",
212*288bf522SAndroid Build Coastguard Worker    srcs: ["event_table_generator.py"],
213*288bf522SAndroid Build Coastguard Worker}
214*288bf522SAndroid Build Coastguard Worker
215*288bf522SAndroid Build Coastguard Workergenrule {
216*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_event_table",
217*288bf522SAndroid Build Coastguard Worker    out: ["event_table.cpp"],
218*288bf522SAndroid Build Coastguard Worker    srcs: ["event_table.json"],
219*288bf522SAndroid Build Coastguard Worker    tools: ["event_table_generator"],
220*288bf522SAndroid Build Coastguard Worker    cmd: "$(location event_table_generator) $(in) $(out)",
221*288bf522SAndroid Build Coastguard Worker}
222*288bf522SAndroid Build Coastguard Worker
223*288bf522SAndroid Build Coastguard Workercc_defaults {
224*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_srcs",
225*288bf522SAndroid Build Coastguard Worker    srcs: [
226*288bf522SAndroid Build Coastguard Worker        "cmd_dumprecord.cpp",
227*288bf522SAndroid Build Coastguard Worker        "cmd_help.cpp",
228*288bf522SAndroid Build Coastguard Worker        "cmd_inject.cpp",
229*288bf522SAndroid Build Coastguard Worker        "cmd_kmem.cpp",
230*288bf522SAndroid Build Coastguard Worker        "cmd_merge.cpp",
231*288bf522SAndroid Build Coastguard Worker        "cmd_report.cpp",
232*288bf522SAndroid Build Coastguard Worker        "cmd_report_sample.cpp",
233*288bf522SAndroid Build Coastguard Worker        "cmd_report_sample.proto",
234*288bf522SAndroid Build Coastguard Worker        "command.cpp",
235*288bf522SAndroid Build Coastguard Worker        "dso.cpp",
236*288bf522SAndroid Build Coastguard Worker        "branch_list.proto",
237*288bf522SAndroid Build Coastguard Worker        "BranchListFile.cpp",
238*288bf522SAndroid Build Coastguard Worker        "event_attr.cpp",
239*288bf522SAndroid Build Coastguard Worker        "event_type.cpp",
240*288bf522SAndroid Build Coastguard Worker        "kallsyms.cpp",
241*288bf522SAndroid Build Coastguard Worker        "perf_regs.cpp",
242*288bf522SAndroid Build Coastguard Worker        "read_apk.cpp",
243*288bf522SAndroid Build Coastguard Worker        "read_elf.cpp",
244*288bf522SAndroid Build Coastguard Worker        "read_symbol_map.cpp",
245*288bf522SAndroid Build Coastguard Worker        "record.cpp",
246*288bf522SAndroid Build Coastguard Worker        "RecordFilter.cpp",
247*288bf522SAndroid Build Coastguard Worker        "record_file.proto",
248*288bf522SAndroid Build Coastguard Worker        "record_file_reader.cpp",
249*288bf522SAndroid Build Coastguard Worker        "record_file_writer.cpp",
250*288bf522SAndroid Build Coastguard Worker        "report_utils.cpp",
251*288bf522SAndroid Build Coastguard Worker        "thread_tree.cpp",
252*288bf522SAndroid Build Coastguard Worker        "tracing.cpp",
253*288bf522SAndroid Build Coastguard Worker        "utils.cpp",
254*288bf522SAndroid Build Coastguard Worker        "ZstdUtil.cpp",
255*288bf522SAndroid Build Coastguard Worker        ":simpleperf_event_table",
256*288bf522SAndroid Build Coastguard Worker    ],
257*288bf522SAndroid Build Coastguard Worker    target: {
258*288bf522SAndroid Build Coastguard Worker        android: {
259*288bf522SAndroid Build Coastguard Worker            srcs: [
260*288bf522SAndroid Build Coastguard Worker                "cmd_boot_record.cpp",
261*288bf522SAndroid Build Coastguard Worker            ],
262*288bf522SAndroid Build Coastguard Worker        },
263*288bf522SAndroid Build Coastguard Worker        linux: {
264*288bf522SAndroid Build Coastguard Worker            srcs: [
265*288bf522SAndroid Build Coastguard Worker                "CallChainJoiner.cpp",
266*288bf522SAndroid Build Coastguard Worker                "cmd_api.cpp",
267*288bf522SAndroid Build Coastguard Worker                "cmd_debug_unwind.cpp",
268*288bf522SAndroid Build Coastguard Worker                "cmd_list.cpp",
269*288bf522SAndroid Build Coastguard Worker                "cmd_monitor.cpp",
270*288bf522SAndroid Build Coastguard Worker                "cmd_record.cpp",
271*288bf522SAndroid Build Coastguard Worker                "cmd_stat.cpp",
272*288bf522SAndroid Build Coastguard Worker                "cmd_trace_sched.cpp",
273*288bf522SAndroid Build Coastguard Worker                "environment.cpp",
274*288bf522SAndroid Build Coastguard Worker                "ETMRecorder.cpp",
275*288bf522SAndroid Build Coastguard Worker                "event_fd.cpp",
276*288bf522SAndroid Build Coastguard Worker                "event_selection_set.cpp",
277*288bf522SAndroid Build Coastguard Worker                "IOEventLoop.cpp",
278*288bf522SAndroid Build Coastguard Worker                "JITDebugReader.cpp",
279*288bf522SAndroid Build Coastguard Worker                "MapRecordReader.cpp",
280*288bf522SAndroid Build Coastguard Worker                "OfflineUnwinder.cpp",
281*288bf522SAndroid Build Coastguard Worker                "ProbeEvents.cpp",
282*288bf522SAndroid Build Coastguard Worker                "read_dex_file.cpp",
283*288bf522SAndroid Build Coastguard Worker                "RecordReadThread.cpp",
284*288bf522SAndroid Build Coastguard Worker                "workload.cpp",
285*288bf522SAndroid Build Coastguard Worker            ],
286*288bf522SAndroid Build Coastguard Worker        },
287*288bf522SAndroid Build Coastguard Worker        darwin: {
288*288bf522SAndroid Build Coastguard Worker            srcs: ["nonlinux_support/nonlinux_support.cpp"],
289*288bf522SAndroid Build Coastguard Worker        },
290*288bf522SAndroid Build Coastguard Worker        windows: {
291*288bf522SAndroid Build Coastguard Worker            srcs: ["nonlinux_support/nonlinux_support.cpp"],
292*288bf522SAndroid Build Coastguard Worker        },
293*288bf522SAndroid Build Coastguard Worker    },
294*288bf522SAndroid Build Coastguard Worker}
295*288bf522SAndroid Build Coastguard Worker
296*288bf522SAndroid Build Coastguard Workercc_library_static {
297*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf",
298*288bf522SAndroid Build Coastguard Worker    defaults: [
299*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_srcs",
300*288bf522SAndroid Build Coastguard Worker        "simpleperf_static_libs",
301*288bf522SAndroid Build Coastguard Worker    ],
302*288bf522SAndroid Build Coastguard Worker    proto: {
303*288bf522SAndroid Build Coastguard Worker        type: "lite",
304*288bf522SAndroid Build Coastguard Worker    },
305*288bf522SAndroid Build Coastguard Worker    static_libs: [
306*288bf522SAndroid Build Coastguard Worker        "libbuildversion",
307*288bf522SAndroid Build Coastguard Worker    ],
308*288bf522SAndroid Build Coastguard Worker    use_version_lib: false,
309*288bf522SAndroid Build Coastguard Worker
310*288bf522SAndroid Build Coastguard Worker    target: {
311*288bf522SAndroid Build Coastguard Worker        linux: {
312*288bf522SAndroid Build Coastguard Worker            // See note for libdexfile_static in simpleperf_ndk.
313*288bf522SAndroid Build Coastguard Worker            static_libs: ["libdexfile_support"],
314*288bf522SAndroid Build Coastguard Worker            runtime_libs: ["libdexfile"], // libdexfile_support dependency
315*288bf522SAndroid Build Coastguard Worker        },
316*288bf522SAndroid Build Coastguard Worker    },
317*288bf522SAndroid Build Coastguard Worker}
318*288bf522SAndroid Build Coastguard Worker
319*288bf522SAndroid Build Coastguard Worker// simpleperf shipped in system image
320*288bf522SAndroid Build Coastguard Workercc_binary {
321*288bf522SAndroid Build Coastguard Worker    name: "simpleperf",
322*288bf522SAndroid Build Coastguard Worker    defaults: [
323*288bf522SAndroid Build Coastguard Worker        "simpleperf_shared_libs",
324*288bf522SAndroid Build Coastguard Worker    ],
325*288bf522SAndroid Build Coastguard Worker    host_supported: false,
326*288bf522SAndroid Build Coastguard Worker    srcs: [
327*288bf522SAndroid Build Coastguard Worker        "main.cpp",
328*288bf522SAndroid Build Coastguard Worker    ],
329*288bf522SAndroid Build Coastguard Worker    static_libs: ["libsimpleperf"],
330*288bf522SAndroid Build Coastguard Worker    target: {
331*288bf522SAndroid Build Coastguard Worker        android: {
332*288bf522SAndroid Build Coastguard Worker            compile_multilib: "first",
333*288bf522SAndroid Build Coastguard Worker        },
334*288bf522SAndroid Build Coastguard Worker    },
335*288bf522SAndroid Build Coastguard Worker    init_rc: ["simpleperf.rc"],
336*288bf522SAndroid Build Coastguard Worker}
337*288bf522SAndroid Build Coastguard Worker
338*288bf522SAndroid Build Coastguard Workercc_library {
339*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_profcollect",
340*288bf522SAndroid Build Coastguard Worker    defaults: ["simpleperf_shared_libs"],
341*288bf522SAndroid Build Coastguard Worker    srcs: ["profcollect.cpp"],
342*288bf522SAndroid Build Coastguard Worker    host_supported: false,
343*288bf522SAndroid Build Coastguard Worker    ldflags: ["-Wl,--exclude-libs=ALL"],
344*288bf522SAndroid Build Coastguard Worker    static_libs: ["libsimpleperf"],
345*288bf522SAndroid Build Coastguard Worker    shared_libs: [
346*288bf522SAndroid Build Coastguard Worker        "libpower",
347*288bf522SAndroid Build Coastguard Worker    ],
348*288bf522SAndroid Build Coastguard Worker}
349*288bf522SAndroid Build Coastguard Worker
350*288bf522SAndroid Build Coastguard Workerrust_bindgen {
351*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_profcollect_bindgen",
352*288bf522SAndroid Build Coastguard Worker    wrapper_src: "include/simpleperf_profcollect.hpp",
353*288bf522SAndroid Build Coastguard Worker    crate_name: "simpleperf_profcollect_bindgen",
354*288bf522SAndroid Build Coastguard Worker    source_stem: "bindings",
355*288bf522SAndroid Build Coastguard Worker}
356*288bf522SAndroid Build Coastguard Worker
357*288bf522SAndroid Build Coastguard Workerrust_library {
358*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_profcollect_rust",
359*288bf522SAndroid Build Coastguard Worker    crate_name: "simpleperf_profcollect",
360*288bf522SAndroid Build Coastguard Worker    srcs: ["rust/lib.rs"],
361*288bf522SAndroid Build Coastguard Worker    rlibs: ["libsimpleperf_profcollect_bindgen"],
362*288bf522SAndroid Build Coastguard Worker    shared_libs: ["libsimpleperf_profcollect"],
363*288bf522SAndroid Build Coastguard Worker    visibility: ["//system/extras/profcollectd:__subpackages__"],
364*288bf522SAndroid Build Coastguard Worker}
365*288bf522SAndroid Build Coastguard Worker
366*288bf522SAndroid Build Coastguard Workerrust_test {
367*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_profcollect_bindgen_test",
368*288bf522SAndroid Build Coastguard Worker    srcs: [":libsimpleperf_profcollect_bindgen"],
369*288bf522SAndroid Build Coastguard Worker    crate_name: "simpleperf_profcollect_bindgen_test",
370*288bf522SAndroid Build Coastguard Worker    test_suites: ["general-tests"],
371*288bf522SAndroid Build Coastguard Worker    auto_gen_config: true,
372*288bf522SAndroid Build Coastguard Worker    clippy_lints: "none",
373*288bf522SAndroid Build Coastguard Worker    lints: "none",
374*288bf522SAndroid Build Coastguard Worker}
375*288bf522SAndroid Build Coastguard Worker
376*288bf522SAndroid Build Coastguard Worker// simpleperf released in ndk
377*288bf522SAndroid Build Coastguard Workercc_binary {
378*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_ndk",
379*288bf522SAndroid Build Coastguard Worker    defaults: [
380*288bf522SAndroid Build Coastguard Worker        "simpleperf_static_libs",
381*288bf522SAndroid Build Coastguard Worker    ],
382*288bf522SAndroid Build Coastguard Worker    dist: {
383*288bf522SAndroid Build Coastguard Worker        targets: ["simpleperf"],
384*288bf522SAndroid Build Coastguard Worker    },
385*288bf522SAndroid Build Coastguard Worker    multilib: {
386*288bf522SAndroid Build Coastguard Worker        lib32: {
387*288bf522SAndroid Build Coastguard Worker            suffix: "32",
388*288bf522SAndroid Build Coastguard Worker        },
389*288bf522SAndroid Build Coastguard Worker    },
390*288bf522SAndroid Build Coastguard Worker    srcs: [
391*288bf522SAndroid Build Coastguard Worker        "main.cpp",
392*288bf522SAndroid Build Coastguard Worker    ],
393*288bf522SAndroid Build Coastguard Worker    static_libs: [
394*288bf522SAndroid Build Coastguard Worker        "libsimpleperf",
395*288bf522SAndroid Build Coastguard Worker    ],
396*288bf522SAndroid Build Coastguard Worker
397*288bf522SAndroid Build Coastguard Worker    target: {
398*288bf522SAndroid Build Coastguard Worker        android: {
399*288bf522SAndroid Build Coastguard Worker            static_executable: true,
400*288bf522SAndroid Build Coastguard Worker            static_libs: [
401*288bf522SAndroid Build Coastguard Worker                "libc",
402*288bf522SAndroid Build Coastguard Worker            ],
403*288bf522SAndroid Build Coastguard Worker        },
404*288bf522SAndroid Build Coastguard Worker        android_arm: {
405*288bf522SAndroid Build Coastguard Worker            dist: {
406*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/android/arm",
407*288bf522SAndroid Build Coastguard Worker            },
408*288bf522SAndroid Build Coastguard Worker        },
409*288bf522SAndroid Build Coastguard Worker        android_arm64: {
410*288bf522SAndroid Build Coastguard Worker            dist: {
411*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/android/arm64",
412*288bf522SAndroid Build Coastguard Worker            },
413*288bf522SAndroid Build Coastguard Worker        },
414*288bf522SAndroid Build Coastguard Worker        android_x86: {
415*288bf522SAndroid Build Coastguard Worker            dist: {
416*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/android/x86",
417*288bf522SAndroid Build Coastguard Worker            },
418*288bf522SAndroid Build Coastguard Worker        },
419*288bf522SAndroid Build Coastguard Worker        android_x86_64: {
420*288bf522SAndroid Build Coastguard Worker            dist: {
421*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/android/x86_64",
422*288bf522SAndroid Build Coastguard Worker            },
423*288bf522SAndroid Build Coastguard Worker        },
424*288bf522SAndroid Build Coastguard Worker        host: {
425*288bf522SAndroid Build Coastguard Worker            stem: "simpleperf",
426*288bf522SAndroid Build Coastguard Worker        },
427*288bf522SAndroid Build Coastguard Worker        darwin: {
428*288bf522SAndroid Build Coastguard Worker            dist: {
429*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/darwin/x86",
430*288bf522SAndroid Build Coastguard Worker            },
431*288bf522SAndroid Build Coastguard Worker        },
432*288bf522SAndroid Build Coastguard Worker        darwin_x86_64: {
433*288bf522SAndroid Build Coastguard Worker            dist: {
434*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/darwin/x86_64",
435*288bf522SAndroid Build Coastguard Worker            },
436*288bf522SAndroid Build Coastguard Worker        },
437*288bf522SAndroid Build Coastguard Worker        linux: {
438*288bf522SAndroid Build Coastguard Worker            // In the NDK we need libdexfile_static which links libdexfile and
439*288bf522SAndroid Build Coastguard Worker            // its ART dependencies statically. However in other libraries we
440*288bf522SAndroid Build Coastguard Worker            // must use libdexfile_support, which dlopen's libdexfile.so from
441*288bf522SAndroid Build Coastguard Worker            // the ART APEX, to avoid getting ART internals in the system image.
442*288bf522SAndroid Build Coastguard Worker            static_libs: ["libdexfile_static"],
443*288bf522SAndroid Build Coastguard Worker        },
444*288bf522SAndroid Build Coastguard Worker        linux_glibc_x86: {
445*288bf522SAndroid Build Coastguard Worker            dist: {
446*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux/x86",
447*288bf522SAndroid Build Coastguard Worker            },
448*288bf522SAndroid Build Coastguard Worker        },
449*288bf522SAndroid Build Coastguard Worker        linux_glibc_x86_64: {
450*288bf522SAndroid Build Coastguard Worker            dist: {
451*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux/x86_64",
452*288bf522SAndroid Build Coastguard Worker            },
453*288bf522SAndroid Build Coastguard Worker        },
454*288bf522SAndroid Build Coastguard Worker        linux_musl_x86: {
455*288bf522SAndroid Build Coastguard Worker            dist: {
456*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux_musl/x86",
457*288bf522SAndroid Build Coastguard Worker            },
458*288bf522SAndroid Build Coastguard Worker        },
459*288bf522SAndroid Build Coastguard Worker        linux_musl_x86_64: {
460*288bf522SAndroid Build Coastguard Worker            dist: {
461*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux_musl/x86_64",
462*288bf522SAndroid Build Coastguard Worker            },
463*288bf522SAndroid Build Coastguard Worker        },
464*288bf522SAndroid Build Coastguard Worker        windows_x86: {
465*288bf522SAndroid Build Coastguard Worker            dist: {
466*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/windows/x86",
467*288bf522SAndroid Build Coastguard Worker            },
468*288bf522SAndroid Build Coastguard Worker        },
469*288bf522SAndroid Build Coastguard Worker        windows_x86_64: {
470*288bf522SAndroid Build Coastguard Worker            dist: {
471*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/windows/x86_64",
472*288bf522SAndroid Build Coastguard Worker            },
473*288bf522SAndroid Build Coastguard Worker        },
474*288bf522SAndroid Build Coastguard Worker    },
475*288bf522SAndroid Build Coastguard Worker}
476*288bf522SAndroid Build Coastguard Worker
477*288bf522SAndroid Build Coastguard Worker// It's linked to user's program, to get profile counters and samples for specific code ranges.
478*288bf522SAndroid Build Coastguard Workercc_library {
479*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_record",
480*288bf522SAndroid Build Coastguard Worker    defaults: [
481*288bf522SAndroid Build Coastguard Worker        "simpleperf_static_libs",
482*288bf522SAndroid Build Coastguard Worker    ],
483*288bf522SAndroid Build Coastguard Worker    export_include_dirs: ["include"],
484*288bf522SAndroid Build Coastguard Worker    ldflags: ["-Wl,--exclude-libs,ALL"],
485*288bf522SAndroid Build Coastguard Worker    srcs: [
486*288bf522SAndroid Build Coastguard Worker        "record_lib_interface.cpp",
487*288bf522SAndroid Build Coastguard Worker    ],
488*288bf522SAndroid Build Coastguard Worker    static_libs: [
489*288bf522SAndroid Build Coastguard Worker        "libsimpleperf",
490*288bf522SAndroid Build Coastguard Worker    ],
491*288bf522SAndroid Build Coastguard Worker    target: {
492*288bf522SAndroid Build Coastguard Worker        darwin: {
493*288bf522SAndroid Build Coastguard Worker            enabled: false,
494*288bf522SAndroid Build Coastguard Worker        },
495*288bf522SAndroid Build Coastguard Worker        windows: {
496*288bf522SAndroid Build Coastguard Worker            enabled: false,
497*288bf522SAndroid Build Coastguard Worker        },
498*288bf522SAndroid Build Coastguard Worker        linux: {
499*288bf522SAndroid Build Coastguard Worker            // See note for libdexfile_static in simpleperf_ndk.
500*288bf522SAndroid Build Coastguard Worker            static_libs: ["libdexfile_static"],
501*288bf522SAndroid Build Coastguard Worker        },
502*288bf522SAndroid Build Coastguard Worker    },
503*288bf522SAndroid Build Coastguard Worker}
504*288bf522SAndroid Build Coastguard Worker
505*288bf522SAndroid Build Coastguard Worker// It's the shared library used on host by python scripts to report samples in different ways.
506*288bf522SAndroid Build Coastguard Workercc_library_shared {
507*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_report",
508*288bf522SAndroid Build Coastguard Worker    defaults: [
509*288bf522SAndroid Build Coastguard Worker        "simpleperf_static_libs",
510*288bf522SAndroid Build Coastguard Worker    ],
511*288bf522SAndroid Build Coastguard Worker    dist: {
512*288bf522SAndroid Build Coastguard Worker        targets: ["simpleperf"],
513*288bf522SAndroid Build Coastguard Worker    },
514*288bf522SAndroid Build Coastguard Worker    srcs: [
515*288bf522SAndroid Build Coastguard Worker        "report_lib_interface.cpp",
516*288bf522SAndroid Build Coastguard Worker    ],
517*288bf522SAndroid Build Coastguard Worker    static_libs: ["libsimpleperf"],
518*288bf522SAndroid Build Coastguard Worker
519*288bf522SAndroid Build Coastguard Worker    target: {
520*288bf522SAndroid Build Coastguard Worker        android: {
521*288bf522SAndroid Build Coastguard Worker            enabled: false,
522*288bf522SAndroid Build Coastguard Worker        },
523*288bf522SAndroid Build Coastguard Worker        linux: {
524*288bf522SAndroid Build Coastguard Worker            ldflags: ["-Wl,--exclude-libs,ALL"],
525*288bf522SAndroid Build Coastguard Worker            // See note for libdexfile_static in simpleperf_ndk.
526*288bf522SAndroid Build Coastguard Worker            static_libs: ["libdexfile_static"],
527*288bf522SAndroid Build Coastguard Worker        },
528*288bf522SAndroid Build Coastguard Worker        darwin: {
529*288bf522SAndroid Build Coastguard Worker            dist: {
530*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/darwin/x86",
531*288bf522SAndroid Build Coastguard Worker            },
532*288bf522SAndroid Build Coastguard Worker        },
533*288bf522SAndroid Build Coastguard Worker        darwin_x86_64: {
534*288bf522SAndroid Build Coastguard Worker            dist: {
535*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/darwin/x86_64",
536*288bf522SAndroid Build Coastguard Worker            },
537*288bf522SAndroid Build Coastguard Worker        },
538*288bf522SAndroid Build Coastguard Worker        linux_glibc_x86: {
539*288bf522SAndroid Build Coastguard Worker            dist: {
540*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux/x86",
541*288bf522SAndroid Build Coastguard Worker            },
542*288bf522SAndroid Build Coastguard Worker        },
543*288bf522SAndroid Build Coastguard Worker        linux_glibc_x86_64: {
544*288bf522SAndroid Build Coastguard Worker            dist: {
545*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux/x86_64",
546*288bf522SAndroid Build Coastguard Worker            },
547*288bf522SAndroid Build Coastguard Worker        },
548*288bf522SAndroid Build Coastguard Worker        linux_musl_x86: {
549*288bf522SAndroid Build Coastguard Worker            dist: {
550*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux_musl/x86",
551*288bf522SAndroid Build Coastguard Worker            },
552*288bf522SAndroid Build Coastguard Worker        },
553*288bf522SAndroid Build Coastguard Worker        linux_musl_x86_64: {
554*288bf522SAndroid Build Coastguard Worker            dist: {
555*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/linux_musl/x86_64",
556*288bf522SAndroid Build Coastguard Worker            },
557*288bf522SAndroid Build Coastguard Worker        },
558*288bf522SAndroid Build Coastguard Worker        windows_x86: {
559*288bf522SAndroid Build Coastguard Worker            dist: {
560*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/windows/x86",
561*288bf522SAndroid Build Coastguard Worker            },
562*288bf522SAndroid Build Coastguard Worker        },
563*288bf522SAndroid Build Coastguard Worker        windows_x86_64: {
564*288bf522SAndroid Build Coastguard Worker            dist: {
565*288bf522SAndroid Build Coastguard Worker                dir: "simpleperf/windows/x86_64",
566*288bf522SAndroid Build Coastguard Worker            },
567*288bf522SAndroid Build Coastguard Worker        },
568*288bf522SAndroid Build Coastguard Worker    },
569*288bf522SAndroid Build Coastguard Worker}
570*288bf522SAndroid Build Coastguard Worker
571*288bf522SAndroid Build Coastguard Workercc_defaults {
572*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_test_srcs",
573*288bf522SAndroid Build Coastguard Worker    tidy_timeout_srcs: [
574*288bf522SAndroid Build Coastguard Worker        "record_test.cpp",
575*288bf522SAndroid Build Coastguard Worker        "cmd_report_sample_test.cpp",
576*288bf522SAndroid Build Coastguard Worker        "cmd_report_test.cpp",
577*288bf522SAndroid Build Coastguard Worker    ],
578*288bf522SAndroid Build Coastguard Worker    srcs: [
579*288bf522SAndroid Build Coastguard Worker        "BranchListFile_test.cpp",
580*288bf522SAndroid Build Coastguard Worker        "cmd_inject_test.cpp",
581*288bf522SAndroid Build Coastguard Worker        "cmd_kmem_test.cpp",
582*288bf522SAndroid Build Coastguard Worker        "cmd_merge_test.cpp",
583*288bf522SAndroid Build Coastguard Worker        "cmd_report_test.cpp",
584*288bf522SAndroid Build Coastguard Worker        "cmd_report_sample_test.cpp",
585*288bf522SAndroid Build Coastguard Worker        "command_test.cpp",
586*288bf522SAndroid Build Coastguard Worker        "dso_test.cpp",
587*288bf522SAndroid Build Coastguard Worker        "gtest_main.cpp",
588*288bf522SAndroid Build Coastguard Worker        "kallsyms_test.cpp",
589*288bf522SAndroid Build Coastguard Worker        "perf_regs_test.cpp",
590*288bf522SAndroid Build Coastguard Worker        "read_apk_test.cpp",
591*288bf522SAndroid Build Coastguard Worker        "read_elf_test.cpp",
592*288bf522SAndroid Build Coastguard Worker        "read_symbol_map_test.cpp",
593*288bf522SAndroid Build Coastguard Worker        "RecordFilter_test.cpp",
594*288bf522SAndroid Build Coastguard Worker        "RegEx_test.cpp",
595*288bf522SAndroid Build Coastguard Worker        "record_file_test.cpp",
596*288bf522SAndroid Build Coastguard Worker        "record_test.cpp",
597*288bf522SAndroid Build Coastguard Worker        "report_utils_test.cpp",
598*288bf522SAndroid Build Coastguard Worker        "sample_tree_test.cpp",
599*288bf522SAndroid Build Coastguard Worker        "thread_tree_test.cpp",
600*288bf522SAndroid Build Coastguard Worker        "test_util.cpp",
601*288bf522SAndroid Build Coastguard Worker        "tracing_test.cpp",
602*288bf522SAndroid Build Coastguard Worker        "utils_test.cpp",
603*288bf522SAndroid Build Coastguard Worker        "ZstdUtil_test.cpp",
604*288bf522SAndroid Build Coastguard Worker    ],
605*288bf522SAndroid Build Coastguard Worker    target: {
606*288bf522SAndroid Build Coastguard Worker        android: {
607*288bf522SAndroid Build Coastguard Worker            srcs: [
608*288bf522SAndroid Build Coastguard Worker                "cmd_boot_record_test.cpp",
609*288bf522SAndroid Build Coastguard Worker            ],
610*288bf522SAndroid Build Coastguard Worker        },
611*288bf522SAndroid Build Coastguard Worker        linux: {
612*288bf522SAndroid Build Coastguard Worker            tidy_timeout_srcs: [
613*288bf522SAndroid Build Coastguard Worker                "cmd_stat_test.cpp",
614*288bf522SAndroid Build Coastguard Worker                "cmd_record_test.cpp",
615*288bf522SAndroid Build Coastguard Worker            ],
616*288bf522SAndroid Build Coastguard Worker            srcs: [
617*288bf522SAndroid Build Coastguard Worker                "CallChainJoiner_test.cpp",
618*288bf522SAndroid Build Coastguard Worker                "cmd_api_test.cpp",
619*288bf522SAndroid Build Coastguard Worker                "cmd_debug_unwind_test.cpp",
620*288bf522SAndroid Build Coastguard Worker                "cmd_dumprecord_test.cpp",
621*288bf522SAndroid Build Coastguard Worker                "cmd_list_test.cpp",
622*288bf522SAndroid Build Coastguard Worker                "cmd_record_test.cpp",
623*288bf522SAndroid Build Coastguard Worker                "cmd_monitor_test.cpp",
624*288bf522SAndroid Build Coastguard Worker                "cmd_stat_test.cpp",
625*288bf522SAndroid Build Coastguard Worker                "cmd_trace_sched_test.cpp",
626*288bf522SAndroid Build Coastguard Worker                "environment_test.cpp",
627*288bf522SAndroid Build Coastguard Worker                "event_selection_set_test.cpp",
628*288bf522SAndroid Build Coastguard Worker                "IOEventLoop_test.cpp",
629*288bf522SAndroid Build Coastguard Worker                "JITDebugReader_test.cpp",
630*288bf522SAndroid Build Coastguard Worker                "MapRecordReader_test.cpp",
631*288bf522SAndroid Build Coastguard Worker                "OfflineUnwinder_test.cpp",
632*288bf522SAndroid Build Coastguard Worker                "ProbeEvents_test.cpp",
633*288bf522SAndroid Build Coastguard Worker                "read_dex_file_test.cpp",
634*288bf522SAndroid Build Coastguard Worker                "RecordReadThread_test.cpp",
635*288bf522SAndroid Build Coastguard Worker                "workload_test.cpp",
636*288bf522SAndroid Build Coastguard Worker            ],
637*288bf522SAndroid Build Coastguard Worker        },
638*288bf522SAndroid Build Coastguard Worker    },
639*288bf522SAndroid Build Coastguard Worker}
640*288bf522SAndroid Build Coastguard Worker
641*288bf522SAndroid Build Coastguard Workercc_test {
642*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_unit_test",
643*288bf522SAndroid Build Coastguard Worker    defaults: [
644*288bf522SAndroid Build Coastguard Worker        "simpleperf_test_srcs",
645*288bf522SAndroid Build Coastguard Worker        "simpleperf_shared_libs",
646*288bf522SAndroid Build Coastguard Worker    ],
647*288bf522SAndroid Build Coastguard Worker    static_libs: [
648*288bf522SAndroid Build Coastguard Worker        "libgmock",
649*288bf522SAndroid Build Coastguard Worker        "libsimpleperf",
650*288bf522SAndroid Build Coastguard Worker    ],
651*288bf522SAndroid Build Coastguard Worker    target: {
652*288bf522SAndroid Build Coastguard Worker        android: {
653*288bf522SAndroid Build Coastguard Worker            test_suites: ["device-tests"],
654*288bf522SAndroid Build Coastguard Worker        },
655*288bf522SAndroid Build Coastguard Worker    },
656*288bf522SAndroid Build Coastguard Worker    data: [
657*288bf522SAndroid Build Coastguard Worker        "testdata/**/*",
658*288bf522SAndroid Build Coastguard Worker    ],
659*288bf522SAndroid Build Coastguard Worker    sanitize: {
660*288bf522SAndroid Build Coastguard Worker        memtag_heap: false,
661*288bf522SAndroid Build Coastguard Worker    },
662*288bf522SAndroid Build Coastguard Worker}
663*288bf522SAndroid Build Coastguard Worker
664*288bf522SAndroid Build Coastguard Workercc_test {
665*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_cpu_hotplug_test",
666*288bf522SAndroid Build Coastguard Worker    defaults: [
667*288bf522SAndroid Build Coastguard Worker        "simpleperf_shared_libs",
668*288bf522SAndroid Build Coastguard Worker    ],
669*288bf522SAndroid Build Coastguard Worker    test_options: {
670*288bf522SAndroid Build Coastguard Worker        unit_test: true,
671*288bf522SAndroid Build Coastguard Worker    },
672*288bf522SAndroid Build Coastguard Worker    srcs: [
673*288bf522SAndroid Build Coastguard Worker        "cpu_hotplug_test.cpp",
674*288bf522SAndroid Build Coastguard Worker    ],
675*288bf522SAndroid Build Coastguard Worker    static_libs: ["libsimpleperf"],
676*288bf522SAndroid Build Coastguard Worker    target: {
677*288bf522SAndroid Build Coastguard Worker        android: {
678*288bf522SAndroid Build Coastguard Worker            test_suites: ["device-tests"],
679*288bf522SAndroid Build Coastguard Worker        },
680*288bf522SAndroid Build Coastguard Worker        darwin: {
681*288bf522SAndroid Build Coastguard Worker            enabled: false,
682*288bf522SAndroid Build Coastguard Worker        },
683*288bf522SAndroid Build Coastguard Worker        windows: {
684*288bf522SAndroid Build Coastguard Worker            enabled: false,
685*288bf522SAndroid Build Coastguard Worker        },
686*288bf522SAndroid Build Coastguard Worker    },
687*288bf522SAndroid Build Coastguard Worker}
688*288bf522SAndroid Build Coastguard Worker
689*288bf522SAndroid Build Coastguard Workercc_library_static {
690*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_cts_test",
691*288bf522SAndroid Build Coastguard Worker    defaults: [
692*288bf522SAndroid Build Coastguard Worker        "simpleperf_test_srcs",
693*288bf522SAndroid Build Coastguard Worker        "simpleperf_shared_libs",
694*288bf522SAndroid Build Coastguard Worker    ],
695*288bf522SAndroid Build Coastguard Worker    host_supported: false,
696*288bf522SAndroid Build Coastguard Worker    cflags: [
697*288bf522SAndroid Build Coastguard Worker        "-DIN_CTS_TEST",
698*288bf522SAndroid Build Coastguard Worker    ],
699*288bf522SAndroid Build Coastguard Worker    static_libs: [
700*288bf522SAndroid Build Coastguard Worker        "libgtest",
701*288bf522SAndroid Build Coastguard Worker    ],
702*288bf522SAndroid Build Coastguard Worker    whole_static_libs: [
703*288bf522SAndroid Build Coastguard Worker        "libgmock",
704*288bf522SAndroid Build Coastguard Worker        "libsimpleperf",
705*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_regex",
706*288bf522SAndroid Build Coastguard Worker    ],
707*288bf522SAndroid Build Coastguard Worker}
708*288bf522SAndroid Build Coastguard Worker
709*288bf522SAndroid Build Coastguard Workercc_test {
710*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_record_test",
711*288bf522SAndroid Build Coastguard Worker    defaults: [
712*288bf522SAndroid Build Coastguard Worker        "simpleperf_shared_libs",
713*288bf522SAndroid Build Coastguard Worker    ],
714*288bf522SAndroid Build Coastguard Worker    srcs: [
715*288bf522SAndroid Build Coastguard Worker        "record_lib_test.cpp",
716*288bf522SAndroid Build Coastguard Worker    ],
717*288bf522SAndroid Build Coastguard Worker    shared_libs: ["libsimpleperf_record"],
718*288bf522SAndroid Build Coastguard Worker    target: {
719*288bf522SAndroid Build Coastguard Worker        android: {
720*288bf522SAndroid Build Coastguard Worker            test_suites: ["device-tests"],
721*288bf522SAndroid Build Coastguard Worker        },
722*288bf522SAndroid Build Coastguard Worker        darwin: {
723*288bf522SAndroid Build Coastguard Worker            enabled: false,
724*288bf522SAndroid Build Coastguard Worker        },
725*288bf522SAndroid Build Coastguard Worker        windows: {
726*288bf522SAndroid Build Coastguard Worker            enabled: false,
727*288bf522SAndroid Build Coastguard Worker        },
728*288bf522SAndroid Build Coastguard Worker    },
729*288bf522SAndroid Build Coastguard Worker}
730*288bf522SAndroid Build Coastguard Worker
731*288bf522SAndroid Build Coastguard Workerfilegroup {
732*288bf522SAndroid Build Coastguard Worker    name: "system-extras-simpleperf-testdata",
733*288bf522SAndroid Build Coastguard Worker    srcs: ["CtsSimpleperfTestCases_testdata/**/*"],
734*288bf522SAndroid Build Coastguard Worker}
735*288bf522SAndroid Build Coastguard Worker
736*288bf522SAndroid Build Coastguard Workercc_fuzz {
737*288bf522SAndroid Build Coastguard Worker    name: "libsimpleperf_report_fuzzer",
738*288bf522SAndroid Build Coastguard Worker    defaults: [
739*288bf522SAndroid Build Coastguard Worker        "simpleperf_static_libs",
740*288bf522SAndroid Build Coastguard Worker    ],
741*288bf522SAndroid Build Coastguard Worker    fuzzing_frameworks: {
742*288bf522SAndroid Build Coastguard Worker        afl: false,
743*288bf522SAndroid Build Coastguard Worker    },
744*288bf522SAndroid Build Coastguard Worker    host_supported: true,
745*288bf522SAndroid Build Coastguard Worker    srcs: [
746*288bf522SAndroid Build Coastguard Worker        "libsimpleperf_report_fuzzer.cpp",
747*288bf522SAndroid Build Coastguard Worker    ],
748*288bf522SAndroid Build Coastguard Worker    static_libs: [
749*288bf522SAndroid Build Coastguard Worker        "libsimpleperf",
750*288bf522SAndroid Build Coastguard Worker    ],
751*288bf522SAndroid Build Coastguard Worker    target: {
752*288bf522SAndroid Build Coastguard Worker        linux: {
753*288bf522SAndroid Build Coastguard Worker            // Fuzzer may not be able to load libdexfile. So statically link it.
754*288bf522SAndroid Build Coastguard Worker            static_libs: ["libdexfile_static"],
755*288bf522SAndroid Build Coastguard Worker        },
756*288bf522SAndroid Build Coastguard Worker        windows: {
757*288bf522SAndroid Build Coastguard Worker            enabled: false,
758*288bf522SAndroid Build Coastguard Worker        },
759*288bf522SAndroid Build Coastguard Worker    },
760*288bf522SAndroid Build Coastguard Worker    dictionary: "simpleperf_dict.dict",
761*288bf522SAndroid Build Coastguard Worker    corpus: ["testdata/**/*.data"],
762*288bf522SAndroid Build Coastguard Worker}
763*288bf522SAndroid Build Coastguard Worker
764*288bf522SAndroid Build Coastguard Workercc_fuzz {
765*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_writer_fuzzer",
766*288bf522SAndroid Build Coastguard Worker    defaults: [
767*288bf522SAndroid Build Coastguard Worker        "simpleperf_static_libs",
768*288bf522SAndroid Build Coastguard Worker    ],
769*288bf522SAndroid Build Coastguard Worker    fuzzing_frameworks: {
770*288bf522SAndroid Build Coastguard Worker        afl: false,
771*288bf522SAndroid Build Coastguard Worker    },
772*288bf522SAndroid Build Coastguard Worker    host_supported: true,
773*288bf522SAndroid Build Coastguard Worker    srcs: [
774*288bf522SAndroid Build Coastguard Worker        "simpleperf_writer_fuzzer.cpp",
775*288bf522SAndroid Build Coastguard Worker    ],
776*288bf522SAndroid Build Coastguard Worker    static_libs: [
777*288bf522SAndroid Build Coastguard Worker        "libsimpleperf",
778*288bf522SAndroid Build Coastguard Worker    ],
779*288bf522SAndroid Build Coastguard Worker    target: {
780*288bf522SAndroid Build Coastguard Worker        linux: {
781*288bf522SAndroid Build Coastguard Worker            // Fuzzer may not be able to load libdexfile. So statically link it.
782*288bf522SAndroid Build Coastguard Worker            static_libs: ["libdexfile_static"],
783*288bf522SAndroid Build Coastguard Worker        },
784*288bf522SAndroid Build Coastguard Worker        windows: {
785*288bf522SAndroid Build Coastguard Worker            enabled: false,
786*288bf522SAndroid Build Coastguard Worker        },
787*288bf522SAndroid Build Coastguard Worker    },
788*288bf522SAndroid Build Coastguard Worker}
789*288bf522SAndroid Build Coastguard Worker
790*288bf522SAndroid Build Coastguard Workergenrule {
791*288bf522SAndroid Build Coastguard Worker    name: "simpleperf_script.zip",
792*288bf522SAndroid Build Coastguard Worker    tools: [
793*288bf522SAndroid Build Coastguard Worker        "soong_zip",
794*288bf522SAndroid Build Coastguard Worker    ],
795*288bf522SAndroid Build Coastguard Worker    srcs: [
796*288bf522SAndroid Build Coastguard Worker        "**/*.proto",
797*288bf522SAndroid Build Coastguard Worker        "app_api/**/*",
798*288bf522SAndroid Build Coastguard Worker        "doc/**/*",
799*288bf522SAndroid Build Coastguard Worker        "demo/**/*",
800*288bf522SAndroid Build Coastguard Worker        "runtest/**/*",
801*288bf522SAndroid Build Coastguard Worker        "scripts/**/*",
802*288bf522SAndroid Build Coastguard Worker        "testdata/**/*",
803*288bf522SAndroid Build Coastguard Worker    ],
804*288bf522SAndroid Build Coastguard Worker    exclude_srcs: [
805*288bf522SAndroid Build Coastguard Worker        "scripts/binary_cache/**/*",
806*288bf522SAndroid Build Coastguard Worker    ],
807*288bf522SAndroid Build Coastguard Worker    cmd: "$(location soong_zip) -o $(out) -C system/extras/simpleperf " +
808*288bf522SAndroid Build Coastguard Worker        "-D system/extras/simpleperf ",
809*288bf522SAndroid Build Coastguard Worker    out: [
810*288bf522SAndroid Build Coastguard Worker        "simpleperf/simpleperf_script.zip",
811*288bf522SAndroid Build Coastguard Worker    ],
812*288bf522SAndroid Build Coastguard Worker    dist: {
813*288bf522SAndroid Build Coastguard Worker        targets: ["simpleperf"],
814*288bf522SAndroid Build Coastguard Worker        dir: "simpleperf",
815*288bf522SAndroid Build Coastguard Worker    },
816*288bf522SAndroid Build Coastguard Worker}
817