• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package perfetto.protos;
20
21import "protos/perfetto/config/android/android_game_intervention_list_config.proto";
22import "protos/perfetto/config/android/android_input_event_config.proto";
23import "protos/perfetto/config/android/android_log_config.proto";
24import "protos/perfetto/config/android/android_polled_state_config.proto";
25import "protos/perfetto/config/android/android_system_property_config.proto";
26import "protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto";
27import "protos/perfetto/config/android/network_trace_config.proto";
28import "protos/perfetto/config/android/packages_list_config.proto";
29import "protos/perfetto/config/android/pixel_modem_config.proto";
30import "protos/perfetto/config/android/protolog_config.proto";
31import "protos/perfetto/config/android/surfaceflinger_layers_config.proto";
32import "protos/perfetto/config/android/surfaceflinger_transactions_config.proto";
33import "protos/perfetto/config/chrome/chrome_config.proto";
34import "protos/perfetto/config/chrome/v8_config.proto";
35import "protos/perfetto/config/etw/etw_config.proto";
36import "protos/perfetto/config/ftrace/ftrace_config.proto";
37import "protos/perfetto/config/gpu/gpu_counter_config.proto";
38import "protos/perfetto/config/gpu/vulkan_memory_config.proto";
39import "protos/perfetto/config/inode_file/inode_file_config.proto";
40import "protos/perfetto/config/interceptor_config.proto";
41import "protos/perfetto/config/power/android_power_config.proto";
42import "protos/perfetto/config/statsd/statsd_tracing_config.proto";
43import "protos/perfetto/config/process_stats/process_stats_config.proto";
44import "protos/perfetto/config/profiling/heapprofd_config.proto";
45import "protos/perfetto/config/profiling/java_hprof_config.proto";
46import "protos/perfetto/config/profiling/perf_event_config.proto";
47import "protos/perfetto/config/sys_stats/sys_stats_config.proto";
48import "protos/perfetto/config/test_config.proto";
49import "protos/perfetto/config/track_event/track_event_config.proto";
50import "protos/perfetto/config/system_info/system_info.proto";
51
52// The configuration that is passed to each data source when starting tracing.
53// Next id: 130
54message DataSourceConfig {
55  enum SessionInitiator {
56    SESSION_INITIATOR_UNSPECIFIED = 0;
57    // This trace was initiated from a trusted system app has DUMP and
58    // USAGE_STATS permission. This system app is expected to not expose the
59    // trace to the user of the device.
60    // This is determined by checking the UID initiating the trace.
61    SESSION_INITIATOR_TRUSTED_SYSTEM = 1;
62  };
63  // Data source unique name, e.g., "linux.ftrace". This must match
64  // the name passed by the data source when it registers (see
65  // RegisterDataSource()).
66  optional string name = 1;
67
68  // The index of the logging buffer where TracePacket(s) will be stored.
69  // This field doesn't make a major difference for the Producer(s). The final
70  // logging buffers, in fact, are completely owned by the Service. We just ask
71  // the Producer to copy this number into the chunk headers it emits, so that
72  // the Service can quickly identify the buffer where to move the chunks into
73  // without expensive lookups on its fastpath.
74  optional uint32 target_buffer = 2;
75
76  // Set by the service to indicate the duration of the trace.
77  // DO NOT SET in consumer as this will be overridden by the service.
78  optional uint32 trace_duration_ms = 3;
79
80  // If true, |trace_duration_ms| should count also time in suspend. This
81  // is propagated from TraceConfig.prefer_suspend_clock_for_duration.
82  optional bool prefer_suspend_clock_for_duration = 122;
83
84  // Set by the service to indicate how long it waits after StopDataSource.
85  // DO NOT SET in consumer as this will be overridden by the service.
86  optional uint32 stop_timeout_ms = 7;
87
88  // Set by the service to indicate whether this tracing session has extra
89  // guardrails.
90  // DO NOT SET in consumer as this will be overridden by the service.
91  optional bool enable_extra_guardrails = 6;
92
93  // Set by the service to indicate which user initiated this trace.
94  // DO NOT SET in consumer as this will be overridden by the service.
95  optional SessionInitiator session_initiator = 8;
96
97  // Set by the service to indicate which tracing session the data source
98  // belongs to. The intended use case for this is checking if two data sources,
99  // one of which produces metadata for the other one, belong to the same trace
100  // session and hence should be linked together.
101  // This field was introduced in Aug 2018 after Android P.
102  // DO NOT SET in consumer as this will be overridden by the service.
103  optional uint64 tracing_session_id = 4;
104
105  // Keeep the lower IDs (up to 99) for fields that are *not* specific to
106  // data-sources and needs to be processed by the traced daemon.
107
108  // All data source config fields must be marked as [lazy=true]. This prevents
109  // the proto-to-cpp generator from recursing into those when generating the
110  // cpp classes and polluting tracing/core with data-source-specific classes.
111  // Instead they are treated as opaque strings containing raw proto bytes.
112
113  // Data source name: linux.ftrace
114  optional FtraceConfig ftrace_config = 100 [lazy = true];
115  // Data source name: linux.inode_file_map
116  optional InodeFileConfig inode_file_config = 102 [lazy = true];
117  // Data source name: linux.process_stats
118  optional ProcessStatsConfig process_stats_config = 103 [lazy = true];
119  // Data source name: linux.sys_stats
120  optional SysStatsConfig sys_stats_config = 104 [lazy = true];
121  // Data source name: android.heapprofd
122  // Introduced in Android 10.
123  optional HeapprofdConfig heapprofd_config = 105 [lazy = true];
124  // Data source name: android.java_hprof
125  // Introduced in Android 11.
126  optional JavaHprofConfig java_hprof_config = 110 [lazy = true];
127  // Data source name: android.power
128  optional AndroidPowerConfig android_power_config = 106 [lazy = true];
129  // Data source name: android.log
130  optional AndroidLogConfig android_log_config = 107 [lazy = true];
131  // TODO(fmayer): Add data source name for this.
132  optional GpuCounterConfig gpu_counter_config = 108 [lazy = true];
133  // Data source name: android.game_interventions
134  optional AndroidGameInterventionListConfig
135      android_game_intervention_list_config = 116 [lazy = true];
136  // Data source name: android.packages_list
137  optional PackagesListConfig packages_list_config = 109 [lazy = true];
138  // Data source name: linux.perf
139  optional PerfEventConfig perf_event_config = 111 [lazy = true];
140  // Data source name: vulkan.memory_tracker
141  optional VulkanMemoryConfig vulkan_memory_config = 112 [lazy = true];
142  // Data source name: track_event
143  optional TrackEventConfig track_event_config = 113 [lazy = true];
144  // Data source name: android.polled_state
145  optional AndroidPolledStateConfig android_polled_state_config = 114
146      [lazy = true];
147  // Data source name: android.system_property
148  optional AndroidSystemPropertyConfig android_system_property_config = 118
149      [lazy = true];
150  // Data source name: android.statsd
151  optional StatsdTracingConfig statsd_tracing_config = 117 [lazy = true];
152  // Data source name: linux.system_info
153  optional SystemInfoConfig system_info_config = 119;
154
155  // Chrome is special as it doesn't use the perfetto IPC layer. We want to
156  // avoid proto serialization and de-serialization there because that would
157  // just add extra hops on top of the Mojo ser/des. Instead we auto-generate a
158  // C++ class for it so it can pass around plain C++ objets.
159  optional ChromeConfig chrome_config = 101;
160
161  // Data source name: code.v8.dev
162  optional V8Config v8_config = 127 [lazy = true];
163
164  // If an interceptor is specified here, packets for this data source will be
165  // rerouted to the interceptor instead of the main trace buffer. This can be
166  // used, for example, to write trace data into ETW or for logging trace points
167  // to the console.
168  //
169  // Note that interceptors are only supported by data sources registered
170  // through the Perfetto SDK API. Data sources that don't use that API (e.g.,
171  // traced_probes) may not support interception.
172  optional InterceptorConfig interceptor_config = 115;
173
174  // Data source name: android.network_packets.
175  // Introduced in Android 14 (U).
176  optional NetworkPacketTraceConfig network_packet_trace_config = 120
177      [lazy = true];
178
179  // Data source name: android.surfaceflinger.layers
180  optional SurfaceFlingerLayersConfig surfaceflinger_layers_config = 121
181      [lazy = true];
182
183  // Data source name: android.surfaceflinger.transactions
184  optional SurfaceFlingerTransactionsConfig surfaceflinger_transactions_config =
185      123 [lazy = true];
186
187  // Data source name: android.sdk_sysprop_guard
188  // Introduced in Android 14 (U) QPR1.
189  optional AndroidSdkSyspropGuardConfig android_sdk_sysprop_guard_config = 124
190      [lazy = true];
191
192  // Data source name: windows.etw
193  optional EtwConfig etw_config = 125 [lazy = true];
194
195  // Data source name: android.protolog
196  optional ProtoLogConfig protolog_config = 126 [lazy = true];
197
198  // Data source name: android.input.inputevent
199  optional AndroidInputEventConfig android_input_event_config = 128
200      [lazy = true];
201
202  // Data source name: android.pixel.modem
203  optional PixelModemConfig pixel_modem_config = 129 [lazy = true];
204
205  // This is a fallback mechanism to send a free-form text config to the
206  // producer. In theory this should never be needed. All the code that
207  // is part of the platform (i.e. traced service) is supposed to *not* truncate
208  // the trace config proto and propagate unknown fields. However, if anything
209  // in the pipeline (client or backend) ends up breaking this forward compat
210  // plan, this field will become the escape hatch to allow future data sources
211  // to get some meaningful configuration.
212  optional string legacy_config = 1000;
213
214  // This field is only used for testing.
215  optional TestConfig for_testing = 1001;
216
217  // Was |for_testing|. Caused more problems then found.
218  reserved 268435455;
219}
220