| # Copyright 2018 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/buildflag_header.gni") |
| import("//build/config/cast.gni") |
| import("//build/config/compiler/compiler.gni") |
| import("//build/config/features.gni") |
| import("//build_overrides/build.gni") |
| import("//services/tracing/public/cpp/stack_sampling/loader_lock_sampling.gni") |
| |
| buildflag_header("buildflags") { |
| header = "buildflags.h" |
| flags = [ "ENABLE_LOADER_LOCK_SAMPLING=$enable_loader_lock_sampling" ] |
| } |
| |
| source_set("traced_process") { |
| sources = [ |
| "traced_process.cc", |
| "traced_process.h", |
| ] |
| |
| public_deps = [ "//services/tracing/public/mojom" ] |
| |
| deps = [ |
| ":cpp", |
| "//build:blink_buildflags", |
| ] |
| } |
| |
| # On iOS we don't support tracing so we only include the minimum needed |
| # to support a fake typed TRACE_EVENT macro. However this means we don't have |
| # any .cc files and thus on iOS it needs to be a source_set and not a |
| # component. |tracing_lib_type| decides which version to build. |
| if (use_blink) { |
| tracing_lib_type = "component" |
| } else { |
| tracing_lib_type = "source_set" |
| } |
| |
| target(tracing_lib_type, "cpp") { |
| sources = [ |
| "perfetto/flow_event_utils.cc", |
| "perfetto/flow_event_utils.h", |
| "perfetto/macros.h", |
| ] |
| |
| defines = [ "IS_TRACING_CPP_IMPL" ] |
| output_name = "tracing_cpp" |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| |
| public_deps = [ "//base" ] |
| |
| deps = [ "//third_party/perfetto/include/perfetto/protozero" ] |
| |
| all_dependent_configs = [] |
| |
| if (use_blink) { |
| sources += [ |
| "perfetto/custom_event_recorder.cc", |
| "perfetto/custom_event_recorder.h", |
| "perfetto/histogram_samples_data_source.cc", |
| "perfetto/histogram_samples_data_source.h", |
| "perfetto/interning_index.h", |
| "perfetto/metadata_data_source.cc", |
| "perfetto/metadata_data_source.h", |
| "perfetto/perfetto_config.cc", |
| "perfetto/perfetto_config.h", |
| "perfetto/perfetto_session.cc", |
| "perfetto/perfetto_session.h", |
| "perfetto/perfetto_traced_process.cc", |
| "perfetto/perfetto_traced_process.h", |
| "perfetto/perfetto_tracing_backend.cc", |
| "perfetto/perfetto_tracing_backend.h", |
| "perfetto/shared_memory.cc", |
| "perfetto/shared_memory.h", |
| "perfetto/system_trace_writer.h", |
| "perfetto/trace_packet_tokenizer.cc", |
| "perfetto/trace_packet_tokenizer.h", |
| "perfetto/trace_string_lookup.cc", |
| "perfetto/trace_string_lookup.h", |
| "perfetto/traced_value_proto_writer.cc", |
| "perfetto/traced_value_proto_writer.h", |
| "perfetto/track_name_recorder.cc", |
| "perfetto/track_name_recorder.h", |
| "stack_sampling/tracing_sampler_profiler.cc", |
| "stack_sampling/tracing_sampler_profiler.h", |
| "system_metrics_sampler.cc", |
| "system_metrics_sampler.h", |
| "trace_event_args_allowlist.cc", |
| "trace_event_args_allowlist.h", |
| "trace_startup.cc", |
| "trace_startup.h", |
| "trace_startup_config.cc", |
| "trace_startup_config.h", |
| "traced_process_impl.cc", |
| "traced_process_impl.h", |
| "tracing_features.cc", |
| "tracing_features.h", |
| ] |
| |
| if (is_android) { |
| sources += [ |
| "perfetto/java_heap_profiler/hprof_buffer_android.cc", |
| "perfetto/java_heap_profiler/hprof_buffer_android.h", |
| "perfetto/java_heap_profiler/hprof_data_type_android.h", |
| "perfetto/java_heap_profiler/hprof_instances_android.cc", |
| "perfetto/java_heap_profiler/hprof_instances_android.h", |
| "perfetto/java_heap_profiler/hprof_parser_android.cc", |
| "perfetto/java_heap_profiler/hprof_parser_android.h", |
| "perfetto/java_heap_profiler/java_heap_profiler_android.cc", |
| "perfetto/java_heap_profiler/java_heap_profiler_android.h", |
| ] |
| } |
| |
| if (is_win && enable_loader_lock_sampling) { |
| sources += [ |
| "stack_sampling/loader_lock_sampler_win.cc", |
| "stack_sampling/loader_lock_sampler_win.h", |
| "stack_sampling/loader_lock_sampling_thread_win.cc", |
| "stack_sampling/loader_lock_sampling_thread_win.h", |
| ] |
| |
| # For LdrLockLoaderLock & LdrUnLockLoaderLock |
| libs = [ "ntdll.lib" ] |
| } |
| |
| public_deps += [ |
| "//components/tracing:tracing_config", |
| "//mojo/public/cpp/bindings", |
| "//services/tracing/public/mojom", |
| ] |
| |
| deps += [ |
| ":buildflags", |
| "//base/tracing/protos:chrome_track_event_zero", |
| "//build:chromecast_buildflags", |
| "//components/system_cpu", |
| "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", |
| "//third_party/snappy", |
| ] |
| |
| if (is_win) { |
| deps += [ "//components/tracing:tracing_etw" ] |
| } |
| |
| if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { |
| deps += [ "//components/variations" ] |
| } |
| |
| # Add the SystemProducer implementations. |
| if (is_posix || is_fuchsia) { |
| deps += [ "//third_party/perfetto/include/perfetto/ext/ipc" ] |
| |
| if (is_fuchsia) { |
| sources += [ |
| "perfetto/fuchsia_perfetto_producer_connector.cc", |
| "perfetto/fuchsia_perfetto_producer_connector.h", |
| ] |
| |
| deps += [ |
| "//third_party/fuchsia-sdk/sdk/pkg/component_incoming_cpp", |
| "//third_party/fuchsia-sdk/sdk/pkg/fidl_cpp_base", |
| "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", |
| ] |
| public_deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.tracing.perfetto:fuchsia.tracing.perfetto_cpp" ] |
| } else if (!is_android) { |
| sources += [ |
| "system_tracing_service.cc", |
| "system_tracing_service.h", |
| ] |
| } |
| } |
| |
| if (is_chromeos) { |
| deps += [ "//chromeos/dbus/constants" ] |
| } |
| } # !is_ios |
| } |