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 15import("../../gn/perfetto.gni") 16import("//build_overrides/build.gni") 17 18# Core tracing library, platform independent, no transport layer. 19source_set("tracing") { 20 public_deps = [ 21 "../../include/perfetto/tracing/core", 22 "../../protos/perfetto/common", 23 "../../protos/perfetto/trace:minimal_lite", 24 "../../protos/perfetto/trace:zero", 25 ] 26 deps = [ 27 "../../gn:default_deps", 28 "../../gn:gtest_prod_config", 29 "../../protos/perfetto/config", 30 "../base", 31 ] 32 sources = [ 33 "core/chrome_config.cc", 34 "core/commit_data_request.cc", 35 "core/data_source_config.cc", 36 "core/data_source_descriptor.cc", 37 "core/ftrace_config.cc", 38 "core/id_allocator.cc", 39 "core/id_allocator.h", 40 "core/inode_file_config.cc", 41 "core/null_trace_writer.cc", 42 "core/null_trace_writer.h", 43 "core/packet_stream_validator.cc", 44 "core/packet_stream_validator.h", 45 "core/patch_list.h", 46 "core/process_stats_config.cc", 47 "core/service_impl.cc", 48 "core/service_impl.h", 49 "core/shared_memory_abi.cc", 50 "core/shared_memory_arbiter_impl.cc", 51 "core/shared_memory_arbiter_impl.h", 52 "core/sliced_protobuf_input_stream.cc", 53 "core/sliced_protobuf_input_stream.h", 54 "core/test_config.cc", 55 "core/trace_buffer.cc", 56 "core/trace_buffer.h", 57 "core/trace_config.cc", 58 "core/trace_packet.cc", 59 "core/trace_writer_impl.cc", 60 "core/trace_writer_impl.h", 61 "core/virtual_destructors.cc", 62 ] 63} 64 65# Posix specialization of the tracing library for Linux/Android/Mac. Provides 66# an IPC transport over a UNIX domain socket. 67static_library("ipc") { 68 public_deps = [ 69 "../../include/perfetto/tracing/core", 70 "../../include/perfetto/tracing/ipc", 71 ] 72 sources = [ 73 "ipc/consumer/consumer_ipc_client_impl.cc", 74 "ipc/consumer/consumer_ipc_client_impl.h", 75 "ipc/default_socket.cc", 76 "ipc/default_socket.h", 77 "ipc/posix_shared_memory.cc", 78 "ipc/posix_shared_memory.h", 79 "ipc/producer/producer_ipc_client_impl.cc", 80 "ipc/producer/producer_ipc_client_impl.h", 81 "ipc/service/consumer_ipc_service.cc", 82 "ipc/service/consumer_ipc_service.h", 83 "ipc/service/producer_ipc_service.cc", 84 "ipc/service/producer_ipc_service.h", 85 "ipc/service/service_ipc_host_impl.cc", 86 "ipc/service/service_ipc_host_impl.h", 87 ] 88 deps = [ 89 ":tracing", 90 "../../gn:default_deps", 91 "../../protos/perfetto/ipc", 92 "../base", 93 "../ipc", 94 ] 95} 96 97# IPC transport: only consumer side 98# TODO(fmayer): Remove duplication between this and ipc. 99source_set("ipc_consumer") { 100 public_deps = [ 101 "../../include/perfetto/tracing/core", 102 "../../include/perfetto/tracing/ipc", 103 ] 104 sources = [ 105 "ipc/consumer/consumer_ipc_client_impl.cc", 106 "ipc/consumer/consumer_ipc_client_impl.h", 107 "ipc/default_socket.cc", 108 "ipc/default_socket.h", 109 "ipc/posix_shared_memory.cc", 110 "ipc/posix_shared_memory.h", 111 ] 112 deps = [ 113 ":tracing", 114 "../../gn:default_deps", 115 "../../protos/perfetto/ipc", 116 "../base", 117 ] 118} 119 120source_set("unittests") { 121 testonly = true 122 deps = [ 123 ":ipc", 124 ":test_support", 125 ":tracing", 126 "../../gn:default_deps", 127 "../../gn:gtest_deps", 128 "../../protos/perfetto/trace:lite", 129 "../../protos/perfetto/trace:zero", 130 "../base", 131 "../base:test_support", 132 ] 133 sources = [ 134 "core/id_allocator_unittest.cc", 135 "core/null_trace_writer_unittest.cc", 136 "core/packet_stream_validator_unittest.cc", 137 "core/patch_list_unittest.cc", 138 "core/service_impl_unittest.cc", 139 "core/shared_memory_abi_unittest.cc", 140 "core/shared_memory_arbiter_impl_unittest.cc", 141 "core/sliced_protobuf_input_stream_unittest.cc", 142 "core/trace_buffer_unittest.cc", 143 "core/trace_packet_unittest.cc", 144 "core/trace_writer_impl_unittest.cc", 145 "ipc/posix_shared_memory_unittest.cc", 146 "test/aligned_buffer_test.cc", 147 "test/aligned_buffer_test.h", 148 "test/fake_packet.cc", 149 "test/fake_packet.h", 150 "test/mock_consumer.cc", 151 "test/mock_consumer.h", 152 "test/mock_producer.cc", 153 "test/mock_producer.h", 154 "test/test_shared_memory.cc", 155 "test/test_shared_memory.h", 156 "test/tracing_integration_test.cc", 157 ] 158} 159 160source_set("test_support") { 161 testonly = true 162 public_deps = [ 163 "../../gn:default_deps", 164 "../../protos/perfetto/trace:lite", 165 "../../protos/perfetto/trace:zero", 166 "../ftrace_reader:test_support", 167 ] 168 sources = [ 169 "core/trace_writer_for_testing.cc", 170 "core/trace_writer_for_testing.h", 171 ] 172} 173 174if (!build_with_chromium) { 175 source_set("tracing_benchmarks") { 176 testonly = true 177 deps = [ 178 "../../gn:default_deps", 179 "//buildtools:benchmark", 180 ] 181 sources = [ 182 "test/hello_world_benchmark.cc", 183 ] 184 } 185} 186