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