blob: c4cdecb282e42ce8a1496c0f12a13d8b2339648b [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.
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("lib") {
sources = [
"android_logs_table.cc",
"android_logs_table.h",
"args_table.cc",
"args_table.h",
"args_tracker.cc",
"args_tracker.h",
"binder_tracker.cc",
"binder_tracker.h",
"chunked_trace_reader.h",
"clock_tracker.cc",
"clock_tracker.h",
"counter_definitions_table.cc",
"counter_definitions_table.h",
"counter_values_table.cc",
"counter_values_table.h",
"cpu_profile_stack_sample_table.cc",
"cpu_profile_stack_sample_table.h",
"event_tracker.cc",
"event_tracker.h",
"filtered_row_index.cc",
"filtered_row_index.h",
"forwarding_trace_parser.cc",
"forwarding_trace_parser.h",
"ftrace_utils.h",
"gzip_trace_parser.cc",
"gzip_trace_parser.h",
"heap_graph_tracker.cc",
"heap_graph_tracker.h",
"heap_profile_allocation_table.cc",
"heap_profile_allocation_table.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/graphics_event_module.h",
"importers/proto/graphics_event_parser.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",
"instants_table.cc",
"instants_table.h",
"metadata.h",
"metadata_table.cc",
"metadata_table.h",
"process_table.cc",
"process_table.h",
"process_tracker.cc",
"process_tracker.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",
"slice_tracker.cc",
"slice_tracker.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",
"stack_profile_tracker.cc",
"stack_profile_tracker.h",
"stats.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",
"syscall_tracker.cc",
"syscall_tracker.h",
"syscalls_aarch32.h",
"syscalls_aarch64.h",
"syscalls_armeabi.h",
"syscalls_x86_64.h",
"thread_table.cc",
"thread_table.h",
"timestamped_trace_piece.h",
"trace_blob_view.h",
"trace_parser.h",
"trace_processor.cc",
"trace_processor_context.cc",
"trace_processor_context.h",
"trace_processor_impl.cc",
"trace_processor_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.cc",
"vulkan_memory_tracker.h",
"window_operator_table.cc",
"window_operator_table.h",
]
deps = [
":common",
"../../gn:default_deps",
"../../gn:sqlite",
"../../gn:zlib",
"../../include/perfetto/ext/trace_processor:export_json",
"../../include/perfetto/ext/traced:sys_stats_counters",
"../../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",
"db:lib",
"sqlite",
"tables",
]
public_deps = [
"../../include/perfetto/trace_processor",
]
if (enable_perfetto_trace_processor_json) {
sources += [
"export_json.cc",
"export_json.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_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",
"sched_slice_table.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" ]
}
if (enable_perfetto_trace_processor_android_probes) {
sources += [ "importers/proto/android_probes_parser.cc" ]
}
if (enable_perfetto_trace_processor_graphics) {
sources += [ "importers/proto/graphics_event_parser.cc" ]
}
if (enable_perfetto_trace_processor_metrics) {
deps += [
"../../protos/perfetto/metrics:zero",
"../../protos/perfetto/metrics/android:zero",
"metrics:lib",
]
}
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",
]
}
}
# 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 = [
"args_table_unittest.cc",
"clock_tracker_unittest.cc",
"event_tracker_unittest.cc",
"filtered_row_index_unittest.cc",
"forwarding_trace_parser_unittest.cc",
"heap_profile_tracker_unittest.cc",
"importers/proto/proto_trace_parser_unittest.cc",
"importers/systrace/systrace_parser_unittest.cc",
"metadata_table_unittest.cc",
"null_term_string_view_unittest.cc",
"process_table_unittest.cc",
"process_tracker_unittest.cc",
"slice_tracker_unittest.cc",
"span_join_operator_table_unittest.cc",
"string_pool_unittest.cc",
"syscall_tracker_unittest.cc",
"trace_sorter_unittest.cc",
]
deps = [
":common",
":lib",
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
"../../gn:sqlite",
"../../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",
"db:unittests",
"sqlite",
"sqlite:unittests",
"tables:unittests",
]
if (enable_perfetto_trace_processor_json) {
sources += [
"importers/json/json_trace_tokenizer_unittest.cc",
"importers/json/json_trace_utils_unittest.cc",
]
if (!is_win) {
# export_json_unittest.cc uses base::TempFile, which is not supported on
# windows.
sources += [ "export_json_unittest.cc" ]
deps += [ "../../include/perfetto/ext/trace_processor:export_json" ]
}
deps += [ "../../gn:jsoncpp" ]
}
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_fuchsia) {
sources += [ "importers/fuchsia/fuchsia_trace_utils_unittest.cc" ]
}
}
source_set("integrationtests") {
testonly = true
sources = [
"trace_database_integrationtest.cc",
]
deps = [
":lib",
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
"../../protos/perfetto/trace:lite",
"../base",
"../base:test_support",
"sqlite",
]
if (enable_perfetto_trace_processor_json) {
deps += [ "../../gn:jsoncpp" ]
}
}
perfetto_fuzzer_test("trace_processor_fuzzer") {
testonly = true
sources = [
"trace_parsing_fuzzer.cc",
]
deps = [
":lib",
"../../gn:default_deps",
"../base",
]
}