Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 1 | # 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 Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 15 | import("gn/perfetto.gni") |
Eric Seckler | a6ba179 | 2019-01-02 12:51:00 +0000 | [diff] [blame] | 16 | import("gn/test.gni") |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 17 | |
| 18 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Florian Mayer | f98c9d6 | 2018-09-03 16:38:16 +0100 | [diff] [blame] | 19 | import("//gn/standalone/android.gni") |
| 20 | } else { |
| 21 | import("//build/config/android/config.gni") |
| 22 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 23 | |
Primiano Tucci | a195971 | 2018-05-17 11:01:56 +0100 | [diff] [blame] | 24 | # For use_libfuzzer. |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 25 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Primiano Tucci | a195971 | 2018-05-17 11:01:56 +0100 | [diff] [blame] | 26 | import("//gn/standalone/sanitizers/vars.gni") |
| 27 | } else { |
| 28 | import("//build/config/sanitizers/sanitizers.gni") |
| 29 | } |
| 30 | |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 31 | declare_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 Mayer | b64d6b1 | 2018-08-30 10:46:30 -0700 | [diff] [blame] | 36 | |
| 37 | # libunwindstack requires API level 26 or newer. |
Florian Mayer | a2fae26 | 2018-08-31 12:10:01 -0700 | [diff] [blame] | 38 | should_build_heapprofd = |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 39 | (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 Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 42 | } |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 43 | assert(!monolithic_binaries || !perfetto_build_with_android) |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 44 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 45 | group("all") { |
| 46 | testonly = true # allow to build also test targets |
| 47 | deps = [ |
Eric Seckler | a6ba179 | 2019-01-02 12:51:00 +0000 | [diff] [blame] | 48 | ":perfetto_unittests", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 49 | "src/protozero/protoc_plugin($host_toolchain)", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 50 | ] |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 51 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 52 | deps += [ |
Primiano Tucci | 808d6df | 2018-03-31 13:24:18 +0100 | [diff] [blame] | 53 | ":perfetto", |
Primiano Tucci | 808d6df | 2018-03-31 13:24:18 +0100 | [diff] [blame] | 54 | ":perfetto_integrationtests", |
| 55 | ":traced", |
| 56 | ":traced_probes", |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 57 | ":trigger_perfetto", |
Primiano Tucci | c501080 | 2018-01-19 17:13:21 +0000 | [diff] [blame] | 58 | "protos/perfetto/config:merged_config", # For syntax-checking the proto. |
Hector Dearman | e92c674 | 2018-11-22 21:42:39 +0000 | [diff] [blame] | 59 | "protos/perfetto/trace:merged_trace", # For syntax-checking the proto. |
Oystein Eftevaag | 067fd5b | 2018-03-27 12:39:30 -0700 | [diff] [blame] | 60 | "src/ipc/protoc_plugin:ipc_plugin($host_toolchain)", |
Primiano Tucci | 9564d91 | 2019-05-21 23:53:18 +0100 | [diff] [blame^] | 61 | "src/public", |
Oystein Eftevaag | 51e06e5 | 2018-01-18 11:28:49 -0800 | [diff] [blame] | 62 | "tools:protoc_helper", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 63 | ] |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 64 | if (perfetto_build_standalone) { |
Primiano Tucci | 5968caf | 2018-08-06 10:31:46 +0100 | [diff] [blame] | 65 | deps += [ |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 66 | ":perfetto_benchmarks", |
Primiano Tucci | 5968caf | 2018-08-06 10:31:46 +0100 | [diff] [blame] | 67 | ":trace_processor", |
Florian Mayer | c50bcc9 | 2019-02-07 11:43:30 +0000 | [diff] [blame] | 68 | "src/profiling/memory:ring_buffer", |
Primiano Tucci | 3cd3132 | 2018-10-11 20:06:56 +0100 | [diff] [blame] | 69 | "src/tracing:consumer_api_test", |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 70 | "test/configs", |
| 71 | "tools/ftrace_proto_gen:ftrace_proto_gen", |
| 72 | "tools/proto_to_cpp", |
Primiano Tucci | 5968caf | 2018-08-06 10:31:46 +0100 | [diff] [blame] | 73 | "tools/trace_to_text", |
Hector Dearman | 499cd60 | 2018-11-20 13:02:31 +0000 | [diff] [blame] | 74 | "tools/trace_to_text:trace_to_text_lite_host($host_toolchain)", |
Primiano Tucci | 5968caf | 2018-08-06 10:31:46 +0100 | [diff] [blame] | 75 | ] |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 76 | if (is_linux || is_android) { |
| 77 | deps += [ "tools/skippy" ] |
Ryan Savitski | db7f1ae | 2019-04-10 17:28:28 +0100 | [diff] [blame] | 78 | deps += [ "tools/busy_threads" ] |
Lalit Maganti | 787418f | 2019-04-11 14:14:23 +0100 | [diff] [blame] | 79 | deps += [ "tools/dump_ftrace_stats" ] |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 80 | } |
Florian Mayer | 2e48071 | 2018-12-07 16:25:41 +0000 | [diff] [blame] | 81 | if (is_fuzzer) { |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 82 | deps += [ ":fuzzers" ] |
| 83 | } |
Primiano Tucci | a195971 | 2018-05-17 11:01:56 +0100 | [diff] [blame] | 84 | } |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 85 | } |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 86 | } |
| 87 | |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 88 | # TODO(primiano): temporary workaround to: |
| 89 | # 1) Prevent that the UI gets build automatically when doing ninja -C out/xx . |
| 90 | # 2) Avoid breaking the chrome build, that right now depends on "all". |
| 91 | group("default") { |
| 92 | testonly = true # allow to build also test targets |
| 93 | deps = [ |
| 94 | ":all", |
| 95 | ] |
| 96 | } |
| 97 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 98 | if (perfetto_build_standalone) { |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 99 | group("ui") { |
| 100 | deps = [ |
| 101 | "ui", |
| 102 | ] |
| 103 | } |
Primiano Tucci | 5968caf | 2018-08-06 10:31:46 +0100 | [diff] [blame] | 104 | |
| 105 | # The trace processor shell executable. An interactive shell that allows to |
| 106 | # make queries on the trace using the terminal. |
| 107 | group("trace_processor") { |
| 108 | deps = [ |
| 109 | "src/trace_processor:trace_processor_shell", |
| 110 | ] |
| 111 | } |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 112 | } |
| 113 | |
Eric Seckler | a6ba179 | 2019-01-02 12:51:00 +0000 | [diff] [blame] | 114 | test("perfetto_unittests") { |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 115 | deps = [ |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 116 | "gn:default_deps", |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 117 | "gn:gtest_main", |
Hector Dearman | 6cfec8a | 2018-03-14 16:54:09 +0000 | [diff] [blame] | 118 | "src/base:unittests", |
Bruce Dawson | c3e6763 | 2018-05-14 14:07:51 +0100 | [diff] [blame] | 119 | "src/protozero:unittests", |
Oystein Eftevaag | e5e84fb | 2018-06-01 17:34:56 -0700 | [diff] [blame] | 120 | "src/tracing:unittests", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 121 | ] |
Primiano Tucci | 1640ffa | 2018-05-14 18:25:33 +0100 | [diff] [blame] | 122 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 123 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Oystein Eftevaag | 067fd5b | 2018-03-27 12:39:30 -0700 | [diff] [blame] | 124 | deps += [ |
| 125 | "src/ipc:unittests", |
| 126 | "src/perfetto_cmd:unittests", |
Florian Mayer | c50bcc9 | 2019-02-07 11:43:30 +0000 | [diff] [blame] | 127 | "src/profiling/memory:ring_buffer_unittests", |
Primiano Tucci | 808d6df | 2018-03-31 13:24:18 +0100 | [diff] [blame] | 128 | "src/traced/probes:unittests", |
Oystein Eftevaag | 067fd5b | 2018-03-27 12:39:30 -0700 | [diff] [blame] | 129 | "src/traced/probes/filesystem:unittests", |
Primiano Tucci | de82dae | 2018-06-04 16:17:49 +0200 | [diff] [blame] | 130 | "src/traced/probes/ftrace:unittests", |
Eric Seckler | 2107774 | 2019-03-18 09:07:54 +0000 | [diff] [blame] | 131 | "src/traced/service:unittests", |
Primiano Tucci | 808d6df | 2018-03-31 13:24:18 +0100 | [diff] [blame] | 132 | "tools/ftrace_proto_gen:unittests", |
Oystein Eftevaag | 067fd5b | 2018-03-27 12:39:30 -0700 | [diff] [blame] | 133 | "tools/sanitizers_unittests", |
| 134 | ] |
Primiano Tucci | 931284e | 2017-12-11 09:23:53 +0000 | [diff] [blame] | 135 | } |
Florian Mayer | b64d6b1 | 2018-08-30 10:46:30 -0700 | [diff] [blame] | 136 | if (should_build_heapprofd) { |
| 137 | # Restrict to clang, as libunwindstack and its dependencies is never |
| 138 | # built using GCC in the Android tree. |
| 139 | deps += [ "src/profiling/memory:unittests" ] |
| 140 | } |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 141 | if (perfetto_build_standalone && !is_android) { |
Lalit Maganti | 5f3a018 | 2019-05-07 16:40:36 +0100 | [diff] [blame] | 142 | deps += [ |
| 143 | "src/trace_processor:unittests", |
| 144 | "src/trace_processor/metrics:unittests", |
| 145 | ] |
Lalit Maganti | caed37e | 2018-06-01 03:03:08 +0100 | [diff] [blame] | 146 | } |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 147 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 148 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 149 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Eric Seckler | a6ba179 | 2019-01-02 12:51:00 +0000 | [diff] [blame] | 150 | test("perfetto_integrationtests") { |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 151 | deps = [ |
| 152 | "gn:default_deps", |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 153 | "gn:gtest_main", |
Primiano Tucci | de82dae | 2018-06-04 16:17:49 +0200 | [diff] [blame] | 154 | "src/traced/probes/ftrace:integrationtests", |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 155 | "test:end_to_end_integrationtests", |
| 156 | ] |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 157 | if (perfetto_build_standalone && !is_android) { |
Hector Dearman | 7f71d0e | 2018-08-09 11:26:10 +0100 | [diff] [blame] | 158 | deps += [ "src/trace_processor:integrationtests" ] |
| 159 | } |
Florian Mayer | 4280249 | 2018-12-13 11:00:16 +0000 | [diff] [blame] | 160 | |
| 161 | # TODO(fmayer): Fix in process daemons. |
| 162 | if (should_build_heapprofd && is_android && !start_daemons_for_testing) { |
| 163 | deps += [ "src/profiling/memory:end_to_end_tests" ] |
| 164 | } |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 165 | } |
| 166 | |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 167 | if (monolithic_binaries) { |
Primiano Tucci | bdb2a59 | 2018-10-11 15:59:29 +0100 | [diff] [blame] | 168 | libperfetto_target_type = "source_set" |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 169 | } else { |
Primiano Tucci | bdb2a59 | 2018-10-11 15:59:29 +0100 | [diff] [blame] | 170 | libperfetto_target_type = "shared_library" |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 171 | } |
| 172 | |
Primiano Tucci | bdb2a59 | 2018-10-11 15:59:29 +0100 | [diff] [blame] | 173 | target(libperfetto_target_type, "libperfetto") { |
Primiano Tucci | 4e49c02 | 2017-12-21 18:22:44 +0100 | [diff] [blame] | 174 | deps = [ |
| 175 | "gn:default_deps", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 176 | "src/traced/probes", |
| 177 | "src/traced/service", |
Primiano Tucci | 3cd3132 | 2018-10-11 20:06:56 +0100 | [diff] [blame] | 178 | "src/tracing:api", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 179 | ] |
| 180 | } |
| 181 | |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 182 | # The unprivileged trace daemon that listens for Producer and Consumer |
| 183 | # connections, handles the coordination of the tracing sessions and owns the |
| 184 | # log buffers. |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 185 | executable("traced") { |
| 186 | deps = [ |
Primiano Tucci | bdb2a59 | 2018-10-11 15:59:29 +0100 | [diff] [blame] | 187 | ":libperfetto", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 188 | "gn:default_deps", |
Primiano Tucci | c2eb510 | 2018-05-15 10:40:01 +0100 | [diff] [blame] | 189 | "include/perfetto/traced", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 190 | ] |
| 191 | sources = [ |
| 192 | "src/traced/service/main.cc", |
| 193 | ] |
| 194 | } |
| 195 | |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 196 | # The unprivileged daemon that is allowed to access tracefs (for ftrace). |
| 197 | # Registers as a Producer on the traced daemon. |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 198 | executable("traced_probes") { |
| 199 | deps = [ |
Primiano Tucci | bdb2a59 | 2018-10-11 15:59:29 +0100 | [diff] [blame] | 200 | ":libperfetto", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 201 | "gn:default_deps", |
Primiano Tucci | c2eb510 | 2018-05-15 10:40:01 +0100 | [diff] [blame] | 202 | "include/perfetto/traced", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 203 | ] |
| 204 | sources = [ |
| 205 | "src/traced/probes/main.cc", |
Primiano Tucci | 4e49c02 | 2017-12-21 18:22:44 +0100 | [diff] [blame] | 206 | ] |
| 207 | } |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 208 | |
| 209 | # The command line client for Perfetto. Allows to configure / start / stop |
| 210 | # tracing, acting as a Consumer. |
| 211 | executable("perfetto") { |
| 212 | deps = [ |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 213 | "gn:default_deps", |
Hector Dearman | c443a36 | 2018-02-28 16:03:56 +0000 | [diff] [blame] | 214 | "src/perfetto_cmd", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 215 | ] |
| 216 | sources = [ |
Hector Dearman | c443a36 | 2018-02-28 16:03:56 +0000 | [diff] [blame] | 217 | "src/perfetto_cmd/main.cc", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 218 | ] |
| 219 | } |
Primiano Tucci | 6aa7557 | 2018-03-21 05:33:14 -0700 | [diff] [blame] | 220 | |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 221 | # Tool to finalize long running traces. |
| 222 | # This connects to traced as a producer and sends the triggers passed on the |
| 223 | # commandline. This is a subset of what the perfetto binary can do but we |
| 224 | # need a separate binary for programs that cannot (for good reason) use the |
| 225 | # additional functionality (for example starting traces via consumer socket) |
| 226 | # due to selinux rules. |
| 227 | executable("trigger_perfetto") { |
| 228 | deps = [ |
| 229 | "gn:default_deps", |
| 230 | "src/perfetto_cmd:trigger_perfetto_cmd", |
| 231 | ] |
| 232 | sources = [ |
| 233 | "src/perfetto_cmd/trigger_perfetto_main.cc", |
| 234 | ] |
| 235 | } |
| 236 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 237 | if (perfetto_build_with_android) { |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 238 | executable("trace_to_text") { |
| 239 | testonly = true |
| 240 | deps = [ |
| 241 | "gn:default_deps", |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 242 | "tools/trace_to_text:full", |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 243 | ] |
| 244 | } |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 245 | |
Primiano Tucci | 808d6df | 2018-03-31 13:24:18 +0100 | [diff] [blame] | 246 | # This target exports perfetto trace protos in the Android build system, |
| 247 | # allowing both host and device targets to implement custom parsers based on |
| 248 | # our protos. |
| 249 | static_library("perfetto_trace_protos") { |
| 250 | deps = [ |
| 251 | "protos/perfetto/trace:lite", |
| 252 | ] |
| 253 | } |
Primiano Tucci | 676f0cc | 2018-12-03 20:03:26 +0100 | [diff] [blame] | 254 | |
| 255 | shared_library("libperfetto_android_internal") { |
| 256 | deps = [ |
| 257 | "gn:default_deps", |
| 258 | "src/android_internal", |
| 259 | ] |
| 260 | } |
| 261 | } # if (perfetto_build_with_android) |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 262 | } # if (perfetto_build_standalone || perfetto_build_with_android) |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 263 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 264 | if (perfetto_build_with_embedder) { |
| 265 | if (build_with_chromium) { |
| 266 | libperfetto_target_type = "component" |
| 267 | } else { |
| 268 | libperfetto_target_type = "source_set" |
| 269 | } |
| 270 | target(libperfetto_target_type, "libperfetto") { |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 271 | public_configs = [ "gn:public_config" ] |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 272 | deps = [ |
| 273 | "src/tracing", |
| 274 | ] |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 275 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 276 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 277 | public_deps = [ |
| 278 | "include/perfetto/tracing/core", |
Oystein Eftevaag | 6fcedac | 2018-07-02 12:02:55 -0700 | [diff] [blame] | 279 | "protos/perfetto/trace:zero", |
| 280 | "protos/perfetto/trace/chrome:zero", |
Eric Seckler | d3139b4 | 2019-02-26 13:43:59 +0000 | [diff] [blame] | 281 | "protos/perfetto/trace/interned_data:zero", |
| 282 | "protos/perfetto/trace/track_event:zero", |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 283 | ] |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 284 | } |
Oystein Eftevaag | a812a94 | 2018-03-23 11:52:32 -0700 | [diff] [blame] | 285 | } |
Primiano Tucci | a195971 | 2018-05-17 11:01:56 +0100 | [diff] [blame] | 286 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 287 | if (perfetto_build_standalone) { |
| 288 | executable("perfetto_benchmarks") { |
| 289 | testonly = true |
| 290 | deps = [ |
| 291 | "gn:default_deps", |
| 292 | "src/traced/probes/ftrace:benchmarks", |
| 293 | "src/tracing:tracing_benchmarks", |
| 294 | "test:benchmark_main", |
| 295 | "test:end_to_end_benchmarks", |
| 296 | ] |
| 297 | } |
| 298 | |
Primiano Tucci | 59d6ace | 2018-09-26 22:24:20 +0100 | [diff] [blame] | 299 | group("fuzzers") { |
| 300 | testonly = true |
| 301 | deps = [ |
| 302 | "src/ipc:buffered_frame_deserializer_fuzzer", |
Florian Mayer | 4a1ee94 | 2019-02-07 15:51:16 +0000 | [diff] [blame] | 303 | "src/profiling/memory:shared_ring_buffer_fuzzer", |
Florian Mayer | 0038918 | 2019-04-08 16:43:21 +0100 | [diff] [blame] | 304 | "src/profiling/memory:shared_ring_buffer_write_fuzzer", |
Florian Mayer | c365e36 | 2018-10-24 13:21:17 +0100 | [diff] [blame] | 305 | "src/profiling/memory:unwinding_fuzzer", |
Primiano Tucci | c167887 | 2019-03-20 11:30:54 +0000 | [diff] [blame] | 306 | "src/protozero:protozero_decoder_fuzzer", |
Hector Dearman | 59bc02d | 2019-02-21 17:28:11 +0000 | [diff] [blame] | 307 | "src/trace_processor:trace_processor_fuzzer", |
Primiano Tucci | 59d6ace | 2018-09-26 22:24:20 +0100 | [diff] [blame] | 308 | "src/traced/probes/ftrace:cpu_reader_fuzzer", |
| 309 | "test:end_to_end_shared_memory_fuzzer", |
| 310 | ] |
| 311 | } |
Primiano Tucci | a195971 | 2018-05-17 11:01:56 +0100 | [diff] [blame] | 312 | } |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 313 | |
Ryan Savitski | e65beca | 2019-01-29 18:29:13 +0000 | [diff] [blame] | 314 | # WARNING: this builds correctly only when using the generated Android.bp. |
| 315 | # |
| 316 | # This library gets loaded into (and executes in) arbitrary android processes. |
| 317 | # Logging must be non-allocating. This is achieved by defining |
| 318 | # PERFETTO_ANDROID_ASYNC_SAFE_LOG, which needs to be set for all perfetto code |
| 319 | # being compiled for this library. When generating Android.bp, the |cflags| |
| 320 | # entry on this target is sufficient (as all sources are flattened into a |
| 321 | # single bp target). However this is not correctly reflected in the gn |
| 322 | # structure (which is a tree of targets) as the dependencies would not pick |
| 323 | # up the flag (and thus use the wrong logging macro). |
| 324 | # |
| 325 | # This is deemed acceptable as, at the time of writing, there is no interest in |
| 326 | # building this library standalone. |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 327 | if (perfetto_build_with_android) { |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 328 | # TODO(fmayer): Investigate shared library for common pieces. |
| 329 | shared_library("heapprofd_client") { |
Ryan Savitski | a3da9be | 2019-01-30 17:45:53 +0000 | [diff] [blame] | 330 | configs -= [ "//gn/standalone:android_liblog" ] |
Ryan Savitski | e65beca | 2019-01-29 18:29:13 +0000 | [diff] [blame] | 331 | cflags = [ "-DPERFETTO_ANDROID_ASYNC_SAFE_LOG" ] |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 332 | deps = [ |
| 333 | "src/profiling/memory:malloc_hooks", |
| 334 | ] |
| 335 | } |
Florian Mayer | 8e7eac4 | 2018-11-05 16:04:11 +0000 | [diff] [blame] | 336 | } |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 337 | |
Florian Mayer | 8e7eac4 | 2018-11-05 16:04:11 +0000 | [diff] [blame] | 338 | if (should_build_heapprofd) { |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 339 | executable("heapprofd") { |
| 340 | deps = [ |
| 341 | "gn:default_deps", |
Florian Mayer | 4afdd64 | 2018-11-13 11:11:04 +0000 | [diff] [blame] | 342 | "protos/perfetto/trace:zero", |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 343 | "src/base", |
| 344 | "src/base:unix_socket", |
| 345 | "src/profiling/memory:daemon", |
| 346 | "src/profiling/memory:wire_protocol", |
Florian Mayer | 8e7eac4 | 2018-11-05 16:04:11 +0000 | [diff] [blame] | 347 | "src/tracing:ipc", |
Florian Mayer | b6a921f | 2018-10-18 18:55:23 +0100 | [diff] [blame] | 348 | ] |
| 349 | sources = [ |
| 350 | "src/profiling/memory/main.cc", |
| 351 | ] |
| 352 | } |
| 353 | } |