blob: cc9c08766c652a45b4f955169e03a526d6b43f15 [file] [log] [blame]
# 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_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
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("descriptors") {
sources = [
"descriptors.cc",
"descriptors.h",
]
deps = [
"../../gn:default_deps",
"../../include/perfetto/trace_processor",
"../../protos/perfetto/common:zero",
"../base",
"../protozero:protozero",
]
}
source_set("storage") {
sources = [
"args_tracker.cc",
"args_tracker.h",
"binder_tracker.cc",
"binder_tracker.h",
"chunked_trace_reader.h",
"clock_tracker.cc",
"clock_tracker.h",
"event_tracker.cc",
"event_tracker.h",
"forwarding_trace_parser.cc",
"forwarding_trace_parser.h",
"ftrace_utils.h",
"gzip_trace_parser.cc",
"gzip_trace_parser.h",
"heap_profile_tracker.cc",
"heap_profile_tracker.h",
"importers/ftrace/ftrace_descriptors.h",
"importers/ftrace/ftrace_module.h",
"importers/ftrace/ftrace_parser.h",
"importers/ftrace/ftrace_tokenizer.h",
"importers/ftrace/sched_event_tracker.h",
"importers/fuchsia/fuchsia_provider_view.h",
"importers/proto/android_probes_module.h",
"importers/proto/android_probes_parser.h",
"importers/proto/args_table_utils.cc",
"importers/proto/args_table_utils.h",
"importers/proto/chrome_compositor_scheduler_state.descriptor.h",
"importers/proto/graphics_event_module.h",
"importers/proto/graphics_event_parser.h",
"importers/proto/heap_graph_module.h",
"importers/proto/heap_graph_tracker.h",
"importers/proto/heap_graph_walker.h",
"importers/proto/packet_sequence_state.h",
"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_tokenizer.cc",
"importers/proto/proto_trace_tokenizer.h",
"importers/proto/system_probes_module.h",
"importers/proto/system_probes_parser.h",
"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/systrace/systrace_parser.h",
"importers/systrace/systrace_trace_parser.h",
"metadata.h",
"process_tracker.cc",
"process_tracker.h",
"slice_tracker.cc",
"slice_tracker.h",
"stack_profile_tracker.cc",
"stack_profile_tracker.h",
"stats.h",
"syscall_tracker.h",
"timestamped_trace_piece.h",
"trace_blob_view.h",
"trace_parser.h",
"trace_processor_context.cc",
"trace_processor_context.h",
"trace_processor_storage.cc",
"trace_processor_storage_impl.cc",
"trace_processor_storage_impl.h",
"trace_sorter.cc",
"trace_sorter.h",
"trace_storage.cc",
"trace_storage.h",
"track_tracker.cc",
"track_tracker.h",
"variadic.h",
"virtual_destructors.cc",
"vulkan_memory_tracker.h",
]
deps = [
":common",
":descriptors",
"../../gn:default_deps",
"../../gn:zlib",
"../../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/gpu: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/track_event:zero",
"../base",
"../protozero",
"tables",
]
public_deps = [
"../../include/perfetto/trace_processor:storage",
]
if (enable_perfetto_trace_processor_json_import) {
sources += [
"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_trace_utils.cc",
"importers/json/json_trace_utils.h",
]
deps += [ "../../gn:jsoncpp" ]
}
if (enable_perfetto_trace_processor_ftrace) {
sources += [
"importers/ftrace/ftrace_descriptors.cc",
"importers/ftrace/ftrace_parser.cc",
"importers/ftrace/ftrace_tokenizer.cc",
"importers/ftrace/sched_event_tracker.cc",
"importers/systrace/systrace_parser.cc",
"importers/systrace/systrace_trace_parser.cc",
]
}
if (enable_perfetto_trace_processor_ftrace ||
enable_perfetto_trace_processor_fuchsia) {
sources += [ "ftrace_utils.cc" ]
}
if (enable_perfetto_trace_processor_system_probes) {
sources += [ "importers/proto/system_probes_parser.cc" ]
deps += [ "../../include/perfetto/ext/traced:sys_stats_counters" ]
}
if (enable_perfetto_trace_processor_android_probes) {
sources += [ "importers/proto/android_probes_parser.cc" ]
}
if (enable_perfetto_trace_processor_heap_graphs) {
sources += [
"importers/proto/heap_graph_module.cc",
"importers/proto/heap_graph_tracker.cc",
"importers/proto/heap_graph_walker.cc",
]
}
if (enable_perfetto_trace_processor_graphics) {
sources += [
"importers/proto/graphics_event_parser.cc",
"vulkan_memory_tracker.cc",
]
}
if (enable_perfetto_trace_processor_fuchsia) {
sources += [
"importers/fuchsia/fuchsia_provider_view.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/fuchsia/fuchsia_trace_utils.h",
]
}
if (enable_perfetto_trace_processor_syscalls) {
sources += [
"syscall_tracker.cc",
"syscalls_aarch32.h",
"syscalls_aarch64.h",
"syscalls_armeabi.h",
"syscalls_x86_64.h",
]
}
}
if (enable_perfetto_trace_processor_json) {
source_set("export_json") {
sources = [
"export_json.cc",
"export_json.h",
]
deps = [
":storage",
"../../gn:default_deps",
"../../gn:jsoncpp",
"../base",
]
public_deps = [
"../../include/perfetto/ext/trace_processor:export_json",
]
}
}
if (enable_perfetto_trace_processor_sqlite) {
source_set("lib") {
sources = [
"android_logs_table.cc",
"android_logs_table.h",
"args_table.cc",
"args_table.h",
"counter_values_table.cc",
"counter_values_table.h",
"cpu_profile_stack_sample_table.cc",
"cpu_profile_stack_sample_table.h",
"filtered_row_index.cc",
"filtered_row_index.h",
"gfp_flags.cc",
"gfp_flags.h",
"heap_profile_allocation_table.cc",
"heap_profile_allocation_table.h",
"instants_table.cc",
"instants_table.h",
"metadata_table.cc",
"metadata_table.h",
"process_table.cc",
"process_table.h",
"raw_table.cc",
"raw_table.h",
"read_trace.cc",
"row_iterators.cc",
"row_iterators.h",
"sched_slice_table.h",
"slice_table.cc",
"slice_table.h",
"span_join_operator_table.cc",
"span_join_operator_table.h",
"sql_stats_table.cc",
"sql_stats_table.h",
"stack_profile_frame_table.cc",
"stack_profile_frame_table.h",
"stack_profile_mapping_table.cc",
"stack_profile_mapping_table.h",
"stats_table.cc",
"stats_table.h",
"storage_columns.cc",
"storage_columns.h",
"storage_schema.cc",
"storage_schema.h",
"storage_table.cc",
"storage_table.h",
"thread_table.cc",
"thread_table.h",
"trace_processor.cc",
"trace_processor_impl.cc",
"trace_processor_impl.h",
"window_operator_table.cc",
"window_operator_table.h",
]
deps = [
":common",
":storage",
"../../gn:default_deps",
"../../gn:sqlite",
"../../protos/perfetto/trace/ftrace:zero",
"../base",
"db:lib",
"sqlite",
"tables",
]
public_deps = [
"../../include/perfetto/trace_processor",
]
if (enable_perfetto_trace_processor_ftrace) {
sources += [ "sched_slice_table.cc" ]
}
if (enable_perfetto_trace_processor_metrics) {
deps += [
"../../protos/perfetto/metrics:zero",
"../../protos/perfetto/metrics/android:zero",
"metrics:lib",
]
}
if (enable_perfetto_trace_processor_json) {
deps += [ ":export_json" ]
}
}
}
# TODO(lalitm): we need to find a better home for the classes here.
source_set("common") {
sources = [
"null_term_string_view.h",
"string_pool.cc",
"string_pool.h",
]
deps = [
"../../gn:default_deps",
"../base",
"../protozero",
]
}
if (enable_perfetto_trace_processor_metrics) { # shell requires metrics.
perfetto_host_executable("trace_processor_shell") {
deps = [
":lib",
"../../gn:default_deps",
"../../gn:protoc_lib",
"../base",
"metrics:lib",
]
if (enable_perfetto_version_gen) {
deps += [ "../../gn/standalone:gen_git_revision" ]
}
if (enable_perfetto_trace_processor_linenoise) {
deps += [ "../../gn:linenoise" ]
}
if (enable_perfetto_trace_processor_httpd) {
deps += [ "rpc:httpd" ]
}
sources = [
"proto_to_json.cc",
"proto_to_json.h",
"trace_processor_shell.cc",
]
}
}
perfetto_unittest_source_set("unittests") {
testonly = true
sources = [
"basic_types_unittest.cc",
"clock_tracker_unittest.cc",
"event_tracker_unittest.cc",
"forwarding_trace_parser_unittest.cc",
"heap_profile_tracker_unittest.cc",
"importers/proto/args_table_utils_unittest.cc",
"importers/proto/proto_trace_parser_unittest.cc",
"importers/systrace/systrace_parser_unittest.cc",
"null_term_string_view_unittest.cc",
"process_tracker_unittest.cc",
"slice_tracker_unittest.cc",
"string_pool_unittest.cc",
"trace_sorter_unittest.cc",
]
deps = [
":common",
":descriptors",
":storage",
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
"../../protos/perfetto/common:zero",
"../../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:zero",
"../../protos/perfetto/trace/ps:zero",
"../../protos/perfetto/trace/sys_stats:zero",
"../../protos/perfetto/trace/track_event:zero",
"../base",
"../protozero",
"../protozero:testing_messages_zero",
"db:unittests",
"tables:unittests",
]
if (enable_perfetto_trace_processor_sqlite) {
sources += [
"args_table_unittest.cc",
"filtered_row_index_unittest.cc",
"metadata_table_unittest.cc",
"process_table_unittest.cc",
"span_join_operator_table_unittest.cc",
]
deps += [
":lib",
"../../gn:sqlite",
"sqlite",
"sqlite:unittests",
]
}
if (enable_perfetto_trace_processor_json) {
if (enable_perfetto_trace_processor_json_import) {
sources += [
"importers/json/json_trace_tokenizer_unittest.cc",
"importers/json/json_trace_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",
"../../gn:jsoncpp",
"../../include/perfetto/ext/trace_processor:export_json",
]
}
}
if (enable_perfetto_trace_processor_ftrace) {
sources += [
"ftrace_utils_unittest.cc",
"sched_slice_table_unittest.cc",
"thread_table_unittest.cc",
]
}
if (enable_perfetto_trace_processor_heap_graphs) {
sources += [ "importers/proto/heap_graph_walker_unittest.cc" ]
}
if (enable_perfetto_trace_processor_fuchsia) {
sources += [ "importers/fuchsia/fuchsia_trace_utils_unittest.cc" ]
}
if (enable_perfetto_trace_processor_syscalls) {
sources += [ "syscall_tracker_unittest.cc" ]
}
}
source_set("integrationtests") {
testonly = true
sources = []
deps = []
if (enable_perfetto_trace_processor_sqlite) {
sources += [ "trace_database_integrationtest.cc" ]
deps += [
":lib",
":storage",
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
"../../protos/perfetto/trace:lite",
"../base",
"../base:test_support",
"sqlite",
]
if (enable_perfetto_trace_processor_json_import) {
deps += [ "../../gn:jsoncpp" ]
}
}
}
perfetto_fuzzer_test("trace_processor_fuzzer") {
testonly = true
sources = [
"trace_parsing_fuzzer.cc",
]
deps = [
":storage",
"../../gn:default_deps",
"../base",
]
}