| # Copyright (C) 2020 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/fuzzer.gni") |
| import("../../../gn/perfetto.gni") |
| import("../../../gn/test.gni") |
| |
| # Core tracing library, platform independent, no IPC layer, no service. |
| source_set("core") { |
| public_deps = [ |
| "../../../include/perfetto/ext/tracing/core", |
| "../../protozero", |
| ] |
| deps = [ |
| "..:common", |
| "../../../gn:default_deps", |
| "../../../include/perfetto/tracing", |
| "../../../protos/perfetto/trace:zero", |
| "../../base", |
| ] |
| sources = [ |
| "histogram.h", |
| "id_allocator.cc", |
| "id_allocator.h", |
| "null_trace_writer.cc", |
| "null_trace_writer.h", |
| "patch_list.h", |
| "shared_memory_abi.cc", |
| "shared_memory_arbiter_impl.cc", |
| "shared_memory_arbiter_impl.h", |
| "trace_packet.cc", |
| "trace_writer_impl.cc", |
| "trace_writer_impl.h", |
| "virtual_destructors.cc", |
| ] |
| } |
| |
| source_set("service") { |
| public_deps = [ |
| "..:common", |
| "../../../include/perfetto/ext/base", |
| "../../../include/perfetto/ext/tracing/core", |
| ] |
| deps = [ |
| ":core", |
| "../../../gn:default_deps", |
| "../../../include/perfetto/tracing", |
| "../../../protos/perfetto/common:zero", |
| "../../../protos/perfetto/config:zero", |
| "../../../protos/perfetto/trace:zero", |
| "../../../protos/perfetto/trace/perfetto:zero", # For MetatraceWriter. |
| "../../android_stats", |
| "../../base", |
| "../../base:version", |
| "../../protozero/filtering:message_filter", |
| "../../protozero/filtering:string_filter", |
| ] |
| sources = [ |
| "metatrace_writer.cc", |
| "metatrace_writer.h", |
| "packet_stream_validator.cc", |
| "packet_stream_validator.h", |
| "trace_buffer.cc", |
| "trace_buffer.h", |
| "tracing_service_impl.cc", |
| "tracing_service_impl.h", |
| ] |
| if (is_android && perfetto_build_with_android) { |
| deps += [ |
| "../../android_internal:headers", |
| "../../android_internal:lazy_library_loader", |
| ] |
| } |
| } |
| |
| if (enable_perfetto_zlib) { |
| source_set("zlib_compressor") { |
| deps = [ |
| ":core", |
| "../../../gn:default_deps", |
| "../../../gn:zlib", |
| "../../../include/perfetto/tracing", |
| ] |
| sources = [ |
| "zlib_compressor.cc", |
| "zlib_compressor.h", |
| ] |
| } |
| } |
| |
| perfetto_unittest_source_set("unittests") { |
| testonly = true |
| deps = [ |
| ":core", |
| ":service", |
| "../../../gn:default_deps", |
| "../../../gn:gtest_and_gmock", |
| "../../../protos/perfetto/trace:cpp", |
| "../../../protos/perfetto/trace:zero", |
| "../../../protos/perfetto/trace/ftrace:cpp", |
| "../../../protos/perfetto/trace/perfetto:cpp", |
| "../../../src/protozero/filtering:bytecode_generator", |
| "../../base", |
| "../../base:test_support", |
| "../test:test_support", |
| ] |
| |
| if (enable_perfetto_zlib) { |
| deps += [ |
| ":zlib_compressor", |
| "../../../gn:zlib", |
| ] |
| } |
| |
| sources = [ |
| "histogram_unittest.cc", |
| "id_allocator_unittest.cc", |
| "null_trace_writer_unittest.cc", |
| "packet_stream_validator_unittest.cc", |
| "patch_list_unittest.cc", |
| "shared_memory_abi_unittest.cc", |
| "trace_buffer_unittest.cc", |
| "trace_packet_unittest.cc", |
| ] |
| |
| if (enable_perfetto_zlib) { |
| sources += [ "zlib_compressor_unittest.cc" ] |
| } |
| |
| # These tests rely on test_task_runner.h which |
| # has no Windows implementation. |
| if (!is_win) { |
| sources += [ |
| "shared_memory_arbiter_impl_unittest.cc", |
| "trace_writer_impl_unittest.cc", |
| "tracing_service_impl_unittest.cc", |
| ] |
| } |
| } |
| |
| perfetto_unittest_source_set("test_support") { |
| testonly = true |
| public_deps = [ |
| "../../../include/perfetto/ext/tracing/core", |
| "../../../protos/perfetto/trace:cpp", |
| "../../../protos/perfetto/trace:zero", |
| "../../protozero", |
| ] |
| sources = [ |
| "trace_writer_for_testing.cc", |
| "trace_writer_for_testing.h", |
| ] |
| } |
| |
| if (enable_perfetto_benchmarks) { |
| source_set("benchmarks") { |
| testonly = true |
| deps = [ |
| ":core", |
| ":service", |
| "../../../gn:benchmark", |
| "../../../gn:default_deps", |
| "../../../protos/perfetto/trace:zero", |
| "../../../protos/perfetto/trace/ftrace:zero", |
| "../../protozero", |
| ] |
| sources = [ "packet_stream_validator_benchmark.cc" ] |
| } |
| } |
| |
| perfetto_fuzzer_test("packet_stream_validator_fuzzer") { |
| sources = [ "packet_stream_validator_fuzzer.cc" ] |
| deps = [ |
| ":service", |
| "../../../gn:default_deps", |
| ] |
| } |