• 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_log_config.proto";
22import "protos/perfetto/config/android/android_polled_state_config.proto";
23import "protos/perfetto/config/android/android_system_property_config.proto";
24import "protos/perfetto/config/android/packages_list_config.proto";
25import "protos/perfetto/config/chrome/chrome_config.proto";
26import "protos/perfetto/config/ftrace/ftrace_config.proto";
27import "protos/perfetto/config/gpu/gpu_counter_config.proto";
28import "protos/perfetto/config/gpu/vulkan_memory_config.proto";
29import "protos/perfetto/config/inode_file/inode_file_config.proto";
30import "protos/perfetto/config/interceptor_config.proto";
31import "protos/perfetto/config/power/android_power_config.proto";
32import "protos/perfetto/config/process_stats/process_stats_config.proto";
33import "protos/perfetto/config/profiling/heapprofd_config.proto";
34import "protos/perfetto/config/profiling/java_hprof_config.proto";
35import "protos/perfetto/config/profiling/perf_event_config.proto";
36import "protos/perfetto/config/sys_stats/sys_stats_config.proto";
37import "protos/perfetto/config/test_config.proto";
38import "protos/perfetto/config/track_event/track_event_config.proto";
39
40// The configuration that is passed to each data source when starting tracing.
41// Next id: 119
42message DataSourceConfig {
43  enum SessionInitiator {
44    SESSION_INITIATOR_UNSPECIFIED = 0;
45    // This trace was initiated from a trusted system app has DUMP and
46    // USAGE_STATS permission. This system app is expected to not expose the
47    // trace to the user of the device.
48    // This is determined by checking the UID initiating the trace.
49    SESSION_INITIATOR_TRUSTED_SYSTEM = 1;
50  };
51  // Data source unique name, e.g., "linux.ftrace". This must match
52  // the name passed by the data source when it registers (see
53  // RegisterDataSource()).
54  optional string name = 1;
55
56  // The index of the logging buffer where TracePacket(s) will be stored.
57  // This field doesn't make a major difference for the Producer(s). The final
58  // logging buffers, in fact, are completely owned by the Service. We just ask
59  // the Producer to copy this number into the chunk headers it emits, so that
60  // the Service can quickly identify the buffer where to move the chunks into
61  // without expensive lookups on its fastpath.
62  optional uint32 target_buffer = 2;
63
64  // Set by the service to indicate the duration of the trace.
65  // DO NOT SET in consumer as this will be overridden by the service.
66  optional uint32 trace_duration_ms = 3;
67
68  // Set by the service to indicate how long it waits after StopDataSource.
69  // DO NOT SET in consumer as this will be overridden by the service.
70  optional uint32 stop_timeout_ms = 7;
71
72  // Set by the service to indicate whether this tracing session has extra
73  // guardrails.
74  // DO NOT SET in consumer as this will be overridden by the service.
75  optional bool enable_extra_guardrails = 6;
76
77  // Set by the service to indicate which user initiated this trace.
78  // DO NOT SET in consumer as this will be overridden by the service.
79  optional SessionInitiator session_initiator = 8;
80
81  // Set by the service to indicate which tracing session the data source
82  // belongs to. The intended use case for this is checking if two data sources,
83  // one of which produces metadata for the other one, belong to the same trace
84  // session and hence should be linked together.
85  // This field was introduced in Aug 2018 after Android P.
86  // DO NOT SET in consumer as this will be overridden by the service.
87  optional uint64 tracing_session_id = 4;
88
89  // Keeep the lower IDs (up to 99) for fields that are *not* specific to
90  // data-sources and needs to be processed by the traced daemon.
91
92  // All data source config fields must be marked as [lazy=true]. This prevents
93  // the proto-to-cpp generator from recursing into those when generating the
94  // cpp classes and polluting tracing/core with data-source-specific classes.
95  // Instead they are treated as opaque strings containing raw proto bytes.
96
97  // Data source name: linux.ftrace
98  optional FtraceConfig ftrace_config = 100 [lazy = true];
99  // Data source name: linux.inode_file_map
100  optional InodeFileConfig inode_file_config = 102 [lazy = true];
101  // Data source name: linux.process_stats
102  optional ProcessStatsConfig process_stats_config = 103 [lazy = true];
103  // Data source name: linux.sys_stats
104  optional SysStatsConfig sys_stats_config = 104 [lazy = true];
105  // Data source name: android.heapprofd
106  // Introduced in Android 10.
107  optional HeapprofdConfig heapprofd_config = 105 [lazy = true];
108  // Data source name: android.java_hprof
109  // Introduced in Android 11.
110  optional JavaHprofConfig java_hprof_config = 110 [lazy = true];
111  // Data source name: android.power
112  optional AndroidPowerConfig android_power_config = 106 [lazy = true];
113  // Data source name: android.log
114  optional AndroidLogConfig android_log_config = 107 [lazy = true];
115  // TODO(fmayer): Add data source name for this.
116  optional GpuCounterConfig gpu_counter_config = 108 [lazy = true];
117  // Data source name: android.packages_list
118  optional PackagesListConfig packages_list_config = 109 [lazy = true];
119  // Data source name: linux.perf
120  optional PerfEventConfig perf_event_config = 111 [lazy = true];
121  // Data source name: vulkan.memory_tracker
122  optional VulkanMemoryConfig vulkan_memory_config = 112 [lazy = true];
123  // Data source name: track_event
124  optional TrackEventConfig track_event_config = 113 [lazy = true];
125  // Data source name: android.polled_state
126  optional AndroidPolledStateConfig android_polled_state_config = 114
127      [lazy = true];
128  // Data source name: android.system_property
129  optional AndroidSystemPropertyConfig android_system_property_config = 118
130      [lazy = true];
131
132  // Chrome is special as it doesn't use the perfetto IPC layer. We want to
133  // avoid proto serialization and de-serialization there because that would
134  // just add extra hops on top of the Mojo ser/des. Instead we auto-generate a
135  // C++ class for it so it can pass around plain C++ objets.
136  optional ChromeConfig chrome_config = 101;
137
138  // If an interceptor is specified here, packets for this data source will be
139  // rerouted to the interceptor instead of the main trace buffer. This can be
140  // used, for example, to write trace data into ETW or for logging trace points
141  // to the console.
142  //
143  // Note that interceptors are only supported by data sources registered
144  // through the Perfetto SDK API. Data sources that don't use that API (e.g.,
145  // traced_probes) may not support interception.
146  optional InterceptorConfig interceptor_config = 115;
147
148  // This is a fallback mechanism to send a free-form text config to the
149  // producer. In theory this should never be needed. All the code that
150  // is part of the platform (i.e. traced service) is supposed to *not* truncate
151  // the trace config proto and propagate unknown fields. However, if anything
152  // in the pipeline (client or backend) ends up breaking this forward compat
153  // plan, this field will become the escape hatch to allow future data sources
154  // to get some meaningful configuration.
155  optional string legacy_config = 1000;
156
157  // This field is only used for testing.
158  optional TestConfig for_testing = 1001;
159
160  // Was |for_testing|. Caused more problems then found.
161  reserved 268435455;
162}
163