| # Copyright (C) 2019 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("../../../gn/perfetto.gni") |
| import("../../../gn/perfetto_cc_proto_descriptor.gni") |
| import("../../../gn/test.gni") |
| import("../../../gn/wasm.gni") |
| |
| # Prevent that this file is accidentally included in embedder builds. |
| assert(enable_perfetto_trace_processor) |
| assert(enable_perfetto_trace_processor_sqlite) |
| |
| # This source_set is used both by WASM (for the function-call-based query |
| # interface) and by the :httpd module for the HTTP interface. |
| source_set("rpc") { |
| sources = [ |
| "query_result_serializer.cc", |
| "rpc.cc", |
| "rpc.h", |
| ] |
| deps = [ |
| "..:lib", |
| "..:metatrace", |
| "../../../gn:default_deps", |
| "../../../include/perfetto/trace_processor", |
| "../../../protos/perfetto/trace_processor:zero", |
| "../../../protos/perfetto/trace_summary:zero", |
| "../../base", |
| "../../base:version", |
| "../../protozero", |
| "../../protozero:proto_ring_buffer", |
| ] |
| public_deps = [ |
| "../../../include/perfetto/ext/trace_processor/rpc:query_result_serializer", |
| ] |
| } |
| |
| if (is_perfetto_build_generator || perfetto_build_standalone) { |
| # Static library target for RPC code. Needed for BigTrace in Google3. |
| # TODO(b/278208757): remove this when we migrate to using rpc_shell. |
| static_library("trace_processor_rpc") { |
| public_deps = [ ":rpc" ] |
| } |
| } |
| |
| source_set("stdiod") { |
| sources = [ |
| "stdiod.cc", |
| "stdiod.h", |
| ] |
| deps = [ |
| ":rpc", |
| "..:lib", |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| } |
| |
| # Conventions (session names, socket paths, address classification) shared by |
| # the unix server and the --remote client. Base-only so both sides can depend |
| # on it without pulling in trace processor. |
| source_set("session_util") { |
| sources = [ |
| "session_paths.cc", |
| "session_paths.h", |
| ] |
| deps = [ |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| } |
| |
| # Self-managing lifecycle (idle-timeout reaping + orphan detection) shared by the |
| # unix and http servers. Base-only. |
| source_set("lifecycle") { |
| sources = [ |
| "session_lifecycle.cc", |
| "session_lifecycle.h", |
| ] |
| deps = [ |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| } |
| |
| # Depends on the IPC layer (AF_UNIX sockets), which is not available on all |
| # platforms (e.g. Chromium+Windows). Gated accordingly; the shell falls back to |
| # an error when the unix server isn't compiled in. |
| if (enable_perfetto_ipc) { |
| source_set("unixd") { |
| sources = [ |
| "unixd.cc", |
| "unixd.h", |
| ] |
| deps = [ |
| ":rpc", |
| ":session_util", |
| "../../../gn:default_deps", |
| "../../base", |
| "../../base:unix_socket", |
| "../../protozero", |
| "../../protozero:proto_ring_buffer", |
| ] |
| |
| # unixd.h exposes IdleStart from session_lifecycle.h. |
| public_deps = [ ":lifecycle" ] |
| } |
| } |
| |
| # Decodes the QueryResult wire format produced by query_result_serializer.cc. |
| # The inverse of ":rpc"'s serializer, kept in its own target so the lean |
| # ":client" and the serializer unittests can share one decoder. |
| source_set("deserializer") { |
| sources = [ |
| "query_result_deserializer.cc", |
| "query_result_deserializer.h", |
| ] |
| deps = [ |
| "../../../gn:default_deps", |
| "../../../include/perfetto/trace_processor", |
| "../../../protos/perfetto/trace_processor:zero", |
| "../../base", |
| "../../protozero", |
| ] |
| } |
| |
| # The --remote client: a TraceProcessor implementation that marshals every |
| # method over the RPC wire to a warm server, over either an AF_UNIX byte pipe |
| # or a WebSocket (to an http server). Needs the IPC layer (AF_UNIX sockets), |
| # so gated like ":unixd". |
| if (enable_perfetto_ipc) { |
| source_set("client") { |
| sources = [ |
| "remote_trace_processor.cc", |
| "remote_trace_processor.h", |
| "rpc_transport.cc", |
| "rpc_transport.h", |
| ] |
| deps = [ |
| ":deserializer", |
| ":session_util", |
| "..:lib", |
| "../../../gn:default_deps", |
| "../../../protos/perfetto/trace_processor:zero", |
| "../../../protos/perfetto/trace_summary:zero", |
| "../../base", |
| "../../base:unix_socket", |
| "../../protozero", |
| "../../protozero:proto_ring_buffer", |
| ] |
| public_deps = [ "../../../include/perfetto/trace_processor" ] |
| } |
| } |
| |
| perfetto_unittest_source_set("unittests") { |
| testonly = true |
| sources = [ |
| "query_result_serializer_unittest.cc", |
| "session_paths_unittest.cc", |
| ] |
| deps = [ |
| ":deserializer", |
| ":rpc", |
| ":session_util", |
| "..:lib", |
| "../../../gn:default_deps", |
| "../../../gn:gtest_and_gmock", |
| "../../../protos/perfetto/trace_processor:zero", |
| "../../base", |
| "../../protozero", |
| ] |
| } |
| |
| if (enable_perfetto_trace_processor_httpd) { |
| source_set("httpd") { |
| sources = [ |
| "httpd.cc", |
| "httpd.h", |
| ] |
| deps = [ |
| ":rpc", |
| "../../../gn:default_deps", |
| "../../../include/perfetto/trace_processor", |
| "../../../protos/perfetto/trace_processor:zero", |
| "../../base", |
| "../../base/http", |
| "../../protozero", |
| ] |
| |
| # httpd.h exposes IdleStart from session_lifecycle.h. |
| public_deps = [ ":lifecycle" ] |
| } |
| } |
| |
| if (enable_perfetto_ui && is_wasm) { |
| source_set("wasm_bridge") { |
| sources = [ "wasm_bridge.cc" ] |
| deps = [ |
| ":rpc", |
| "../../../gn:default_deps", |
| "../../../include/perfetto/trace_processor", |
| "../../base", |
| ] |
| } |
| } |
| |
| if (enable_perfetto_benchmarks) { |
| source_set("benchmarks") { |
| testonly = true |
| deps = [ |
| ":rpc", |
| "..:lib", |
| "../../../gn:benchmark", |
| "../../../gn:default_deps", |
| "../../../gn:sqlite", |
| "../../base", |
| ] |
| sources = [ "query_result_serializer_benchmark.cc" ] |
| } |
| } |