| # 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", |
| ] |
| } |
| |
| 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_record.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/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/heap_profile_tracker.cc", |
| "importers/proto/heap_profile_tracker.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/packet_sequence_state.cc", |
| "importers/proto/packet_sequence_state.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/profiler_util.cc", |
| "importers/proto/profiler_util.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", |
| "importers/proto/stack_profile_tracker.cc", |
| "importers/proto/stack_profile_tracker.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/syscalls/syscall_tracker.h", |
| "importers/systrace/systrace_line.h", |
| "timestamped_trace_piece.h", |
| "trace_processor_context.cc", |
| "trace_processor_storage.cc", |
| "trace_processor_storage_impl.cc", |
| "trace_processor_storage_impl.h", |
| "trace_sorter.cc", |
| "trace_sorter.h", |
| "virtual_destructors.cc", |
| ] |
| deps = [ |
| "../../gn:default_deps", |
| "../base", |
| "../protozero", |
| "containers", |
| "importers:gen_cc_chrome_track_event_descriptor", |
| "importers:gen_cc_track_event_descriptor", |
| "importers/common", |
| "importers/memory_tracker:graph_processor", |
| "storage", |
| "tables", |
| "types", |
| "util", |
| "util:descriptors", |
| "util:gzip", |
| "util:interned_message_view", |
| "util:proto_to_args_parser", |
| ] |
| 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/sys_stats:zero", |
| "../../protos/perfetto/trace/system_info:zero", |
| "../../protos/perfetto/trace/track_event:zero", |
| "util:trace_blob_view", |
| ] |
| |
| # json_utils optionally depends on jsoncpp. |
| if (enable_perfetto_trace_processor_json) { |
| deps += [ "../../gn:jsoncpp" ] |
| } |
| } |
| |
| source_set("storage_full") { |
| sources = [ |
| "importers/additional_modules.cc", |
| "importers/additional_modules.h", |
| "importers/ftrace/binder_tracker.cc", |
| "importers/ftrace/binder_tracker.h", |
| "importers/ftrace/ftrace_module_impl.cc", |
| "importers/ftrace/ftrace_module_impl.h", |
| "importers/ftrace/ftrace_parser.cc", |
| "importers/ftrace/ftrace_parser.h", |
| "importers/ftrace/ftrace_tokenizer.cc", |
| "importers/ftrace/ftrace_tokenizer.h", |
| "importers/ftrace/rss_stat_tracker.cc", |
| "importers/ftrace/rss_stat_tracker.h", |
| "importers/ftrace/sched_event_tracker.cc", |
| "importers/ftrace/sched_event_tracker.h", |
| "importers/fuchsia/fuchsia_record.cc", |
| "importers/fuchsia/fuchsia_trace_parser.cc", |
| "importers/fuchsia/fuchsia_trace_parser.h", |
| "importers/fuchsia/fuchsia_trace_tokenizer.cc", |
| "importers/fuchsia/fuchsia_trace_tokenizer.h", |
| "importers/fuchsia/fuchsia_trace_utils.cc", |
| "importers/gzip/gzip_trace_parser.cc", |
| "importers/gzip/gzip_trace_parser.h", |
| "importers/json/json_trace_parser.cc", |
| "importers/json/json_trace_parser.h", |
| "importers/json/json_trace_tokenizer.cc", |
| "importers/json/json_trace_tokenizer.h", |
| "importers/json/json_tracker.cc", |
| "importers/json/json_tracker.h", |
| "importers/proto/android_probes_module.cc", |
| "importers/proto/android_probes_module.h", |
| "importers/proto/android_probes_parser.cc", |
| "importers/proto/android_probes_parser.h", |
| "importers/proto/android_probes_tracker.cc", |
| "importers/proto/android_probes_tracker.h", |
| "importers/proto/frame_timeline_event_parser.cc", |
| "importers/proto/frame_timeline_event_parser.h", |
| "importers/proto/gpu_event_parser.cc", |
| "importers/proto/gpu_event_parser.h", |
| "importers/proto/graphics_event_module.cc", |
| "importers/proto/graphics_event_module.h", |
| "importers/proto/graphics_frame_event_parser.cc", |
| "importers/proto/graphics_frame_event_parser.h", |
| "importers/proto/heap_graph_module.cc", |
| "importers/proto/heap_graph_module.h", |
| "importers/proto/heap_graph_tracker.cc", |
| "importers/proto/heap_graph_tracker.h", |
| "importers/proto/system_probes_module.cc", |
| "importers/proto/system_probes_module.h", |
| "importers/proto/system_probes_parser.cc", |
| "importers/proto/system_probes_parser.h", |
| "importers/proto/vulkan_memory_tracker.cc", |
| "importers/proto/vulkan_memory_tracker.h", |
| "importers/syscalls/syscall_tracker.cc", |
| "importers/syscalls/syscalls_aarch32.h", |
| "importers/syscalls/syscalls_aarch64.h", |
| "importers/syscalls/syscalls_armeabi.h", |
| "importers/syscalls/syscalls_x86.h", |
| "importers/syscalls/syscalls_x86_64.h", |
| "importers/systrace/systrace_line_parser.cc", |
| "importers/systrace/systrace_line_parser.h", |
| "importers/systrace/systrace_line_tokenizer.cc", |
| "importers/systrace/systrace_line_tokenizer.h", |
| "importers/systrace/systrace_parser.cc", |
| "importers/systrace/systrace_parser.h", |
| "importers/systrace/systrace_trace_parser.cc", |
| "importers/systrace/systrace_trace_parser.h", |
| ] |
| public_deps = [ ":storage_minimal" ] |
| deps = [ |
| ":ftrace_descriptors", |
| "../../include/perfetto/ext/base:base", |
| "../../include/perfetto/ext/traced:sys_stats_counters", |
| "../../protos/perfetto/common:zero", |
| "../../protos/perfetto/trace:zero", |
| "../../protos/perfetto/trace/android:zero", |
| "../../protos/perfetto/trace/gpu:zero", |
| "../../protos/perfetto/trace/interned_data:zero", |
| "../protozero", |
| "importers/common", |
| "storage", |
| "tables", |
| "types", |
| "util", |
| "util:gzip", |
| ] |
| 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 = [ |
| "dynamic/ancestor_generator.cc", |
| "dynamic/ancestor_generator.h", |
| "dynamic/connected_flow_generator.cc", |
| "dynamic/connected_flow_generator.h", |
| "dynamic/descendant_slice_generator.cc", |
| "dynamic/descendant_slice_generator.h", |
| "dynamic/describe_slice_generator.cc", |
| "dynamic/describe_slice_generator.h", |
| "dynamic/experimental_annotated_stack_generator.cc", |
| "dynamic/experimental_annotated_stack_generator.h", |
| "dynamic/experimental_counter_dur_generator.cc", |
| "dynamic/experimental_counter_dur_generator.h", |
| "dynamic/experimental_flamegraph_generator.cc", |
| "dynamic/experimental_flamegraph_generator.h", |
| "dynamic/experimental_sched_upid_generator.cc", |
| "dynamic/experimental_sched_upid_generator.h", |
| "dynamic/experimental_slice_layout_generator.cc", |
| "dynamic/experimental_slice_layout_generator.h", |
| "dynamic/thread_state_generator.cc", |
| "dynamic/thread_state_generator.h", |
| "iterator_impl.cc", |
| "iterator_impl.h", |
| "read_trace.cc", |
| "trace_processor.cc", |
| "trace_processor_impl.cc", |
| "trace_processor_impl.h", |
| ] |
| |
| deps = [ |
| ":export_json", |
| ":metatrace", |
| ":storage_full", |
| "../../gn:default_deps", |
| "../../protos/perfetto/trace/ftrace:zero", |
| "../base", |
| "../protozero", |
| "analysis", |
| "db", |
| "importers/common", |
| "metrics:lib", |
| "sqlite", |
| "storage", |
| "tables", |
| "types", |
| "util", |
| "util:gzip", |
| "util:protozero_to_text", |
| ] |
| 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", |
| "../../src/profiling:deobfuscator", |
| "../../src/profiling/symbolizer", |
| "../../src/profiling/symbolizer:symbolize_database", |
| "../base", |
| "metrics:lib", |
| "util", |
| ] |
| 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/sched_event_tracker_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/heap_graph_tracker_unittest.cc", |
| "importers/proto/heap_profile_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", |
| "trace_sorter_unittest.cc", |
| ] |
| deps = [ |
| ":gen_cc_test_messages_descriptor", |
| ":storage_full", |
| "../../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:unittests", |
| "db:unittests", |
| "importers/common", |
| "importers/common:unittests", |
| "importers/memory_tracker:graph_processor", |
| "rpc:unittests", |
| "storage", |
| "tables:unittests", |
| "types", |
| "types:unittests", |
| "util:descriptors", |
| "util:unittests", |
| ] |
| |
| if (enable_perfetto_trace_processor_sqlite) { |
| sources += [ |
| "dynamic/experimental_counter_dur_generator_unittest.cc", |
| "dynamic/experimental_slice_layout_generator_unittest.cc", |
| "dynamic/thread_state_generator_unittest.cc", |
| ] |
| deps += [ |
| ":lib", |
| "../../gn:sqlite", |
| "sqlite:unittests", |
| ] |
| } |
| |
| if (enable_perfetto_trace_processor_json) { |
| sources += [ |
| "importers/json/json_trace_tokenizer_unittest.cc", |
| "importers/json/json_tracker_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 = [ |
| ":storage_full", |
| "../../gn:default_deps", |
| "../base", |
| ] |
| } |