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") |
| 16 | |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 17 | declare_args() { |
| 18 | # Only for local development. When true the binaries (perfetto, traced, ...) |
| 19 | # are monolithic and don't use a common shared library. This is mainly to |
| 20 | # avoid LD_LIBRARY_PATH dances when testing locally. |
| 21 | monolithic_binaries = false |
| 22 | } |
| 23 | assert(!monolithic_binaries || !build_with_android) |
| 24 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 25 | group("all") { |
| 26 | testonly = true # allow to build also test targets |
| 27 | deps = [ |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 28 | ":perfetto_tests", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 29 | "src/ipc/protoc_plugin:ipc_plugin($host_toolchain)", |
| 30 | "src/protozero/protoc_plugin($host_toolchain)", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 31 | "tools/ftrace_proto_gen:ftrace_proto_gen", |
Primiano Tucci | 5fec921 | 2017-12-11 23:08:40 +0000 | [diff] [blame] | 32 | "tools/proto_to_cpp", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 33 | ] |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 34 | if (!build_with_chromium) { |
| 35 | deps += [ |
Oystein Eftevaag | 72dac26 | 2018-01-09 11:48:50 -0800 | [diff] [blame] | 36 | ":perfetto", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 37 | ":perfetto_benchmarks", |
Oystein Eftevaag | 72dac26 | 2018-01-09 11:48:50 -0800 | [diff] [blame] | 38 | ":traced", |
| 39 | ":traced_probes", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 40 | "src/ftrace_reader:ftrace_reader_integrationtests", |
| 41 | ] |
| 42 | } |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 43 | } |
| 44 | |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 45 | executable("perfetto_tests") { |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 46 | testonly = true |
| 47 | deps = [ |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 48 | "gn:default_deps", |
| 49 | "src/base:base_unittests", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 50 | "src/ftrace_reader:ftrace_reader_unittests", |
| 51 | "src/ipc:perfetto_ipc_unittests", |
| 52 | "src/protozero:protozero_unittests", |
| 53 | "src/tracing:tracing_unittests", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 54 | ] |
Primiano Tucci | 931284e | 2017-12-11 09:23:53 +0000 | [diff] [blame] | 55 | if (!build_with_chromium) { |
| 56 | deps += [ "tools/sanitizers_unittests" ] |
| 57 | } |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 58 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 59 | |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 60 | if (!build_with_chromium) { |
| 61 | executable("perfetto_benchmarks") { |
| 62 | testonly = true |
| 63 | deps = [ |
| 64 | "gn:default_deps", |
| 65 | "src/tracing:tracing_benchmarks", |
| 66 | ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 67 | } |
Primiano Tucci | 4e49c02 | 2017-12-21 18:22:44 +0100 | [diff] [blame] | 68 | |
Primiano Tucci | f3837d5 | 2018-01-10 21:12:41 +0000 | [diff] [blame] | 69 | if (monolithic_binaries) { |
| 70 | libtraced_shared_target_type = "source_set" |
| 71 | } else { |
| 72 | libtraced_shared_target_type = "shared_library" |
| 73 | } |
| 74 | |
| 75 | target(libtraced_shared_target_type, "libtraced_shared") { |
Primiano Tucci | 4e49c02 | 2017-12-21 18:22:44 +0100 | [diff] [blame] | 76 | deps = [ |
| 77 | "gn:default_deps", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 78 | "src/traced/perfetto_cmd", |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 79 | "src/traced/probes", |
| 80 | "src/traced/service", |
| 81 | ] |
Primiano Tucci | edf099c | 2018-01-08 18:27:56 +0000 | [diff] [blame] | 82 | if (build_with_android) { |
| 83 | cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ] |
Primiano Tucci | 6ea459c | 2018-01-10 10:42:27 +0000 | [diff] [blame] | 84 | deps += [ "src/base:android_task_runner" ] |
Sami Kyostila | b5b7169 | 2018-01-12 12:16:44 +0000 | [diff] [blame] | 85 | libs = [ |
| 86 | "binder", |
| 87 | "services", |
| 88 | "utils", |
| 89 | ] |
Primiano Tucci | edf099c | 2018-01-08 18:27:56 +0000 | [diff] [blame] | 90 | } |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 91 | } |
| 92 | |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 93 | # The unprivileged trace daemon that listens for Producer and Consumer |
| 94 | # connections, handles the coordination of the tracing sessions and owns the |
| 95 | # log buffers. |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 96 | executable("traced") { |
| 97 | deps = [ |
| 98 | ":libtraced_shared", |
| 99 | "gn:default_deps", |
| 100 | ] |
| 101 | sources = [ |
| 102 | "src/traced/service/main.cc", |
| 103 | ] |
| 104 | } |
| 105 | |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 106 | # The unprivileged daemon that is allowed to access tracefs (for ftrace). |
| 107 | # Registers as a Producer on the traced daemon. |
Primiano Tucci | 6067e73 | 2018-01-08 16:19:40 +0000 | [diff] [blame] | 108 | executable("traced_probes") { |
| 109 | deps = [ |
| 110 | ":libtraced_shared", |
| 111 | "gn:default_deps", |
| 112 | ] |
| 113 | sources = [ |
| 114 | "src/traced/probes/main.cc", |
Primiano Tucci | 4e49c02 | 2017-12-21 18:22:44 +0100 | [diff] [blame] | 115 | ] |
| 116 | } |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 117 | |
| 118 | # The command line client for Perfetto. Allows to configure / start / stop |
| 119 | # tracing, acting as a Consumer. |
| 120 | executable("perfetto") { |
| 121 | deps = [ |
| 122 | ":libtraced_shared", |
| 123 | "gn:default_deps", |
| 124 | ] |
| 125 | sources = [ |
| 126 | "src/traced/perfetto_cmd/main.cc", |
| 127 | ] |
| 128 | } |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 129 | } else { |
| 130 | group("lib") { |
| 131 | public_configs = [ "gn:public_config" ] |
| 132 | deps = [ |
| 133 | "src/tracing", |
| 134 | ] |
| 135 | } |
| 136 | } # !build_with_chromium |