| # Copyright (C) 2018 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("//build_overrides/build.gni") |
| import("../../../gn/fuzzer.gni") |
| import("../../../gn/perfetto.gni") |
| |
| # For use_libfuzzer. |
| if (!build_with_chromium) { |
| import("//gn/standalone/sanitizers/vars.gni") |
| } else { |
| import("//build/config/sanitizers/sanitizers.gni") |
| } |
| |
| source_set("wire_protocol") { |
| public_deps = [ |
| "../../../gn:libunwindstack", |
| ] |
| deps = [ |
| ":ring_buffer", |
| "../../../gn:default_deps", |
| "../../base", |
| "../../base:unix_socket", |
| ] |
| sources = [ |
| "wire_protocol.cc", |
| "wire_protocol.h", |
| ] |
| } |
| |
| source_set("proc_utils") { |
| deps = [ |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| sources = [ |
| "proc_utils.cc", |
| "proc_utils.h", |
| ] |
| } |
| |
| source_set("scoped_spinlock") { |
| deps = [ |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| sources = [ |
| "scoped_spinlock.cc", |
| "scoped_spinlock.h", |
| ] |
| } |
| |
| source_set("ring_buffer") { |
| deps = [ |
| ":scoped_spinlock", |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| sources = [ |
| "shared_ring_buffer.cc", |
| "shared_ring_buffer.h", |
| ] |
| } |
| |
| source_set("ring_buffer_unittests") { |
| testonly = true |
| deps = [ |
| ":ring_buffer", |
| "../../../gn:default_deps", |
| "../../../gn:gtest_and_gmock", |
| "../../base", |
| ] |
| sources = [ |
| "shared_ring_buffer_unittest.cc", |
| ] |
| } |
| |
| source_set("daemon") { |
| deps = [ |
| ":proc_utils", |
| ":ring_buffer", |
| ":scoped_spinlock", |
| ":wire_protocol", |
| "../../../gn:default_deps", |
| "../../../protos/perfetto/config/profiling:lite", |
| "../../base", |
| "../../base:unix_socket", |
| "../../tracing", |
| "../../tracing:ipc", |
| ] |
| public_deps = [ |
| "../../../gn:libunwindstack", |
| "../../../protos/perfetto/trace:zero", |
| "../../../protos/perfetto/trace/interned_data:zero", |
| "../../../protos/perfetto/trace/profiling:zero", |
| ] |
| sources = [ |
| "bookkeeping.cc", |
| "bookkeeping.h", |
| "bookkeeping_dump.cc", |
| "bookkeeping_dump.h", |
| "heapprofd_config.cc", |
| "heapprofd_config.h", |
| "heapprofd_producer.cc", |
| "heapprofd_producer.h", |
| "interner.h", |
| "page_idle_checker.cc", |
| "page_idle_checker.h", |
| "system_property.cc", |
| "system_property.h", |
| "unwinding.cc", |
| "unwinding.h", |
| "unwound_messages.h", |
| "utils.cc", |
| "utils.h", |
| ] |
| } |
| |
| source_set("client") { |
| deps = [ |
| ":proc_utils", |
| ":ring_buffer", |
| ":scoped_spinlock", |
| ":wire_protocol", |
| "../../../gn:default_deps", |
| "../../../gn:libunwindstack", |
| "../../base", |
| "../../base:unix_socket", |
| ] |
| sources = [ |
| "client.cc", |
| "client.h", |
| "sampler.h", |
| ] |
| } |
| |
| source_set("unittests") { |
| testonly = true |
| deps = [ |
| ":client", |
| ":daemon", |
| ":proc_utils", |
| ":wire_protocol", |
| "../../../gn:default_deps", |
| "../../../gn:gtest_and_gmock", |
| "../../../gn:libunwindstack", |
| "../../base", |
| "../../base:test_support", |
| "../../tracing", |
| ] |
| sources = [ |
| "bookkeeping_unittest.cc", |
| "client_unittest.cc", |
| "heapprofd_producer_unittest.cc", |
| "interner_unittest.cc", |
| "page_idle_checker_unittest.cc", |
| "proc_utils_unittest.cc", |
| "sampler_unittest.cc", |
| "system_property_unittest.cc", |
| "unwinding_unittest.cc", |
| "wire_protocol_unittest.cc", |
| ] |
| } |
| |
| source_set("end_to_end_tests") { |
| testonly = true |
| deps = [ |
| ":client", |
| ":daemon", |
| ":wire_protocol", |
| "../../../gn:default_deps", |
| "../../../gn:gtest_and_gmock", |
| "../../../gn:libunwindstack", |
| "../../../include/perfetto/protozero", |
| "../../../protos/perfetto/config/profiling:zero", |
| "../../../test:test_helper", |
| "../../base", |
| "../../base:test_support", |
| ] |
| sources = [ |
| "heapprofd_end_to_end_test.cc", |
| ] |
| if (start_daemons_for_testing) { |
| defines = [ "PERFETTO_START_DAEMONS_FOR_TESTING" ] |
| } |
| } |
| |
| # This will export publicly visibile symbols for the malloc_hooks. |
| source_set("malloc_hooks") { |
| deps = [ |
| ":client", |
| ":proc_utils", |
| ":scoped_spinlock", |
| ":wire_protocol", |
| "../../../gn:default_deps", |
| "../../base", |
| "../../base:unix_socket", |
| ] |
| cflags = [ |
| "-isystem", |
| rebase_path("../../../buildtools/bionic/libc", root_build_dir), |
| ] |
| sources = [ |
| "malloc_hooks.cc", |
| ] |
| } |
| |
| perfetto_fuzzer_test("unwinding_fuzzer") { |
| testonly = true |
| sources = [ |
| "unwinding_fuzzer.cc", |
| ] |
| deps = [ |
| ":daemon", |
| ":ring_buffer", |
| ":wire_protocol", |
| "../../../gn:default_deps", |
| "../../base", |
| "../../tracing", |
| ] |
| } |
| |
| perfetto_fuzzer_test("shared_ring_buffer_fuzzer") { |
| testonly = true |
| sources = [ |
| "shared_ring_buffer_fuzzer.cc", |
| ] |
| deps = [ |
| ":ring_buffer", |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| } |
| |
| perfetto_fuzzer_test("shared_ring_buffer_write_fuzzer") { |
| testonly = true |
| sources = [ |
| "shared_ring_buffer_write_fuzzer.cc", |
| ] |
| deps = [ |
| ":ring_buffer", |
| "../../../gn:default_deps", |
| "../../base", |
| ] |
| } |