1# Copyright (C) 2020 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/fuzzer.gni") 16import("../../../gn/perfetto.gni") 17import("../../../gn/test.gni") 18 19# Core tracing library, platform independent, no IPC layer, no service. 20source_set("core") { 21 public_deps = [ 22 "../../../include/perfetto/ext/tracing/core", 23 "../../protozero", 24 ] 25 deps = [ 26 "..:common", 27 "../../../gn:default_deps", 28 "../../../include/perfetto/tracing", 29 "../../../protos/perfetto/trace:zero", 30 "../../base", 31 ] 32 sources = [ 33 "id_allocator.cc", 34 "id_allocator.h", 35 "null_trace_writer.cc", 36 "null_trace_writer.h", 37 "patch_list.h", 38 "shared_memory_abi.cc", 39 "shared_memory_arbiter_impl.cc", 40 "shared_memory_arbiter_impl.h", 41 "trace_packet.cc", 42 "trace_writer_impl.cc", 43 "trace_writer_impl.h", 44 "virtual_destructors.cc", 45 ] 46} 47 48source_set("service") { 49 public_deps = [ 50 "..:common", 51 "../../../include/perfetto/ext/base", 52 "../../../include/perfetto/ext/tracing/core", 53 ] 54 deps = [ 55 ":core", 56 "../../../gn:default_deps", 57 "../../../include/perfetto/tracing", 58 "../../../protos/perfetto/common:zero", 59 "../../../protos/perfetto/config:zero", 60 "../../../protos/perfetto/trace:zero", 61 "../../../protos/perfetto/trace/perfetto:zero", # For MetatraceWriter. 62 "../../android_stats", 63 "../../base", 64 "../../protozero/filtering:message_filter", 65 ] 66 sources = [ 67 "metatrace_writer.cc", 68 "metatrace_writer.h", 69 "packet_stream_validator.cc", 70 "packet_stream_validator.h", 71 "trace_buffer.cc", 72 "trace_buffer.h", 73 "tracing_service_impl.cc", 74 "tracing_service_impl.h", 75 ] 76 if (is_android && perfetto_build_with_android) { 77 deps += [ 78 "../../android_internal:headers", 79 "../../android_internal:lazy_library_loader", 80 ] 81 } 82} 83 84perfetto_unittest_source_set("unittests") { 85 testonly = true 86 deps = [ 87 ":core", 88 ":service", 89 "../../../gn:default_deps", 90 "../../../gn:gtest_and_gmock", 91 "../../../protos/perfetto/trace:cpp", 92 "../../../protos/perfetto/trace:zero", 93 "../../../protos/perfetto/trace/ftrace:cpp", 94 "../../../protos/perfetto/trace/perfetto:cpp", 95 "../../base", 96 "../../base:test_support", 97 "../test:test_support", 98 ] 99 sources = [ 100 "id_allocator_unittest.cc", 101 "null_trace_writer_unittest.cc", 102 "packet_stream_validator_unittest.cc", 103 "patch_list_unittest.cc", 104 "shared_memory_abi_unittest.cc", 105 "trace_buffer_unittest.cc", 106 "trace_packet_unittest.cc", 107 ] 108 109 # These tests rely on test_task_runner.h which 110 # has no Windows implementation. 111 if (!is_win) { 112 sources += [ 113 "shared_memory_arbiter_impl_unittest.cc", 114 "trace_writer_impl_unittest.cc", 115 "tracing_service_impl_unittest.cc", 116 ] 117 } 118} 119 120perfetto_unittest_source_set("test_support") { 121 testonly = true 122 public_deps = [ 123 "../../../include/perfetto/ext/tracing/core", 124 "../../../protos/perfetto/trace:cpp", 125 "../../../protos/perfetto/trace:zero", 126 "../../protozero", 127 ] 128 sources = [ 129 "trace_writer_for_testing.cc", 130 "trace_writer_for_testing.h", 131 ] 132} 133 134if (enable_perfetto_benchmarks) { 135 source_set("benchmarks") { 136 testonly = true 137 deps = [ 138 ":core", 139 ":service", 140 "../../../gn:benchmark", 141 "../../../gn:default_deps", 142 "../../../protos/perfetto/trace:zero", 143 "../../../protos/perfetto/trace/ftrace:zero", 144 "../../protozero", 145 ] 146 sources = [ "packet_stream_validator_benchmark.cc" ] 147 } 148} 149 150perfetto_fuzzer_test("packet_stream_validator_fuzzer") { 151 sources = [ "packet_stream_validator_fuzzer.cc" ] 152 deps = [ 153 ":service", 154 "../../../gn:default_deps", 155 ] 156} 157