xref: /aosp_15_r20/external/perfetto/src/traced/probes/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("../../../gn/perfetto.gni")
16import("../../../gn/test.gni")
17
18assert(enable_perfetto_traced_probes)
19
20# The unprivileged daemon that is allowed to access tracefs (for ftrace).
21# Registers as a Producer on the traced daemon.
22executable("traced_probes") {
23  deps = [
24    "../../../:libperfetto",
25    "../../../gn:default_deps",
26    "../../../include/perfetto/ext/traced",
27  ]
28  sources = [ "main.cc" ]
29  assert_no_deps = [ "../../../gn:protobuf_lite" ]
30}
31
32# Contains all the implementation but not the main() entry point. This target
33# is shared both by the executable and tests.
34source_set("probes") {
35  public_deps = [ "../../../include/perfetto/ext/traced" ]
36  deps = [
37    ":probes_src",
38    "../../../gn:default_deps",
39    "../../base:version",
40    "../../tracing/ipc/producer",
41  ]
42  sources = [ "probes.cc" ]
43}
44
45source_set("probes_src") {
46  public_deps = [
47    "ftrace",
48    "ftrace:ftrace_procfs",
49  ]
50  deps = [
51    ":data_source",
52    "../../../gn:default_deps",
53    "../../../include/perfetto/ext/traced",
54    "../../../protos/perfetto/config/ftrace:cpp",
55    "../../../protos/perfetto/trace:zero",
56    "../../../protos/perfetto/trace/ps:zero",
57    "../../../src/kernel_utils:syscall_table",
58    "../../android_stats",
59    "../../base",
60    "../../tracing/core",
61    "../../tracing/ipc/producer",
62    "android_game_intervention_list",
63    "android_log",
64    "android_system_property",
65    "common",
66    "filesystem",
67    "initial_display_state",
68    "metatrace",
69    "packages_list",
70    "power",
71    "ps",
72    "statsd_client",
73    "sys_stats",
74    "system_info",
75  ]
76  sources = [
77    "kmem_activity_trigger.cc",
78    "kmem_activity_trigger.h",
79    "probes_producer.cc",
80    "probes_producer.h",
81  ]
82}
83
84# Base class for data sources in traced_probes.
85# Needs to be a separate target to avoid cyclical deps.
86source_set("data_source") {
87  deps = [
88    "../../../gn:default_deps",
89    "../../tracing/core",
90  ]
91  sources = [
92    "probes_data_source.cc",
93    "probes_data_source.h",
94  ]
95}
96
97perfetto_unittest_source_set("unittests") {
98  testonly = true
99  deps = [
100    ":probes_src",
101    "../../../gn:default_deps",
102    "../../../gn:gtest_and_gmock",
103    "../../tracing/test:test_support",
104    "android_game_intervention_list:unittests",
105    "android_log:unittests",
106    "android_system_property:unittests",
107    "common:unittests",
108    "filesystem:unittests",
109    "ftrace:unittests",
110    "initial_display_state:unittests",
111    "packages_list:unittests",
112    "power:unittests",
113    "ps:unittests",
114    "statsd_client:unittests",
115    "sys_stats:unittests",
116    "system_info:unittests",
117  ]
118}
119