1// Copyright (C) 2019 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// 15 16// Build variants {target} x {debug,ndebug} x {32,64} 17 18// This depends on the Perfetto client API. This uses the ProducerPort to 19// communicate to the system trace. This is an API whose ABI is maintained 20// to be backwards compatible, see 21// https://android.googlesource.com/platform/external/perfetto/+/refs/heads/master/protos/perfetto/ipc/producer_port.proto. 22 23gensrcs { 24 name: "art_perfetto_hprof_operator_srcs", 25 cmd: "$(location generate_operator_out) art/perfetto_hprof $(in) > $(out)", 26 tools: ["generate_operator_out"], 27 srcs: [ 28 "perfetto_hprof.h", 29 ], 30 output_extension: "operator_out.cc", 31} 32 33cc_defaults { 34 name: "perfetto_hprof-defaults", 35 host_supported: false, 36 srcs: ["perfetto_hprof.cc"], 37 defaults: ["art_defaults"], 38 include_dirs: [ 39 "external/perfetto/include", 40 "external/perfetto/protos", 41 ], 42 43 // Note that this tool needs to be built for both 32-bit and 64-bit since it requires 44 // to be same ISA as what it is attached to. 45 compile_multilib: "both", 46 47 shared_libs: [ 48 "libbase", 49 "liblog", 50 "libdexfile", 51 ], 52 static_libs: [ 53 "libperfetto_client_experimental", 54 "perfetto_trace_protos", 55 ], 56 generated_sources: [ 57 "perfetto_protos_perfetto_config_profiling_zero_gen", 58 "art_perfetto_hprof_operator_srcs", 59 ], 60 generated_headers: [ 61 "perfetto_protos_perfetto_config_profiling_zero_gen_headers", 62 ], 63 target: { 64 darwin: { 65 enabled: false, 66 }, 67 }, 68 header_libs: [ 69 "libnativehelper_header_only", 70 ], 71} 72 73art_cc_library { 74 name: "libperfetto_hprof", 75 defaults: ["perfetto_hprof-defaults"], 76 shared_libs: [ 77 "libart", 78 "libartbase", 79 ], 80 apex_available: [ 81 "com.android.art.release", 82 "com.android.art.debug", 83 ], 84} 85 86art_cc_library { 87 name: "libperfetto_hprofd", 88 defaults: [ 89 "art_debug_defaults", 90 "perfetto_hprof-defaults", 91 ], 92 shared_libs: [ 93 "libartd", 94 "libartbased", 95 ], 96 apex_available: [ 97 "com.android.art.debug", 98 ], 99} 100