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