blob: 7ee502dad1ce164f7ab62e64ea9ff064753a2772 [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("track_event_descriptor") {
sources = [ "importers/proto/track_event.descriptor.h" ]
}
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("protozero_to_text") {
sources = [
"util/protozero_to_text.cc",
"util/protozero_to_text.h",
]
deps = [
":descriptors",
":track_event_descriptor",
"../../gn:default_deps",
"../../protos/perfetto/common:zero",
"../../protos/perfetto/trace/track_event:zero",
"../base",
"../protozero",
]
}
source_set("descriptors") {
sources = [
"util/descriptors.cc",
"util/descriptors.h",
]
deps = [
"../../gn:default_deps",
"../../include/perfetto/trace_processor",
"../../protos/perfetto/common:zero",
"../base",
"../protozero",
]
}
source_set("storage_minimal") {
sources = [
"chunked_trace_reader.h",
"default_modules.cc",
"default_modules.h",
"forwarding_trace_parser.cc",
"forwarding_trace_parser.h",
"importers/common/args_tracker.cc",
"importers/common/args_tracker.h",
"importers/common/clock_tracker.cc",
"importers/common/clock_tracker.h",
"importers/common/event_tracker.cc",
"importers/common/event_tracker.h",
"importers/common/global_args_tracker.cc",
"importers/common/global_args_tracker.h",
"importers/common/process_tracker.cc",
"importers/common/process_tracker.h",
"importers/common/slice_tracker.cc",
"importers/common/slice_tracker.h",
"importers/common/track_tracker.cc",
"importers/common/track_tracker.h",
"importers/ftrace/ftrace_module.cc",
"importers/ftrace/ftrace_module.h",
"importers/fuchsia/fuchsia_record.h",
"importers/fuchsia/fuchsia_trace_utils.h",
"importers/gzip/gzip_utils.cc",
"importers/gzip/gzip_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/args_table_utils.cc",
"importers/proto/args_table_utils.h",
"importers/proto/heap_profile_tracker.cc",
"importers/proto/heap_profile_tracker.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/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_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/syscalls/syscall_tracker.h",
"importers/systrace/systrace_line.h",
"timestamped_trace_piece.h",
"trace_blob_view.h",
"trace_parser.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",
"util/status_macros.h",
"virtual_destructors.cc",
]
deps = [
":descriptors",
":track_event_descriptor",
"../../gn:default_deps",
"../base",
"../protozero",
"containers",
"storage",
"tables",
"types",
]
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/track_event:zero",
]
# json_utils optionally depends on jsoncpp.
if (enable_perfetto_trace_processor_json) {
deps += [ "../../gn:jsoncpp" ]
}
# gzip_utils optionally depends on zlib.
if (enable_perfetto_zlib) {
deps += [ "../../gn:zlib" ]
}
}
source_set("storage_full") {
sources = [
"additional_modules.cc",
"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/graphics_event_module.cc",
"importers/proto/graphics_event_module.h",
"importers/proto/graphics_event_parser.cc",
"importers/proto/graphics_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/heap_graph_walker.cc",
"importers/proto/heap_graph_walker.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",
"storage",
"types",
]
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/describe_slice_generator.cc",
"dynamic/describe_slice_generator.h",
"dynamic/experimental_counter_dur_generator.cc",
"dynamic/experimental_counter_dur_generator.h",
"dynamic/experimental_flamegraph_generator.cc",
"dynamic/experimental_flamegraph_generator.h",
"read_trace.cc",
"trace_processor.cc",
"trace_processor_impl.cc",
"trace_processor_impl.h",
]
deps = [
":export_json",
":storage_full",
"../../gn:default_deps",
"../../gn:sqlite",
"../../protos/perfetto/metrics:zero",
"../../protos/perfetto/metrics/android:zero",
"../../protos/perfetto/trace/ftrace:zero",
"../base",
"analysis",
"db:lib",
"metrics:lib",
"sqlite",
"storage",
"tables",
"types",
]
public_deps = [ "../../include/perfetto/trace_processor" ]
if (enable_perfetto_trace_processor_json) {
deps += [ "../../gn:jsoncpp" ]
}
}
perfetto_host_executable("trace_processor_shell") {
deps = [
":lib",
"../../gn:default_deps",
"../../gn:protoc_lib",
"../../src/profiling/symbolizer",
"../../src/profiling/symbolizer:symbolize_database",
"../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 = [
"trace_processor_shell.cc",
"util/proto_to_json.cc",
"util/proto_to_json.h",
]
}
} # if (enable_perfetto_trace_processor_sqlite)
perfetto_unittest_source_set("unittests") {
testonly = true
sources = [
"forwarding_trace_parser_unittest.cc",
"importers/common/clock_tracker_unittest.cc",
"importers/common/event_tracker_unittest.cc",
"importers/common/process_tracker_unittest.cc",
"importers/common/slice_tracker_unittest.cc",
"importers/fuchsia/fuchsia_trace_utils_unittest.cc",
"importers/proto/args_table_utils_unittest.cc",
"importers/proto/heap_graph_tracker_unittest.cc",
"importers/proto/heap_graph_walker_unittest.cc",
"importers/proto/heap_profile_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",
"util/protozero_to_text_unittests.cc",
]
deps = [
":descriptors",
":protozero_to_text",
":storage_full",
"../../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",
"containers:unittests",
"db:unittests",
"storage",
"tables:unittests",
"types",
"types:unittests",
]
if (enable_perfetto_trace_processor_sqlite) {
sources += [ "dynamic/experimental_counter_dur_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",
]
}
}
}
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/trace: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",
]
}