blob: beee2f9cf04d1be3d35b7ac53f58b377494b8dff [file] [log] [blame]
Primiano Tucciae2879e2017-09-27 11:02:09 +09001# Copyright (C) 2017 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
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080015import("gn/perfetto.gni")
Eric Secklera6ba1792019-01-02 12:51:00 +000016import("gn/test.gni")
Primiano Tucci4c5efa42018-10-23 13:15:13 +010017
18if (perfetto_build_standalone || perfetto_build_with_android) {
Florian Mayerf98c9d62018-09-03 16:38:16 +010019 import("//gn/standalone/android.gni")
20} else {
21 import("//build/config/android/config.gni")
22}
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080023
Primiano Tuccia1959712018-05-17 11:01:56 +010024# For use_libfuzzer.
Primiano Tucci4c5efa42018-10-23 13:15:13 +010025if (perfetto_build_standalone || perfetto_build_with_android) {
Primiano Tuccia1959712018-05-17 11:01:56 +010026 import("//gn/standalone/sanitizers/vars.gni")
27} else {
28 import("//build/config/sanitizers/sanitizers.gni")
29}
30
Primiano Tuccif3837d52018-01-10 21:12:41 +000031declare_args() {
32 # Only for local development. When true the binaries (perfetto, traced, ...)
33 # are monolithic and don't use a common shared library. This is mainly to
34 # avoid LD_LIBRARY_PATH dances when testing locally.
35 monolithic_binaries = false
Florian Mayerb64d6b12018-08-30 10:46:30 -070036
37 # libunwindstack requires API level 26 or newer.
Florian Mayera2fae262018-08-31 12:10:01 -070038 should_build_heapprofd =
Primiano Tucci4c5efa42018-10-23 13:15:13 +010039 (perfetto_build_standalone || perfetto_build_with_android) && is_clang &&
40 (is_linux || is_android) &&
41 (!is_android || android_api_level >= 26 || perfetto_build_with_android)
Primiano Tuccif3837d52018-01-10 21:12:41 +000042}
Primiano Tucci4c5efa42018-10-23 13:15:13 +010043assert(!monolithic_binaries || !perfetto_build_with_android)
Primiano Tuccif3837d52018-01-10 21:12:41 +000044
Primiano Tucciae2879e2017-09-27 11:02:09 +090045group("all") {
46 testonly = true # allow to build also test targets
47 deps = [
Eric Secklera6ba1792019-01-02 12:51:00 +000048 ":perfetto_unittests",
Primiano Tucci764c5042019-06-22 18:28:45 +010049 "src/protozero/protoc_plugin:protozero_plugin($host_toolchain)",
Primiano Tucciae2879e2017-09-27 11:02:09 +090050 ]
Lalit Magantiedace412019-06-18 13:28:28 +010051 if (perfetto_build_standalone || perfetto_build_with_android ||
52 build_with_chromium) {
53 deps += [ ":trace_processor_shell" ]
Mikhail Khokhlov8643d1c2019-06-04 12:02:47 +010054 }
Primiano Tucci4c5efa42018-10-23 13:15:13 +010055 if (perfetto_build_standalone || perfetto_build_with_android) {
Primiano Tuccib03ba362017-12-06 09:47:41 +000056 deps += [
Primiano Tucci808d6df2018-03-31 13:24:18 +010057 ":perfetto",
Primiano Tucci808d6df2018-03-31 13:24:18 +010058 ":perfetto_integrationtests",
59 ":traced",
60 ":traced_probes",
Hector Dearman696ff772019-04-23 18:38:53 +010061 ":trigger_perfetto",
Primiano Tuccic5010802018-01-19 17:13:21 +000062 "protos/perfetto/config:merged_config", # For syntax-checking the proto.
Hector Dearmane92c6742018-11-22 21:42:39 +000063 "protos/perfetto/trace:merged_trace", # For syntax-checking the proto.
Oystein Eftevaag067fd5b2018-03-27 12:39:30 -070064 "src/ipc/protoc_plugin:ipc_plugin($host_toolchain)",
Primiano Tucci2c5488f2019-06-01 03:27:28 +010065 "src/tracing:client_api",
Primiano Tuccidd5ebc92019-07-25 01:09:37 +010066 "test:client_api_example",
Oystein Eftevaag51e06e52018-01-18 11:28:49 -080067 "tools:protoc_helper",
Primiano Tuccib03ba362017-12-06 09:47:41 +000068 ]
Primiano Tucci4c5efa42018-10-23 13:15:13 +010069 if (perfetto_build_standalone) {
Primiano Tucci5968caf2018-08-06 10:31:46 +010070 deps += [
Primiano Tucci4c5efa42018-10-23 13:15:13 +010071 ":perfetto_benchmarks",
Florian Mayerc50bcc92019-02-07 11:43:30 +000072 "src/profiling/memory:ring_buffer",
Primiano Tucci3cd31322018-10-11 20:06:56 +010073 "src/tracing:consumer_api_test",
Primiano Tucci4c5efa42018-10-23 13:15:13 +010074 "test/configs",
75 "tools/ftrace_proto_gen:ftrace_proto_gen",
76 "tools/proto_to_cpp",
Hector Dearman7fead1c2019-06-25 00:47:38 +010077 "tools/protoprofile",
Primiano Tucci5968caf2018-08-06 10:31:46 +010078 "tools/trace_to_text",
Hector Dearman499cd602018-11-20 13:02:31 +000079 "tools/trace_to_text:trace_to_text_lite_host($host_toolchain)",
Lalit Magantif9799c62019-05-28 20:01:08 +010080
81 # The diff testing framework depends on these descriptors.
82 "protos/perfetto/metrics:descriptor",
83 "protos/perfetto/trace:descriptor",
Hector Dearman7a9ffa72019-08-13 16:00:10 +010084
85 # Used in the when updating the ftrace protos
86 "protos/perfetto/trace/ftrace:descriptor",
Primiano Tucci5968caf2018-08-06 10:31:46 +010087 ]
Primiano Tucci4c5efa42018-10-23 13:15:13 +010088 if (is_linux || is_android) {
Ryan Savitskidb7f1ae2019-04-10 17:28:28 +010089 deps += [ "tools/busy_threads" ]
Ryan Savitski488e1222019-06-26 21:28:42 +010090 deps += [ "tools/cpu_utilization" ]
Lalit Maganti787418f2019-04-11 14:14:23 +010091 deps += [ "tools/dump_ftrace_stats" ]
Ryan Savitski488e1222019-06-26 21:28:42 +010092 deps += [ "tools/skippy" ]
Primiano Tucci4c5efa42018-10-23 13:15:13 +010093 }
Florian Mayer2e480712018-12-07 16:25:41 +000094 if (is_fuzzer) {
Primiano Tucci4c5efa42018-10-23 13:15:13 +010095 deps += [ ":fuzzers" ]
96 }
Primiano Tuccia1959712018-05-17 11:01:56 +010097 }
Primiano Tuccib03ba362017-12-06 09:47:41 +000098 }
Primiano Tucciae2879e2017-09-27 11:02:09 +090099}
100
Primiano Tucci3faad742018-05-16 19:30:48 +0100101# TODO(primiano): temporary workaround to:
102# 1) Prevent that the UI gets build automatically when doing ninja -C out/xx .
103# 2) Avoid breaking the chrome build, that right now depends on "all".
104group("default") {
105 testonly = true # allow to build also test targets
106 deps = [
107 ":all",
108 ]
109}
110
Mikhail Khokhlov8643d1c2019-06-04 12:02:47 +0100111# The trace processor shell executable. An interactive shell that allows to
112# make queries on the trace using the terminal.
Lalit Magantiedace412019-06-18 13:28:28 +0100113if (perfetto_build_standalone || perfetto_build_with_android ||
114 build_with_chromium) {
115 executable("trace_processor_shell") {
Primiano Tucci5968caf2018-08-06 10:31:46 +0100116 deps = [
Lalit Magantiedace412019-06-18 13:28:28 +0100117 "gn:default_deps",
Primiano Tucci5968caf2018-08-06 10:31:46 +0100118 "src/trace_processor:trace_processor_shell",
119 ]
Lalit Magantica4d5142019-05-28 13:25:47 +0100120 testonly = true # We need this for proto full.
Primiano Tucci5968caf2018-08-06 10:31:46 +0100121 }
Primiano Tucci3faad742018-05-16 19:30:48 +0100122}
123
Mikhail Khokhlov8643d1c2019-06-04 12:02:47 +0100124if (perfetto_build_standalone) {
125 group("ui") {
126 deps = [
127 "ui",
128 ]
129 }
130}
131
Eric Secklera6ba1792019-01-02 12:51:00 +0000132test("perfetto_unittests") {
Primiano Tucciae2879e2017-09-27 11:02:09 +0900133 deps = [
Primiano Tuccib03ba362017-12-06 09:47:41 +0000134 "gn:default_deps",
Florian Mayerd8bd81b2018-01-25 12:49:15 +0000135 "gn:gtest_main",
Hector Dearman6cfec8a2018-03-14 16:54:09 +0000136 "src/base:unittests",
Bruce Dawsonc3e67632018-05-14 14:07:51 +0100137 "src/protozero:unittests",
Oystein Eftevaage5e84fb2018-06-01 17:34:56 -0700138 "src/tracing:unittests",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900139 ]
Primiano Tucci1640ffa2018-05-14 18:25:33 +0100140
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100141 if (perfetto_build_standalone || perfetto_build_with_android) {
Oystein Eftevaag067fd5b2018-03-27 12:39:30 -0700142 deps += [
143 "src/ipc:unittests",
144 "src/perfetto_cmd:unittests",
Florian Mayerc50bcc92019-02-07 11:43:30 +0000145 "src/profiling/memory:ring_buffer_unittests",
Primiano Tucci808d6df2018-03-31 13:24:18 +0100146 "src/traced/probes:unittests",
Oystein Eftevaag067fd5b2018-03-27 12:39:30 -0700147 "src/traced/probes/filesystem:unittests",
Primiano Tuccide82dae2018-06-04 16:17:49 +0200148 "src/traced/probes/ftrace:unittests",
Eric Seckler21077742019-03-18 09:07:54 +0000149 "src/traced/service:unittests",
Primiano Tucci808d6df2018-03-31 13:24:18 +0100150 "tools/ftrace_proto_gen:unittests",
Oystein Eftevaag067fd5b2018-03-27 12:39:30 -0700151 "tools/sanitizers_unittests",
152 ]
Primiano Tucci931284e2017-12-11 09:23:53 +0000153 }
Florian Mayerb64d6b12018-08-30 10:46:30 -0700154 if (should_build_heapprofd) {
155 # Restrict to clang, as libunwindstack and its dependencies is never
156 # built using GCC in the Android tree.
157 deps += [ "src/profiling/memory:unittests" ]
158 }
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100159 if (perfetto_build_standalone && !is_android) {
Lalit Maganti5f3a0182019-05-07 16:40:36 +0100160 deps += [
161 "src/trace_processor:unittests",
162 "src/trace_processor/metrics:unittests",
163 ]
Lalit Maganticaed37e2018-06-01 03:03:08 +0100164 }
Primiano Tuccib03ba362017-12-06 09:47:41 +0000165}
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800166
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100167if (perfetto_build_standalone || perfetto_build_with_android) {
Eric Secklera6ba1792019-01-02 12:51:00 +0000168 test("perfetto_integrationtests") {
Lalit Maganti79f2d7b2018-01-23 18:27:33 +0000169 deps = [
170 "gn:default_deps",
Florian Mayerd8bd81b2018-01-25 12:49:15 +0000171 "gn:gtest_main",
Primiano Tuccide82dae2018-06-04 16:17:49 +0200172 "src/traced/probes/ftrace:integrationtests",
Primiano Tucci2c5488f2019-06-01 03:27:28 +0100173 "src/tracing:client_api_integrationtests",
Lalit Maganti79f2d7b2018-01-23 18:27:33 +0000174 "test:end_to_end_integrationtests",
175 ]
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100176 if (perfetto_build_standalone && !is_android) {
Hector Dearman7f71d0e2018-08-09 11:26:10 +0100177 deps += [ "src/trace_processor:integrationtests" ]
178 }
Florian Mayer42802492018-12-13 11:00:16 +0000179
180 # TODO(fmayer): Fix in process daemons.
Florian Mayer087d37f2019-05-23 12:59:08 +0100181 if (should_build_heapprofd) {
Florian Mayer42802492018-12-13 11:00:16 +0000182 deps += [ "src/profiling/memory:end_to_end_tests" ]
183 }
Lalit Maganti79f2d7b2018-01-23 18:27:33 +0000184 }
185
Primiano Tuccif3837d52018-01-10 21:12:41 +0000186 if (monolithic_binaries) {
Primiano Tuccibdb2a592018-10-11 15:59:29 +0100187 libperfetto_target_type = "source_set"
Primiano Tuccif3837d52018-01-10 21:12:41 +0000188 } else {
Primiano Tuccibdb2a592018-10-11 15:59:29 +0100189 libperfetto_target_type = "shared_library"
Primiano Tuccif3837d52018-01-10 21:12:41 +0000190 }
191
Primiano Tuccibdb2a592018-10-11 15:59:29 +0100192 target(libperfetto_target_type, "libperfetto") {
Primiano Tucci4e49c022017-12-21 18:22:44 +0100193 deps = [
194 "gn:default_deps",
Primiano Tucci6067e732018-01-08 16:19:40 +0000195 "src/traced/probes",
196 "src/traced/service",
Primiano Tucci2c5488f2019-06-01 03:27:28 +0100197 "src/tracing:consumer_api_deprecated",
Primiano Tucci6067e732018-01-08 16:19:40 +0000198 ]
199 }
200
Primiano Tucci3b729102018-01-08 18:16:36 +0000201 # The unprivileged trace daemon that listens for Producer and Consumer
202 # connections, handles the coordination of the tracing sessions and owns the
203 # log buffers.
Primiano Tucci6067e732018-01-08 16:19:40 +0000204 executable("traced") {
205 deps = [
Primiano Tuccibdb2a592018-10-11 15:59:29 +0100206 ":libperfetto",
Primiano Tucci6067e732018-01-08 16:19:40 +0000207 "gn:default_deps",
Primiano Tucci2c5488f2019-06-01 03:27:28 +0100208 "include/perfetto/ext/traced",
Primiano Tucci6067e732018-01-08 16:19:40 +0000209 ]
210 sources = [
211 "src/traced/service/main.cc",
212 ]
213 }
214
Primiano Tucci3b729102018-01-08 18:16:36 +0000215 # The unprivileged daemon that is allowed to access tracefs (for ftrace).
216 # Registers as a Producer on the traced daemon.
Primiano Tucci6067e732018-01-08 16:19:40 +0000217 executable("traced_probes") {
218 deps = [
Primiano Tuccibdb2a592018-10-11 15:59:29 +0100219 ":libperfetto",
Primiano Tucci6067e732018-01-08 16:19:40 +0000220 "gn:default_deps",
Primiano Tucci2c5488f2019-06-01 03:27:28 +0100221 "include/perfetto/ext/traced",
Primiano Tucci6067e732018-01-08 16:19:40 +0000222 ]
223 sources = [
224 "src/traced/probes/main.cc",
Primiano Tucci4e49c022017-12-21 18:22:44 +0100225 ]
226 }
Primiano Tucci3b729102018-01-08 18:16:36 +0000227
228 # The command line client for Perfetto. Allows to configure / start / stop
229 # tracing, acting as a Consumer.
230 executable("perfetto") {
231 deps = [
Primiano Tucci3b729102018-01-08 18:16:36 +0000232 "gn:default_deps",
Hector Dearmanc443a362018-02-28 16:03:56 +0000233 "src/perfetto_cmd",
Primiano Tucci3b729102018-01-08 18:16:36 +0000234 ]
235 sources = [
Hector Dearmanc443a362018-02-28 16:03:56 +0000236 "src/perfetto_cmd/main.cc",
Primiano Tucci3b729102018-01-08 18:16:36 +0000237 ]
238 }
Primiano Tucci6aa75572018-03-21 05:33:14 -0700239
Hector Dearman696ff772019-04-23 18:38:53 +0100240 # Tool to finalize long running traces.
241 # This connects to traced as a producer and sends the triggers passed on the
242 # commandline. This is a subset of what the perfetto binary can do but we
243 # need a separate binary for programs that cannot (for good reason) use the
244 # additional functionality (for example starting traces via consumer socket)
245 # due to selinux rules.
246 executable("trigger_perfetto") {
247 deps = [
248 "gn:default_deps",
249 "src/perfetto_cmd:trigger_perfetto_cmd",
250 ]
251 sources = [
252 "src/perfetto_cmd/trigger_perfetto_main.cc",
253 ]
254 }
255
Primiano Tucci658e2d62019-06-14 10:03:32 +0100256 # Client library target for the Android tree.
257 # Still in experimental stage and not API stable yet.
258 # See "libperfetto_client_example" (in Android.bp.extras) for an example
259 # on how to use the Perfetto Client API from the android tree.
260 static_library("libperfetto_client_experimental") {
261 complete_static_lib = true
262 deps = [
263 "gn:default_deps",
264 "src/tracing",
265 "src/tracing:client_api",
266 "src/tracing:platform_posix",
267 ]
268 sources = [
269 "include/perfetto/tracing.h",
270 ]
271 }
272
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100273 if (perfetto_build_with_android) {
Primiano Tucci21c19d82018-03-29 12:35:08 +0100274 executable("trace_to_text") {
275 testonly = true
276 deps = [
277 "gn:default_deps",
Primiano Tucci20dc8f72018-10-23 12:28:29 +0100278 "tools/trace_to_text:full",
Primiano Tucci21c19d82018-03-29 12:35:08 +0100279 ]
280 }
Primiano Tucci21c19d82018-03-29 12:35:08 +0100281
Primiano Tucci808d6df2018-03-31 13:24:18 +0100282 # This target exports perfetto trace protos in the Android build system,
283 # allowing both host and device targets to implement custom parsers based on
284 # our protos.
285 static_library("perfetto_trace_protos") {
286 deps = [
287 "protos/perfetto/trace:lite",
288 ]
289 }
Primiano Tucci676f0cc2018-12-03 20:03:26 +0100290
291 shared_library("libperfetto_android_internal") {
292 deps = [
293 "gn:default_deps",
294 "src/android_internal",
295 ]
296 }
297 } # if (perfetto_build_with_android)
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100298} # if (perfetto_build_standalone || perfetto_build_with_android)
Oystein Eftevaaga812a942018-03-23 11:52:32 -0700299
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100300if (perfetto_build_with_embedder) {
301 if (build_with_chromium) {
Eric Seckler8f5299c2019-08-09 14:47:30 +0100302 lib_target_type = "component"
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100303 } else {
Eric Seckler8f5299c2019-08-09 14:47:30 +0100304 lib_target_type = "source_set"
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100305 }
Eric Seckler8f5299c2019-08-09 14:47:30 +0100306 target(lib_target_type, "libperfetto") {
Primiano Tucci20b760c2018-01-19 12:36:12 +0000307 public_configs = [ "gn:public_config" ]
Oystein Eftevaag5e8a4eb2018-01-09 11:41:58 -0800308 deps = [
309 "src/tracing",
310 ]
Oystein Eftevaaga812a942018-03-23 11:52:32 -0700311 configs -= [ "//build/config/compiler:chromium_code" ]
312 configs += [ "//build/config/compiler:no_chromium_code" ]
313 public_deps = [
Primiano Tucci2c5488f2019-06-01 03:27:28 +0100314 "include/perfetto/ext/tracing/core",
Oystein Eftevaag6fcedac2018-07-02 12:02:55 -0700315 "protos/perfetto/trace:zero",
316 "protos/perfetto/trace/chrome:zero",
Eric Secklerd3139b42019-02-26 13:43:59 +0000317 "protos/perfetto/trace/interned_data:zero",
Oystein Eftevaagae116202019-07-11 09:48:42 -0700318 "protos/perfetto/trace/profiling:zero",
Eric Secklerd3139b42019-02-26 13:43:59 +0000319 "protos/perfetto/trace/track_event:zero",
Oystein Eftevaaga812a942018-03-23 11:52:32 -0700320 ]
Oystein Eftevaag5e8a4eb2018-01-09 11:41:58 -0800321 }
Eric Seckler8f5299c2019-08-09 14:47:30 +0100322 target(lib_target_type, "libtrace_processor") {
323 public_configs = [ "gn:public_config" ]
324 deps = [
325 "src/trace_processor:lib",
326 ]
327 configs -= [ "//build/config/compiler:chromium_code" ]
328 configs += [ "//build/config/compiler:no_chromium_code" ]
329 public_deps = [
330 "include/perfetto/trace_processor",
331 ]
332 }
Oystein Eftevaaga812a942018-03-23 11:52:32 -0700333}
Primiano Tuccia1959712018-05-17 11:01:56 +0100334
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100335if (perfetto_build_standalone) {
336 executable("perfetto_benchmarks") {
337 testonly = true
338 deps = [
339 "gn:default_deps",
340 "src/traced/probes/ftrace:benchmarks",
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100341 "test:benchmark_main",
342 "test:end_to_end_benchmarks",
343 ]
344 }
345
Primiano Tucci59d6ace2018-09-26 22:24:20 +0100346 group("fuzzers") {
347 testonly = true
348 deps = [
349 "src/ipc:buffered_frame_deserializer_fuzzer",
Florian Mayer4a1ee942019-02-07 15:51:16 +0000350 "src/profiling/memory:shared_ring_buffer_fuzzer",
Florian Mayer00389182019-04-08 16:43:21 +0100351 "src/profiling/memory:shared_ring_buffer_write_fuzzer",
Florian Mayerc365e362018-10-24 13:21:17 +0100352 "src/profiling/memory:unwinding_fuzzer",
Primiano Tuccic1678872019-03-20 11:30:54 +0000353 "src/protozero:protozero_decoder_fuzzer",
Hector Dearman59bc02d2019-02-21 17:28:11 +0000354 "src/trace_processor:trace_processor_fuzzer",
Primiano Tucci59d6ace2018-09-26 22:24:20 +0100355 "src/traced/probes/ftrace:cpu_reader_fuzzer",
356 "test:end_to_end_shared_memory_fuzzer",
Stephen Nusko95545132019-07-09 15:00:54 +0100357 "test:producer_socket_fuzzer",
Primiano Tucci59d6ace2018-09-26 22:24:20 +0100358 ]
359 }
Primiano Tuccia1959712018-05-17 11:01:56 +0100360}
Florian Mayerb6a921f2018-10-18 18:55:23 +0100361
Ryan Savitskie65beca2019-01-29 18:29:13 +0000362# WARNING: this builds correctly only when using the generated Android.bp.
363#
364# This library gets loaded into (and executes in) arbitrary android processes.
365# Logging must be non-allocating. This is achieved by defining
366# PERFETTO_ANDROID_ASYNC_SAFE_LOG, which needs to be set for all perfetto code
367# being compiled for this library. When generating Android.bp, the |cflags|
368# entry on this target is sufficient (as all sources are flattened into a
369# single bp target). However this is not correctly reflected in the gn
370# structure (which is a tree of targets) as the dependencies would not pick
371# up the flag (and thus use the wrong logging macro).
372#
373# This is deemed acceptable as, at the time of writing, there is no interest in
374# building this library standalone.
Primiano Tucci4c5efa42018-10-23 13:15:13 +0100375if (perfetto_build_with_android) {
Florian Mayerb6a921f2018-10-18 18:55:23 +0100376 # TODO(fmayer): Investigate shared library for common pieces.
377 shared_library("heapprofd_client") {
Ryan Savitskia3da9be2019-01-30 17:45:53 +0000378 configs -= [ "//gn/standalone:android_liblog" ]
Ryan Savitskie65beca2019-01-29 18:29:13 +0000379 cflags = [ "-DPERFETTO_ANDROID_ASYNC_SAFE_LOG" ]
Florian Mayerb6a921f2018-10-18 18:55:23 +0100380 deps = [
381 "src/profiling/memory:malloc_hooks",
382 ]
383 }
Florian Mayer8e7eac42018-11-05 16:04:11 +0000384}
Florian Mayerb6a921f2018-10-18 18:55:23 +0100385
Florian Mayer8e7eac42018-11-05 16:04:11 +0000386if (should_build_heapprofd) {
Florian Mayerb6a921f2018-10-18 18:55:23 +0100387 executable("heapprofd") {
388 deps = [
389 "gn:default_deps",
Florian Mayer4afdd642018-11-13 11:11:04 +0000390 "protos/perfetto/trace:zero",
Florian Mayerb6a921f2018-10-18 18:55:23 +0100391 "src/base",
392 "src/base:unix_socket",
393 "src/profiling/memory:daemon",
394 "src/profiling/memory:wire_protocol",
Florian Mayer8e7eac42018-11-05 16:04:11 +0000395 "src/tracing:ipc",
Florian Mayerb6a921f2018-10-18 18:55:23 +0100396 ]
397 sources = [
398 "src/profiling/memory/main.cc",
399 ]
400 }
401}
Florian Mayer67be9652019-05-31 16:17:11 +0100402
Eric Seckler4d7ccd92019-06-04 15:50:16 +0100403if (perfetto_build_standalone) {
404 executable("idle_alloc") {
405 sources = [
406 "tools/idle_alloc.cc",
407 ]
408 }
Florian Mayer67be9652019-05-31 16:17:11 +0100409}