Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 1 | # Copyright (C) 2018 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 | |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 15 | import("../../gn/perfetto.gni") |
| 16 | import("../../gn/proto_library.gni") |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 17 | import("../../gn/test.gni") |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 18 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 19 | # The command line client for Perfetto. Allows to configure / start / stop |
| 20 | # tracing, acting as a Consumer. |
| 21 | executable("perfetto") { |
| 22 | deps = [ |
| 23 | ":perfetto_cmd", |
| 24 | "../../gn:default_deps", |
| 25 | ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 26 | sources = [ "main.cc" ] |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | # Tool to finalize long running traces. |
| 30 | # This connects to traced as a producer and sends the triggers passed on the |
| 31 | # commandline. This is a subset of what the perfetto binary can do but we |
| 32 | # need a separate binary for programs that cannot (for good reason) use the |
| 33 | # additional functionality (for example starting traces via consumer socket) |
| 34 | # due to selinux rules. |
| 35 | executable("trigger_perfetto") { |
| 36 | deps = [ |
| 37 | ":trigger_perfetto_cmd", |
| 38 | "../../gn:default_deps", |
| 39 | ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 40 | sources = [ "trigger_perfetto_main.cc" ] |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 41 | } |
| 42 | |
Hector Dearman | 92d7d11 | 2019-12-05 15:19:57 +0000 | [diff] [blame] | 43 | source_set("perfetto_atoms") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 44 | sources = [ "perfetto_atoms.h" ] |
Hector Dearman | 92d7d11 | 2019-12-05 15:19:57 +0000 | [diff] [blame] | 45 | } |
| 46 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 47 | # Contains all the implementation but not the main() entry point. This target |
| 48 | # is shared both by the executable and tests. |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 49 | source_set("perfetto_cmd") { |
| 50 | public_deps = [ |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 51 | ":protos", |
Primiano Tucci | 2c5488f | 2019-06-01 03:27:28 +0100 | [diff] [blame] | 52 | "../../include/perfetto/ext/traced", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 53 | ] |
| 54 | deps = [ |
Hector Dearman | 92d7d11 | 2019-12-05 15:19:57 +0000 | [diff] [blame] | 55 | ":perfetto_atoms", |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 56 | ":trigger_producer", |
Hector Dearman | c443a36 | 2018-02-28 16:03:56 +0000 | [diff] [blame] | 57 | "../../gn:default_deps", |
Primiano Tucci | 54985c2 | 2019-12-03 12:14:08 +0000 | [diff] [blame] | 58 | "../../protos/perfetto/common:cpp", |
| 59 | "../../protos/perfetto/config:cpp", |
| 60 | "../../protos/perfetto/config/ftrace:cpp", |
Primiano Tucci | a6ebe13 | 2019-07-24 22:59:23 +0100 | [diff] [blame] | 61 | "../android_internal:lazy_library_loader", |
Hector Dearman | c443a36 | 2018-02-28 16:03:56 +0000 | [diff] [blame] | 62 | "../base", |
| 63 | "../protozero", |
Primiano Tucci | c4c063b | 2020-01-27 09:34:46 +0000 | [diff] [blame] | 64 | "../tracing/ipc/consumer", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 65 | ] |
Primiano Tucci | 1b5fdae | 2020-01-16 09:28:05 +0000 | [diff] [blame] | 66 | if (enable_perfetto_zlib) { |
| 67 | deps += [ "../../gn:zlib" ] |
| 68 | } |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 69 | sources = [ |
Hector Dearman | 5edeafc | 2018-11-29 13:27:33 +0000 | [diff] [blame] | 70 | "config.cc", |
| 71 | "config.h", |
Hector Dearman | 554627f | 2019-06-04 17:58:22 +0100 | [diff] [blame] | 72 | "packet_writer.cc", |
| 73 | "packet_writer.h", |
Hector Dearman | b7fa544 | 2018-11-08 18:39:32 +0000 | [diff] [blame] | 74 | "pbtxt_to_pb.cc", |
| 75 | "pbtxt_to_pb.h", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 76 | "perfetto_cmd.cc", |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 77 | "perfetto_cmd.h", |
Hector Dearman | b7fa544 | 2018-11-08 18:39:32 +0000 | [diff] [blame] | 78 | "perfetto_config.descriptor.h", |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 79 | "rate_limiter.cc", |
| 80 | "rate_limiter.h", |
| 81 | ] |
Primiano Tucci | ec62e3e | 2019-07-26 22:18:31 +0100 | [diff] [blame] | 82 | if (is_android) { |
| 83 | sources += [ "perfetto_cmd_android.cc" ] |
Primiano Tucci | 106605c | 2019-01-08 21:12:58 +0000 | [diff] [blame] | 84 | } |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 85 | } |
| 86 | |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 87 | source_set("trigger_perfetto_cmd") { |
| 88 | public_deps = [ |
| 89 | ":protos", |
Primiano Tucci | 2c5488f | 2019-06-01 03:27:28 +0100 | [diff] [blame] | 90 | "../../include/perfetto/ext/traced", |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 91 | ] |
| 92 | deps = [ |
| 93 | ":trigger_producer", |
| 94 | "../../gn:default_deps", |
| 95 | "../base", |
Primiano Tucci | c4c063b | 2020-01-27 09:34:46 +0000 | [diff] [blame] | 96 | "../tracing/ipc/producer", |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 97 | ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 98 | sources = [ "trigger_perfetto.cc" ] |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | source_set("trigger_producer") { |
| 102 | sources = [ |
| 103 | "trigger_producer.cc", |
| 104 | "trigger_producer.h", |
| 105 | ] |
| 106 | deps = [ |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 107 | "../../gn:default_deps", |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 108 | "../base", |
Primiano Tucci | c4c063b | 2020-01-27 09:34:46 +0000 | [diff] [blame] | 109 | "../tracing/ipc/producer", |
Hector Dearman | 696ff77 | 2019-04-23 18:38:53 +0100 | [diff] [blame] | 110 | ] |
| 111 | } |
| 112 | |
Primiano Tucci | 2cf8b53 | 2019-08-29 01:14:01 +0200 | [diff] [blame] | 113 | perfetto_proto_library("protos") { |
Hector Dearman | 040f958 | 2019-12-03 18:06:33 +0000 | [diff] [blame] | 114 | proto_generators = [ "cpp" ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 115 | sources = [ "perfetto_cmd_state.proto" ] |
Primiano Tucci | 2cf8b53 | 2019-08-29 01:14:01 +0200 | [diff] [blame] | 116 | proto_path = perfetto_root_path |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 117 | } |
| 118 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 119 | perfetto_unittest_source_set("unittests") { |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 120 | testonly = true |
| 121 | public_deps = [] |
| 122 | deps = [ |
| 123 | ":perfetto_cmd", |
| 124 | "../../gn:default_deps", |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 125 | "../../gn:gtest_and_gmock", |
Hector Dearman | 554627f | 2019-06-04 17:58:22 +0100 | [diff] [blame] | 126 | "../../include/perfetto/base", |
Primiano Tucci | 2c5488f | 2019-06-01 03:27:28 +0100 | [diff] [blame] | 127 | "../../include/perfetto/ext/base", |
Primiano Tucci | 54985c2 | 2019-12-03 12:14:08 +0000 | [diff] [blame] | 128 | "../../protos/perfetto/config:cpp", |
| 129 | "../../protos/perfetto/config/ftrace:cpp", |
Primiano Tucci | fe502c4 | 2019-12-11 01:00:27 +0000 | [diff] [blame] | 130 | "../../protos/perfetto/trace:cpp", |
Primiano Tucci | c4c063b | 2020-01-27 09:34:46 +0000 | [diff] [blame] | 131 | "../tracing/core", |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 132 | ] |
Primiano Tucci | 1b5fdae | 2020-01-16 09:28:05 +0000 | [diff] [blame] | 133 | if (enable_perfetto_zlib) { |
| 134 | deps += [ "../../gn:zlib" ] |
| 135 | } |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 136 | sources = [ |
Hector Dearman | 5edeafc | 2018-11-29 13:27:33 +0000 | [diff] [blame] | 137 | "config_unittest.cc", |
Hector Dearman | 554627f | 2019-06-04 17:58:22 +0100 | [diff] [blame] | 138 | "packet_writer_unittest.cc", |
Hector Dearman | b7fa544 | 2018-11-08 18:39:32 +0000 | [diff] [blame] | 139 | "pbtxt_to_pb_unittest.cc", |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 140 | "rate_limiter_unittest.cc", |
Primiano Tucci | 3b72910 | 2018-01-08 18:16:36 +0000 | [diff] [blame] | 141 | ] |
| 142 | } |