| # 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("../../gn/fuzzer.gni") |
| import("../../gn/perfetto.gni") |
| import("../../gn/perfetto_cc_proto_descriptor.gni") |
| import("../../gn/perfetto_host_executable.gni") |
| import("../../gn/test.gni") |
| import("../../gn/wasm.gni") |
| |
| # Prevent that this file is accidentally included in embedder builds. |
| assert(enable_perfetto_trace_processor) |
| |
| # The library which eases processing of Perfetto traces by exposing reading |
| # friendly APIs. |
| if (enable_perfetto_trace_processor_sqlite) { |
| static_library("trace_processor") { |
| complete_static_lib = true |
| public_deps = [ ":lib" ] |
| } |
| } |
| |
| if (enable_perfetto_ui) { |
| wasm_lib("trace_processor_wasm") { |
| name = "trace_processor" |
| deps = [ |
| ":lib", |
| "../../gn:default_deps", |
| "../base", |
| "rpc:wasm_bridge", |
| ] |
| } |
| } |
| |
| source_set("metatrace") { |
| sources = [ |
| "tp_metatrace.cc", |
| "tp_metatrace.h", |
| ] |
| deps = [ |
| "../../gn:default_deps", |
| "../../include/perfetto/ext/base", |
| "../../include/perfetto/trace_processor", |
| "../../protos/perfetto/trace_processor:zero", |
| ] |
| } |
| |
| # In Bazel builds the ":demangle" target (below) should be a static_library so |
| # it gets mapped to an actual target (rather than being squashed as a filegroup) |
| # and can be replaced in Google internal builds via perfetto_cfg.bzl. |
| # Unfortunately, however, static_library targets seem to break Wasm builds on |
| # Mac. For this reason we just make it a source_set for all other build types. |
| if (is_perfetto_build_generator) { |
| _demangle_target_type = "static_library" |
| } else { |
| _demangle_target_type = "source_set" |
| } |
| |
| target(_demangle_target_type, "demangle") { |
| sources = [ "demangle.cc" ] |
| deps = [ |
| "../../gn:default_deps", |
| "../../include/perfetto/base", |
| "../../include/perfetto/ext/base", |
| ] |
| public_deps = [ "../../include/perfetto/ext/trace_processor:demangle" ] |
| if (enable_perfetto_llvm_demangle) { |
| deps += [ "../../gn:llvm_demangle" ] |
| } |
| } |
| |
| source_set("ftrace_descriptors") { |
| sources = [ |
| "importers/ftrace/ftrace_descriptors.cc", |
| "importers/ftrace/ftrace_descriptors.h", |
| ] |
| deps = [ |
| "../../gn:default_deps", |
| "../../include/perfetto/ext/base:base", |
| "../protozero", |
| ] |
| } |
| |
| source_set("storage_minimal") { |
| sources = [ |
| "forwarding_trace_parser.cc", |
| "forwarding_trace_parser.h", |
| "importers/default_modules.cc", |
| "importers/default_modules.h", |
| "importers/ftrace/ftrace_module.cc", |
| "importers/ftrace/ftrace_module.h", |
| "importers/fuchsia/fuchsia_trace_utils.h", |
| "importers/json/json_utils.cc", |
| "importers/json/json_utils.h", |
| "importers/ninja/ninja_log_parser.cc", |
| "importers/ninja/ninja_log_parser.h", |
| "importers/proto/android_camera_event_module.cc", |
| "importers/proto/android_camera_event_module.h", |
| "importers/proto/async_track_set_tracker.cc", |
| "importers/proto/async_track_set_tracker.h", |
| "importers/proto/chrome_string_lookup.cc", |
| "importers/proto/chrome_string_lookup.h", |
| "importers/proto/chrome_system_probes_module.cc", |
| "importers/proto/chrome_system_probes_module.h", |
| "importers/proto/chrome_system_probes_parser.cc", |
| "importers/proto/chrome_system_probes_parser.h", |
| "importers/proto/memory_tracker_snapshot_module.cc", |
| "importers/proto/memory_tracker_snapshot_module.h", |
| "importers/proto/memory_tracker_snapshot_parser.cc", |
| "importers/proto/memory_tracker_snapshot_parser.h", |
| "importers/proto/metadata_module.cc", |
| "importers/proto/metadata_module.h", |
| "importers/proto/metadata_tracker.cc", |
| "importers/proto/metadata_tracker.h", |
| "importers/proto/perf_sample_tracker.cc", |
| "importers/proto/perf_sample_tracker.h", |
| "importers/proto/profile_module.cc", |
| "importers/proto/profile_module.h", |
| "importers/proto/profile_packet_utils.cc", |
| "importers/proto/profile_packet_utils.h", |
| "importers/proto/proto_importer_module.cc", |
| "importers/proto/proto_importer_module.h", |
| "importers/proto/proto_incremental_state.h", |
| "importers/proto/proto_trace_parser.cc", |
| "importers/proto/proto_trace_parser.h", |
| "importers/proto/proto_trace_reader.cc", |
| "importers/proto/proto_trace_reader.h", |
| "importers/proto/proto_trace_tokenizer.cc", |
| "importers/proto/proto_trace_tokenizer.h", |
| |
| # XXX: is this the correct place |
| "importers/proto/statsd_module.cc", |
| "importers/proto/statsd_module.h", |
| "importers/proto/track_event_module.cc", |
| "importers/proto/track_event_module.h", |
| "importers/proto/track_event_parser.cc", |
| "importers/proto/track_event_parser.h", |
| "importers/proto/track_event_tokenizer.cc", |
| "importers/proto/track_event_tokenizer.h", |
| "importers/proto/track_event_tracker.cc", |
| "importers/proto/track_event_tracker.h", |
| "importers/proto/translation_table_module.cc", |
| "importers/proto/translation_table_module.h", |
| "importers/syscalls/syscall_tracker.h", |
| "trace_blob.cc", |
| "trace_processor_context.cc", |
| "trace_processor_storage.cc", |
| "trace_processor_storage_impl.cc", |
| "trace_processor_storage_impl.h", |
| "trace_sorter.cc", |
| "trace_sorter.h", |
| "trace_sorter_internal.h", |
| "trace_sorter_queue.h", |
| "virtual_destructors.cc", |
| ] |
| deps = [ |
| "../../gn:default_deps", |
| "../base", |
| "../protozero", |
| "containers", |
| "importers:gen_cc_chrome_track_event_descriptor", |
| "importers:gen_cc_statsd_atoms_descriptor", |
| "importers:gen_cc_track_event_descriptor", |
| "importers/common", |
| "importers/common:parser_types", |
| "importers/fuchsia:fuchsia_record", |
| "importers/memory_tracker:graph_processor", |
| "importers/proto:storage_minimal", |
| "importers/systrace:systrace_line", |
| "storage", |
| "tables", |
| "types", |
| "util", |
| "util:descriptors", |
| "util:gzip", |
| "util:proto_to_args_parser", |
| "util:stack_traces_util", |
| "views", |
| ] |
| public_deps = [ |
| "../../include/perfetto/trace_processor:storage", |
| "../../protos/perfetto/common:zero", |
| "../../protos/perfetto/config:zero", |
| "../../protos/perfetto/trace:zero", |
| "../../protos/perfetto/trace/android:zero", |
| "../../protos/perfetto/trace/chrome:zero", |
| "../../protos/perfetto/trace/ftrace:zero", |
| "../../protos/perfetto/trace/interned_data:zero", |
| "../../protos/perfetto/trace/perfetto:zero", |
| "../../protos/perfetto/trace/power:zero", |
| "../../protos/perfetto/trace/profiling:zero", |
| "../../protos/perfetto/trace/ps:zero", |
| "../../protos/perfetto/trace/statsd:zero", |
| "../../protos/perfetto/trace/sys_stats:zero", |
| "../../protos/perfetto/trace/system_info:zero", |
| "../../protos/perfetto/trace/track_event:zero", |
| "../../protos/perfetto/trace/translation:zero", |
| "../../src/kernel_utils:syscall_table", |
| ] |
| |
| # json_utils optionally depends on jsoncpp. |
| if (enable_perfetto_trace_processor_json) { |
| deps += [ "../../gn:jsoncpp" ] |
| } |
| } |
| |
| source_set("export_json") { |
| sources = [ |
| "export_json.cc", |
| "export_json.h", |
| ] |
| deps = [ |
| ":storage_minimal", |
| "../../gn:default_deps", |
| "../base", |
| "storage", |
| "types", |
| ] |
| public_deps = [ "../../include/perfetto/ext/trace_processor:export_json" ] |
| if (enable_perfetto_trace_processor_json) { |
| deps += [ "../../gn:jsoncpp" ] |
| } |
| } |
| |
| if (enable_perfetto_trace_processor_sqlite) { |
| source_set("lib") { |
| sources = [ |
| "iterator_impl.cc", |
| "iterator_impl.h", |
| "read_trace.cc", |
| "read_trace_internal.cc", |
| "read_trace_internal.h", |
| "trace_processor.cc", |
| "trace_processor_impl.cc", |
| "trace_processor_impl.h", |
| ] |
| |
| deps = [ |
| ":metatrace", |
| "../../gn:default_deps", |
| "../../protos/perfetto/trace/ftrace:zero", |
| "../base", |
| "../protozero", |
| "analysis", |
| "db", |
| "dynamic", |
| "importers:importers_full", |
| "importers/android_bugreport", |
| "importers/common", |
| "metrics", |
| "sqlite", |
| "sqlite/functions", |
| "stdlib:gen_amalgamated_stdlib", |
| "storage", |
| "tables", |
| "types", |
| "util", |
| "util:gzip", |
| "util:protozero_to_text", |
| "util:stdlib", |
| "views", |
| ] |
| public_deps = [ |
| "../../gn:sqlite", # iterator_impl.h includes sqlite3.h. |
| "../../include/perfetto/trace_processor", |
| ] |
| if (enable_perfetto_trace_processor_json) { |
| deps += [ "../../gn:jsoncpp" ] |
| } |
| } |
| |
| executable("trace_processor_shell") { |
| deps = [ |
| ":lib", |
| "../../gn:default_deps", |
| "../../gn:protobuf_full", |
| "../../protos/perfetto/trace_processor:zero", |
| "../../src/profiling:deobfuscator", |
| "../../src/profiling/symbolizer", |
| "../../src/profiling/symbolizer:symbolize_database", |
| "../base", |
| "../base:version", |
| "metrics", |
| "util", |
| "util:stdlib", |
| ] |
| if (enable_perfetto_trace_processor_linenoise) { |
| deps += [ "../../gn:linenoise" ] |
| } |
| if (enable_perfetto_trace_processor_httpd) { |
| deps += [ "rpc:httpd" ] |
| } |
| sources = [ |
| "trace_processor_shell.cc", |
| "util/proto_to_json.cc", |
| "util/proto_to_json.h", |
| ] |
| if (perfetto_build_standalone && !is_perfetto_build_generator) { |
| data_deps = [ |
| # The diff testing framework depends on these descriptors. |
| "../../protos/perfetto/metrics:descriptor", |
| "../../protos/perfetto/trace:descriptor", |
| "../../protos/perfetto/trace:test_extensions_descriptor", |
| ] |
| } |
| } |
| } # if (enable_perfetto_trace_processor_sqlite) |
| |
| perfetto_unittest_source_set("unittests") { |
| testonly = true |
| sources = [ |
| "forwarding_trace_parser_unittest.cc", |
| "importers/ftrace/binder_tracker_unittest.cc", |
| "importers/ftrace/sched_event_tracker_unittest.cc", |
| "importers/ftrace/thread_state_tracker_unittest.cc", |
| "importers/fuchsia/fuchsia_parser_unittest.cc", |
| "importers/fuchsia/fuchsia_trace_utils_unittest.cc", |
| "importers/memory_tracker/graph_processor_unittest.cc", |
| "importers/memory_tracker/graph_unittest.cc", |
| "importers/memory_tracker/raw_process_memory_node_unittest.cc", |
| "importers/proto/async_track_set_tracker_unittest.cc", |
| "importers/proto/perf_sample_tracker_unittest.cc", |
| "importers/proto/proto_trace_parser_unittest.cc", |
| "importers/syscalls/syscall_tracker_unittest.cc", |
| "importers/systrace/systrace_parser_unittest.cc", |
| "ref_counted_unittest.cc", |
| "trace_sorter_queue_unittest.cc", |
| "trace_sorter_unittest.cc", |
| ] |
| deps = [ |
| ":gen_cc_test_messages_descriptor", |
| "../../gn:default_deps", |
| "../../gn:gtest_and_gmock", |
| "../../protos/perfetto/common:cpp", |
| "../../protos/perfetto/common:zero", |
| "../../protos/perfetto/trace:cpp", |
| "../../protos/perfetto/trace:minimal_zero", |
| "../../protos/perfetto/trace:zero", |
| "../../protos/perfetto/trace/android:zero", |
| "../../protos/perfetto/trace/chrome:zero", |
| "../../protos/perfetto/trace/ftrace:zero", |
| "../../protos/perfetto/trace/gpu:zero", |
| "../../protos/perfetto/trace/interned_data:zero", |
| "../../protos/perfetto/trace/profiling:cpp", |
| "../../protos/perfetto/trace/ps:zero", |
| "../../protos/perfetto/trace/sys_stats:zero", |
| "../../protos/perfetto/trace/track_event:zero", |
| "../base", |
| "../protozero", |
| "../protozero:testing_messages_zero", |
| "containers", |
| "containers:unittests", |
| "db:unittests", |
| "dynamic", |
| "importers:importers_full", |
| "importers/android_bugreport:unittests", |
| "importers/common", |
| "importers/common:parser_types", |
| "importers/common:unittests", |
| "importers/memory_tracker:graph_processor", |
| "importers/proto:storage_minimal", |
| "importers/proto:unittests", |
| "rpc:unittests", |
| "sqlite/functions:unittests", |
| "storage", |
| "tables:unittests", |
| "types", |
| "types:unittests", |
| "util:descriptors", |
| "util:unittests", |
| "views", |
| "views:unittests", |
| ] |
| |
| if (enable_perfetto_trace_processor_sqlite) { |
| deps += [ |
| ":lib", |
| "../../gn:sqlite", |
| "dynamic:unittests", |
| "sqlite:unittests", |
| ] |
| } |
| |
| if (enable_perfetto_trace_processor_json) { |
| sources += [ |
| "importers/json/json_trace_tokenizer_unittest.cc", |
| "importers/json/json_utils_unittest.cc", |
| ] |
| deps += [ "../../gn:jsoncpp" ] |
| |
| if (!is_win) { |
| # export_json_unittest.cc uses base::TempFile, which is not supported on |
| # windows. |
| sources += [ "export_json_unittest.cc" ] |
| deps += [ |
| ":export_json", |
| "../../include/perfetto/ext/trace_processor:export_json", |
| ] |
| } |
| } |
| } |
| |
| perfetto_cc_proto_descriptor("gen_cc_test_messages_descriptor") { |
| descriptor_name = "test_messages.descriptor" |
| descriptor_target = "../protozero:test_messages_descriptor" |
| } |
| |
| source_set("integrationtests") { |
| testonly = true |
| sources = [] |
| deps = [] |
| if (enable_perfetto_trace_processor_sqlite) { |
| sources += [ |
| "read_trace_integrationtest.cc", |
| "trace_database_integrationtest.cc", |
| ] |
| deps += [ |
| ":lib", |
| "../../gn:default_deps", |
| "../../gn:gtest_and_gmock", |
| "../../protos/perfetto/common:zero", |
| "../../protos/perfetto/trace:zero", |
| "../../protos/perfetto/trace_processor:zero", |
| "../base", |
| "../base:test_support", |
| "sqlite", |
| ] |
| if (enable_perfetto_trace_processor_json) { |
| deps += [ "../../gn:jsoncpp" ] |
| } |
| } |
| } |
| |
| if (enable_perfetto_trace_processor_json) { |
| source_set("storage_minimal_smoke_tests") { |
| testonly = true |
| sources = [ "storage_minimal_smoke_test.cc" ] |
| deps = [ |
| ":export_json", |
| ":storage_minimal", |
| "../../gn:default_deps", |
| "../../gn:gtest_and_gmock", |
| "../../gn:gtest_main", |
| "../../gn:jsoncpp", |
| "../base:test_support", |
| ] |
| } |
| } |
| |
| perfetto_fuzzer_test("trace_processor_fuzzer") { |
| testonly = true |
| sources = [ "trace_parsing_fuzzer.cc" ] |
| deps = [ |
| "../../gn:default_deps", |
| "../base", |
| "importers:importers_full", |
| ] |
| } |