summaryrefslogtreecommitdiff
path: root/chromium/services/tracing/public/cpp/BUILD.gn
blob: d9c1ad668ad19cd22c3cb4d425c55742eba01c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromecast_build.gni")
import("//build/config/compiler/compiler.gni")

config("wrap_find_exidx") {
  ldflags = [ "-Wl,-wrap,dl_unwind_find_exidx" ]
}

source_set("traced_process") {
  sources = [
    "traced_process.cc",
    "traced_process.h",
  ]

  public_deps = [
    "//services/tracing/public/mojom",
  ]

  if (!is_nacl && !is_ios) {
    deps = [
      ":cpp",
    ]
  }
}

if (!is_nacl && !is_ios) {
  component("cpp") {
    sources = [
      "base_agent.cc",
      "base_agent.h",
      "perfetto/dummy_producer.cc",
      "perfetto/dummy_producer.h",
#      "perfetto/interning_index.h",
      "perfetto/perfetto_config.cc",
      "perfetto/perfetto_config.h",
      "perfetto/perfetto_producer.cc",
      "perfetto/perfetto_producer.h",
      "perfetto/perfetto_traced_process.cc",
      "perfetto/perfetto_traced_process.h",
      "perfetto/producer_client.cc",
      "perfetto/producer_client.h",
      "perfetto/shared_memory.cc",
      "perfetto/shared_memory.h",
      "perfetto/system_producer.cc",
      "perfetto/system_producer.h",
      "perfetto/task_runner.cc",
      "perfetto/task_runner.h",
      "perfetto/thread_local_event_sink.cc",
      "perfetto/thread_local_event_sink.h",
      "perfetto/trace_event_data_source.cc",
      "perfetto/trace_event_data_source.h",
      "perfetto/traced_value_proto_writer.cc",
      "perfetto/traced_value_proto_writer.h",
#      "perfetto/track_event_thread_local_event_sink.cc",
#      "perfetto/track_event_thread_local_event_sink.h",
#      "stack_sampling/tracing_sampler_profiler.cc",
#      "stack_sampling/tracing_sampler_profiler.h",
      "trace_event_agent.cc",
      "trace_event_agent.h",
      "trace_event_args_whitelist.cc",
      "trace_event_args_whitelist.h",
      "trace_startup.cc",
      "trace_startup.h",
      "traced_process_impl.cc",
      "traced_process_impl.h",
      "tracing_features.cc",
      "tracing_features.h",
    ]

    defines = [ "IS_TRACING_CPP_IMPL" ]
    output_name = "tracing_cpp"

    configs += [ "//build/config/compiler:wexit_time_destructors" ]

    public_deps = [
      "//base",
      "//components/tracing:startup_tracing",
      "//mojo/public/cpp/bindings",
      "//services/tracing/public/mojom",
      "//third_party/perfetto:libperfetto",
    ]

    deps = [
      "//third_party/perfetto/include/perfetto/protozero",
      "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite",
    ]

    # Add the SystemProducer implementations.
    if (is_android) {
      sources += [
        "perfetto/android_system_producer.cc",
        "perfetto/android_system_producer.h",
      ]
      deps += [ "//third_party/perfetto/src/tracing:ipc" ]
    }

    if (is_chromecast) {
      defines += [ "IS_CHROMECAST" ]
    }

    if (is_android && can_unwind_with_cfi_table && is_official_build) {
      sources += [
        "stack_sampling/stack_sampler_android.cc",
        "stack_sampling/stack_sampler_android.h",
        "stack_sampling/stack_unwinder_android.cc",
        "stack_sampling/stack_unwinder_android.h",
      ]
      deps += [ "//buildtools/third_party/libunwind" ]
      include_dirs = [ "//buildtools/third_party/libunwind/trunk/include" ]

      # stack_unwinder_android.cc overrides the dl_unwind_find_exidx function.
      all_dependent_configs = [ ":wrap_find_exidx" ]
    }
  }
}  # !is_nacl && !is_ios