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/common/builtin_clock.proto"; 22import "protos/perfetto/config/data_source_config.proto"; 23 24// The overall config that is used when starting a new tracing session through 25// ProducerPort::StartTracing(). 26// It contains the general config for the logging buffer(s) and the configs for 27// all the data source being enabled. 28// 29// Next id: 38. 30message TraceConfig { 31 message BufferConfig { 32 optional uint32 size_kb = 1; 33 34 // |page_size|, now deprecated. 35 reserved 2; 36 37 // |optimize_for|, now deprecated. 38 reserved 3; 39 40 enum FillPolicy { 41 UNSPECIFIED = 0; 42 43 // Default behavior. The buffer operates as a conventional ring buffer. 44 // If the writer is faster than the reader (or if the reader reads only 45 // after tracing is stopped) newly written packets will overwrite old 46 // packets. 47 RING_BUFFER = 1; 48 49 // Behaves like RING_BUFFER as long as there is space in the buffer or 50 // the reader catches up with the writer. As soon as the writer hits 51 // an unread chunk, it stops accepting new data in the buffer. 52 DISCARD = 2; 53 } 54 optional FillPolicy fill_policy = 4; 55 } 56 repeated BufferConfig buffers = 1; 57 58 message DataSource { 59 // Filters and data-source specific config. It contains also the unique name 60 // of the data source, the one passed in the DataSourceDescriptor when they 61 // register on the service. 62 optional protos.DataSourceConfig config = 1; 63 64 // Optional. If multiple producers (~processes) expose the same data source 65 // and either |producer_name_filter| or |producer_name_regex_filter| is set, 66 // the data source is enabled only for producers whose names match any of 67 // the filters. 68 // |producer_name_filter| has to be an exact match, while 69 // |producer_name_regex_filter| is a regular expression. 70 // This allows to enable a data source only for specific processes. 71 // The "repeated" fields have OR semantics: specifying a filter ["foo", 72 // "bar"] will enable data sources on both "foo" and "bar" (if they exist). 73 repeated string producer_name_filter = 2; 74 repeated string producer_name_regex_filter = 3; 75 } 76 repeated DataSource data_sources = 2; 77 78 // Config for disabling builtin data sources in the tracing service. 79 message BuiltinDataSource { 80 // Disable emitting clock timestamps into the trace. 81 optional bool disable_clock_snapshotting = 1; 82 83 // Disable echoing the original trace config in the trace. 84 optional bool disable_trace_config = 2; 85 86 // Disable emitting system info (build fingerprint, cpuinfo, etc). 87 optional bool disable_system_info = 3; 88 89 // Disable emitting events for data-source state changes (e.g. the marker 90 // for all data sources having ACKed the start of the trace). 91 optional bool disable_service_events = 4; 92 93 // The authoritative clock domain for the trace. Defaults to BOOTTIME. See 94 // also ClockSnapshot's primary_trace_clock. The configured value is written 95 // into the trace as part of the ClockSnapshots emitted by the service. 96 // Trace processor will attempt to translate packet/event timestamps from 97 // various data sources (and their chosen clock domains) to this domain 98 // during import. Added in Android R. 99 optional BuiltinClock primary_trace_clock = 5; 100 101 // Time interval in between snapshotting of sync markers, clock snapshots, 102 // stats, and other periodic service-emitted events. Note that the service 103 // only keeps track of the first and the most recent snapshot until 104 // ReadBuffers() is called. 105 optional uint32 snapshot_interval_ms = 6; 106 107 // Hints to the service that a suspend-aware (i.e. counting time in suspend) 108 // clock should be used for periodic snapshots of service-emitted events. 109 // This means, if a snapshot *should* have happened during suspend, it will 110 // happen immediately after the device resumes. 111 // 112 // Choosing a clock like this is done on best-effort basis; not all 113 // platforms (e.g. Windows) expose a clock which can be used for periodic 114 // tasks counting suspend. If such a clock is not available, the service 115 // falls back to the best-available alternative. 116 // 117 // Introduced in Android S. 118 // TODO(lalitm): deprecate this in T and make this the default if nothing 119 // crashes in S. 120 optional bool prefer_suspend_clock_for_snapshot = 7; 121 122 // Disables the reporting of per-trace-writer histograms in TraceStats. 123 optional bool disable_chunk_usage_histograms = 8; 124 } 125 optional BuiltinDataSource builtin_data_sources = 20; 126 127 // If specified, the trace will be stopped |duration_ms| after starting. 128 // This does *not* count the time the system is suspended, so we will run 129 // for duration_ms of system activity, not wall time. 130 // 131 // However in case of traces with triggers, see 132 // TriggerConfig.trigger_timeout_ms instead. 133 optional uint32 duration_ms = 3; 134 135 // If true, tries to use CLOCK_BOOTTIME for duration_ms rather than 136 // CLOCK_MONOTONIC (which doesn't count time in suspend). Supported only on 137 // Linux/Android, no-op on other platforms. This is used when dealing with 138 // long (e.g. 24h) traces, where suspend can inflate them to weeks of 139 // wall-time, making them more likely to hit device reboots (and hence loss). 140 // This option also changes consistently the semantic of 141 // TrigerConfig.stop_delay_ms. 142 optional bool prefer_suspend_clock_for_duration = 36; 143 144 // This is set when --dropbox is passed to the Perfetto command line client 145 // and enables guardrails that limit resource usage for traces requested 146 // by statsd. 147 optional bool enable_extra_guardrails = 4; 148 149 enum LockdownModeOperation { 150 LOCKDOWN_UNCHANGED = 0; 151 LOCKDOWN_CLEAR = 1; 152 LOCKDOWN_SET = 2; 153 } 154 // Reject producers that are not running under the same UID as the tracing 155 // service. 156 optional LockdownModeOperation lockdown_mode = 5; 157 158 message ProducerConfig { 159 // Identifies the producer for which this config is for. 160 optional string producer_name = 1; 161 162 // Specifies the preferred size of the shared memory buffer. If the size is 163 // larger than the max size, the max will be used. If it is smaller than 164 // the page size or doesn't fit pages evenly into it, it will fall back to 165 // the size specified by the producer or finally the default shared memory 166 // size. 167 optional uint32 shm_size_kb = 2; 168 169 // Specifies the preferred size of each page in the shared memory buffer. 170 // Must be an integer multiple of 4K. 171 optional uint32 page_size_kb = 3; 172 } 173 174 repeated ProducerConfig producers = 6; 175 176 // Contains statsd-specific metadata about an alert associated with the trace. 177 message StatsdMetadata { 178 // The identifier of the alert which triggered this trace. 179 optional int64 triggering_alert_id = 1; 180 // The uid which registered the triggering configuration with statsd. 181 optional int32 triggering_config_uid = 2; 182 // The identifier of the config which triggered the alert. 183 optional int64 triggering_config_id = 3; 184 // The identifier of the subscription which triggered this trace. 185 optional int64 triggering_subscription_id = 4; 186 } 187 188 // Statsd-specific metadata. 189 optional StatsdMetadata statsd_metadata = 7; 190 191 // When true && |output_path| is empty, the EnableTracing() request must 192 // provide a file descriptor. The service will then periodically read packets 193 // out of the trace buffer and store it into the passed file. 194 // If |output_path| is not empty no fd should be passed, the service 195 // will create a new file and write into that (see comment below). 196 optional bool write_into_file = 8; 197 198 // This must point to a non-existing file. If the file exists the service 199 // will NOT overwrite and will fail instead as a security precaution. 200 // On Android, when this is used with the system traced, the path must be 201 // within /data/misc/perfetto-traces/ or the trace will fail. 202 // This option has been introduced in Android R. Before R write_into_file 203 // can be used only with the "pass a file descriptor over IPC" mode. 204 optional string output_path = 29; 205 206 // Optional. If non-zero tunes the write period. A min value of 100ms is 207 // enforced (i.e. smaller values are ignored). 208 optional uint32 file_write_period_ms = 9; 209 210 // Optional. When non zero the periodic write stops once at most X bytes 211 // have been written into the file. Tracing is disabled when this limit is 212 // reached, even if |duration_ms| has not been reached yet. 213 optional uint64 max_file_size_bytes = 10; 214 215 // Contains flags which override the default values of the guardrails inside 216 // Perfetto. 217 message GuardrailOverrides { 218 // Override the default limit (in bytes) for uploading data to server within 219 // a 24 hour period. 220 // On R-, this override only affected userdebug builds. Since S, it also 221 // affects user builds. 222 optional uint64 max_upload_per_day_bytes = 1; 223 224 // Overrides the guardrail for maximum trace buffer size. 225 // Available on U+ 226 optional uint32 max_tracing_buffer_size_kb = 2; 227 } 228 optional GuardrailOverrides guardrail_overrides = 11; 229 230 // When true, data sources are not started until an explicit call to 231 // StartTracing() on the consumer port. This is to support early 232 // initialization and fast trace triggering. This can be used only when the 233 // Consumer explicitly triggers the StartTracing() method. 234 // This should not be used in a remote trace config via statsd, doing so will 235 // result in a hung trace session. 236 optional bool deferred_start = 12; 237 238 // When set, it periodically issues a Flush() to all data source, forcing them 239 // to commit their data into the tracing service. This can be used for 240 // quasi-real-time streaming mode and to guarantee some partial ordering of 241 // events in the trace in windows of X ms. 242 optional uint32 flush_period_ms = 13; 243 244 // Wait for this long for producers to acknowledge flush requests. 245 // Default 5s. 246 optional uint32 flush_timeout_ms = 14; 247 248 // Wait for this long for producers to acknowledge stop requests. 249 // Default 5s. 250 optional uint32 data_source_stop_timeout_ms = 23; 251 252 // |disable_clock_snapshotting| moved. 253 reserved 15; 254 255 // Android-only. If set, sends an intent to the Traceur system app when the 256 // trace ends to notify it about the trace readiness. 257 optional bool notify_traceur = 16; 258 259 // This field was introduced in Android S. 260 // Android-only. If set to a value > 0, marks the trace session as a candidate 261 // for being attached to a bugreport. This field effectively acts as a z-index 262 // for bugreports. When Android's dumpstate runs perfetto 263 // --save-for-bugreport, traced will pick the tracing session with the highest 264 // score (score <= 0 is ignored) and: 265 // On Android S, T: will steal its contents, save the trace into 266 // a known path and stop prematurely. 267 // On Android U+: will create a read-only snapshot and save that into a known 268 // path, without stoppin the original tracing session. 269 // When this field is set the tracing session becomes eligible to be cloned 270 // by other UIDs. 271 optional int32 bugreport_score = 30; 272 273 // Triggers allow producers to start or stop the tracing session when an event 274 // occurs. 275 // 276 // For example if we are tracing probabilistically, most traces will be 277 // uninteresting. Triggers allow us to keep only the interesting ones such as 278 // those traces during which the device temperature reached a certain 279 // threshold. In this case the producer can activate a trigger to keep 280 // (STOP_TRACING) the trace, otherwise it can also begin a trace 281 // (START_TRACING) because it knows something is about to happen. 282 message TriggerConfig { 283 enum TriggerMode { 284 UNSPECIFIED = 0; 285 286 // When this mode is chosen, data sources are not started until one of the 287 // |triggers| are received. This supports early initialization and fast 288 // starting of the tracing system. On triggering, the session will then 289 // record for |stop_delay_ms|. However if no trigger is seen 290 // after |trigger_timeout_ms| the session will be stopped and no data will 291 // be returned. 292 START_TRACING = 1; 293 294 // When this mode is chosen, the session will be started via the normal 295 // EnableTracing() & StartTracing(). If no trigger is ever seen 296 // the session will be stopped after |trigger_timeout_ms| and no data will 297 // be returned. However if triggered the trace will stop after 298 // |stop_delay_ms| and any data in the buffer will be returned to the 299 // consumer. 300 STOP_TRACING = 2; 301 302 // 3 was taken by CLONE_SNAPSHOT but that has been moved to 4. 303 // The early implementation of CLONE_SNAPSHOT had various bugs 304 // (b/290798988, b/290799105) and made it into Android U. The number 305 // change is to make sure nobody rolls out a config that hits the broken 306 // behaviour. 307 reserved 3; 308 309 // When this mode is chosen, this causes a snapshot of the current tracing 310 // session to be created after |stop_delay_ms| while the current tracing 311 // session continues undisturbed (% an extra flush). This mode can be 312 // used only when the tracing session is handled by the "perfetto" cmdline 313 // client (which is true in 90% of cases). Part of the business logic 314 // necessary for this behavior, and ensuing file handling, lives in 315 // perfetto_cmd.cc . On other consumers, this causes only a notification 316 // of the trigger through a CloneTriggerHit ObservableEvent. The custom 317 // consumer is supposed to call CloneSession() itself after the event. 318 // Use use_clone_snapshot_if_available=true when targeting older versions 319 // of perfetto. 320 CLONE_SNAPSHOT = 4; 321 322 // NOTE: CLONE_SNAPSHOT should be used only when we targeting Android V+ 323 // (15+) / Perfetto v38+. A bug in older versions of the tracing service 324 // might cause indefinitely long tracing sessions (see b/274931668). 325 } 326 optional TriggerMode trigger_mode = 1; 327 328 // This flag is really a workaround for b/274931668. This is needed only 329 // when deploying configs to different versions of the tracing service. 330 // When this is set to true this has the same effect of setting trigger_mode 331 // to CLONE_SNAPSHOT on newer versions of the service. This boolean has been 332 // introduced to allow to have configs that use CLONE_SNAPSHOT on newer 333 // versions of Android and fall back to STOP_TRACING on older versions where 334 // CLONE_SNAPSHOT did not exist. 335 // When using this flag, trigger_mode must be set to STOP_TRACING. 336 optional bool use_clone_snapshot_if_available = 5; 337 338 // DEPRECATED, was use_clone_snapshot_if_available in U. See the comment 339 // around CLONE_SNAPSHOT. 340 reserved 4; 341 342 message Trigger { 343 // The producer must specify this name to activate the trigger. 344 optional string name = 1; 345 346 // An std::regex that will match the producer that can activate this 347 // trigger. This is optional. If unset any producers can activate this 348 // trigger. 349 optional string producer_name_regex = 2; 350 351 // After a trigger is received either in START_TRACING or STOP_TRACING 352 // mode then the trace will end |stop_delay_ms| after triggering. 353 // In CLONE_SNAPSHOT mode, this is the delay between the trigger and the 354 // snapshot. 355 // If |prefer_suspend_clock_for_duration| is set, the duration will be 356 // based on wall-clock, counting also time in suspend. 357 optional uint32 stop_delay_ms = 3; 358 359 // Limits the number of traces this trigger can start/stop in a rolling 360 // 24 hour window. If this field is unset or zero, no limit is applied and 361 // activiation of this trigger *always* starts/stops the trace. 362 optional uint32 max_per_24_h = 4; 363 364 // A value between 0 and 1 which encodes the probability of skipping a 365 // trigger with this name. This is useful for reducing the probability 366 // of high-frequency triggers from dominating trace finaization. If this 367 // field is unset or zero, the trigger will *never* be skipped. If this 368 // field is greater than or equal to 1, this trigger will *always* be 369 // skipped i.e. it will be as if this trigger was never included in the 370 // first place. 371 // This probability check is applied *before* any other limits. For 372 // example, if |max_per_24_h| is also set, first we will check if the 373 // probability bar is met and only then will we check the |max_per_24_h| 374 // limit. 375 optional double skip_probability = 5; 376 } 377 // A list of triggers which are related to this configuration. If ANY 378 // trigger is seen then an action will be performed based on |trigger_mode|. 379 repeated Trigger triggers = 2; 380 381 // Required and must be positive if a TriggerConfig is specified. This is 382 // how long this TraceConfig should wait for a trigger to arrive. After this 383 // period of time if no trigger is seen the TracingSession will be cleaned 384 // up. 385 optional uint32 trigger_timeout_ms = 3; 386 } 387 optional TriggerConfig trigger_config = 17; 388 389 // When this is non-empty the perfetto command line tool will ignore the rest 390 // of this TraceConfig and instead connect to the perfetto service as a 391 // producer and send these triggers, potentially stopping or starting traces 392 // that were previous configured to use a TriggerConfig. 393 repeated string activate_triggers = 18; 394 395 // Configuration for trace contents that reference earlier trace data. For 396 // example, a data source might intern strings, and emit packets containing 397 // {interned id : string} pairs. Future packets from that data source can then 398 // use the interned ids instead of duplicating the raw string contents. The 399 // trace parser will then need to use that interning table to fully interpret 400 // the rest of the trace. 401 message IncrementalStateConfig { 402 // If nonzero, notify eligible data sources to clear their incremental state 403 // periodically, with the given period. The notification is sent only to 404 // data sources that have |handles_incremental_state_clear| set in their 405 // DataSourceDescriptor. The notification requests that the data source 406 // stops referring to past trace contents. This is particularly useful when 407 // tracing in ring buffer mode, where it is not exceptional to overwrite old 408 // trace data. 409 // 410 // Warning: this time-based global clearing is likely to be removed in the 411 // future, to be replaced with a smarter way of sending the notifications 412 // only when necessary. 413 optional uint32 clear_period_ms = 1; 414 } 415 optional IncrementalStateConfig incremental_state_config = 21; 416 417 // Additional guardrail used by the Perfetto command line client. 418 // On user builds when --dropbox is set perfetto will refuse to trace unless 419 // this is also set. 420 // Added in Q. 421 optional bool allow_user_build_tracing = 19; 422 423 // If set the tracing service will ensure there is at most one tracing session 424 // with this key. 425 optional string unique_session_name = 22; 426 427 // Compress trace with the given method. Best effort. 428 enum CompressionType { 429 COMPRESSION_TYPE_UNSPECIFIED = 0; 430 COMPRESSION_TYPE_DEFLATE = 1; 431 } 432 optional CompressionType compression_type = 24; 433 434 // Use the legacy codepath that compresses from perfetto_cmd.cc instead of 435 // using the new codepath that compresses from tracing_service_impl.cc. This 436 // will be removed in the future. 437 optional bool compress_from_cli = 37; 438 439 // Android-only. Not for general use. If set, saves the trace into an 440 // incident. This field is read by perfetto_cmd, rather than the tracing 441 // service. This field must be set when passing the --upload flag to 442 // perfetto_cmd. 443 message IncidentReportConfig { 444 // In this message, either: 445 // * all of |destination_package|, |destination_class| and |privacy_level| 446 // must be set. 447 // * |skip_incidentd| must be explicitly set to true. 448 449 optional string destination_package = 1; 450 optional string destination_class = 2; 451 // Level of filtering in the requested incident. See |Destination| in 452 // frameworks/base/core/proto/android/privacy.proto. 453 optional int32 privacy_level = 3; 454 455 // If true, then skips saving the trace to incidentd. 456 // 457 // This flag is useful in testing (e.g. Perfetto-statsd integration tests) 458 // or when we explicitly don't want traces to go to incidentd even when they 459 // usually would (e.g. configs deployed using statsd but only used for 460 // inclusion in bugreports using |bugreport_score|). 461 // 462 // The motivation for having this flag, instead of just not setting 463 // |incident_report_config|, is prevent accidents where 464 // |incident_report_config| is omitted by mistake. 465 optional bool skip_incidentd = 5; 466 467 // If true, do not write the trace into dropbox (i.e. incident only). 468 // Otherwise, write to both dropbox and incident. 469 // TODO(lalitm): remove this field as we no longer use Dropbox. 470 optional bool skip_dropbox = 4 [deprecated = true]; 471 } 472 optional IncidentReportConfig incident_report_config = 25; 473 474 enum StatsdLogging { 475 STATSD_LOGGING_UNSPECIFIED = 0; 476 STATSD_LOGGING_ENABLED = 1; 477 STATSD_LOGGING_DISABLED = 2; 478 } 479 480 // Android-only. Not for general use. If specified, sets the logging to statsd 481 // of guardrails and checkpoints in the tracing service. perfetto_cmd sets 482 // this to enabled (if not explicitly set in the config) when specifying 483 // --upload. 484 optional StatsdLogging statsd_logging = 31; 485 486 // DEPRECATED. Was trace_uuid, use trace_uuid_msb and trace_uuid_lsb instead. 487 reserved 26; 488 489 // An identifier clients can use to tie this trace to other logging. 490 // DEPRECATED as per v32. See TracePacket.trace_uuid for the authoritative 491 // Trace UUID. If this field is set, the tracing service will respect the 492 // requested UUID (i.e. TracePacket.trace_uuid == this field) but only if 493 // gap-less snapshotting is not used. 494 optional int64 trace_uuid_msb = 27 [deprecated = true]; 495 optional int64 trace_uuid_lsb = 28 [deprecated = true]; 496 497 // When set applies a post-filter to the trace contents using the filter 498 // provided. The filter is applied at ReadBuffers() time and works both in the 499 // case of IPC readback and write_into_file. This filter can be generated 500 // using `tools/proto_filter -s schema.proto -F filter_out.bytes` or 501 // `-T filter_out.escaped_string` (for .pbtx). See go/trace-filtering for 502 // design. 503 // 504 // Introduced in Android S, but it was broken (b/195065199). Reintroduced in 505 // Android T with a different field number. Updated in Android U with a new 506 // bytecode version which supports string filtering. 507 message TraceFilter { 508 // ========================= 509 // Filter bytecode. 510 // ========================= 511 512 // The bytecode as implemented in Android T. 513 optional bytes bytecode = 1; 514 515 // The bytecode as implemented in Android U. Adds support for string 516 // filtering. 517 optional bytes bytecode_v2 = 2; 518 519 // ========================= 520 // String filtering 521 // ========================= 522 523 // The principles and terminology of string filtering is heavily inspired by 524 // iptables. A "rule" decide how strings should be filtered. Each rule 525 // contains a "policy" which indicates the algorithm to use for filtering. 526 // A "chain" is a list of rules which will be sequentially checked against 527 // each string. 528 // 529 // The first rule which applies to the string terminates filtering for that 530 // string. If no rules apply, the string is left unchanged. 531 532 // A policy specifies which algorithm should be used for filtering the 533 // string. 534 enum StringFilterPolicy { 535 SFP_UNSPECIFIED = 0; 536 537 // Tries to match the string field against |regex_pattern|. If it 538 // matches, all matching groups are "redacted" (i.e. replaced with a 539 // constant string) and filtering is terminated (i.e. no further rules are 540 // checked). If it doesn't match, the string is left unchanged and the 541 // next rule in chain is considered. 542 SFP_MATCH_REDACT_GROUPS = 1; 543 544 // Like |SFP_MATCH_REDACT_GROUPS| but tries to do some pre-work before 545 // checking the regex. Specifically, it tries to parse the string field as 546 // an atrace tracepoint and checks if the post-tgid field starts with 547 // |atrace_post_tgid_starts_with|. The regex matching is only performed if 548 // this check succeeds. 549 SFP_ATRACE_MATCH_REDACT_GROUPS = 2; 550 551 // Tries to match the string field against |regex_pattern|. If it 552 // matches, filtering is terminated (i.e. no further rules are checked). 553 // If it doesn't match, the string is left unchanged and the next rule in 554 // chain is considered. 555 SFP_MATCH_BREAK = 3; 556 557 // Like |SFP_MATCH_BREAK| but tries to do some pre-work before checking 558 // the regex. Specifically, it tries to parse the string field as an 559 // atrace tracepoint and checks if the post-tgid field starts with 560 // |atrace_post_tgid_starts_with|. The regex matching is only performed if 561 // this check succeeds. 562 SFP_ATRACE_MATCH_BREAK = 4; 563 } 564 565 // A rule specifies how strings should be filtered. 566 message StringFilterRule { 567 // The policy (i.e. algorithm) dictating how strings matching this rule 568 // should be handled. 569 optional StringFilterPolicy policy = 1; 570 571 // The regex pattern used to match against each string. 572 optional string regex_pattern = 2; 573 574 // The string which should appear after the tgid in atrace tracepoint 575 // strings. 576 optional string atrace_payload_starts_with = 3; 577 } 578 579 // A chain is a list of rules which string will be sequentially checked 580 // against. 581 message StringFilterChain { 582 repeated StringFilterRule rules = 1; 583 } 584 optional StringFilterChain string_filter_chain = 3; 585 } 586 // old field number for trace_filter 587 reserved 32; 588 optional TraceFilter trace_filter = 33; 589 590 // Android-only. Not for general use. If set, reports the trace to the 591 // Android framework. This field is read by perfetto_cmd, rather than the 592 // tracing service. This field must be set when passing the --upload flag to 593 // perfetto_cmd. 594 message AndroidReportConfig { 595 // In this message, either: 596 // * |reporter_service_package| and |reporter_service_class| must be set. 597 // * |skip_reporting| must be explicitly set to true. 598 599 optional string reporter_service_package = 1; 600 optional string reporter_service_class = 2; 601 602 // If true, then skips reporting the trace to Android framework. 603 // 604 // This flag is useful in testing (e.g. Perfetto-statsd integration tests) 605 // or when we explicitly don't want to report traces to the framework even 606 // when they usually would (e.g. configs deployed using statsd but only 607 // used for inclusion in bugreports using |bugreport_score|). 608 // 609 // The motivation for having this flag, instead of just not setting 610 // |framework_report_config|, is prevent accidents where 611 // |framework_report_config| is omitted by mistake. 612 optional bool skip_report = 3; 613 614 // If true, will direct the Android framework to read the data in trace 615 // file and pass it to the reporter class over a pipe instead of passing 616 // the file descriptor directly. 617 // 618 // This flag is needed because the Android test framework does not 619 // currently support priv-app helper apps (in terms of SELinux) and we 620 // really don't want to add an allow rule for untrusted_app to receive 621 // trace fds. 622 // 623 // Because of this, we instead will direct the framework to create a new 624 // pipe and pass this to the reporter process instead. As the pipe is 625 // created by the framework, we won't have any problems with SELinux 626 // (system_server is already allowed to pass pipe fds, even 627 // to untrusted apps). 628 // 629 // As the name suggests this option *MUST* only be used for testing. 630 // Note that the framework will reject (and drop) files which are too 631 // large both for simplicity and to be minimize the amount of data we 632 // pass to a non-priv app (note that the framework will still check 633 // manifest permissions even though SELinux permissions are worked around). 634 optional bool use_pipe_in_framework_for_testing = 4; 635 } 636 optional AndroidReportConfig android_report_config = 34; 637 638 // If set, delays the start of tracing by a random duration. The duration is 639 // chosen from a uniform distribution between the specified minimum and 640 // maximum. 641 // Note: this delay is implemented by perfetto_cmd *not* by traced so will 642 // not work if you communicate with traced directly over the consumer API. 643 // Introduced in Android T. 644 message CmdTraceStartDelay { 645 optional uint32 min_delay_ms = 1; 646 optional uint32 max_delay_ms = 2; 647 } 648 optional CmdTraceStartDelay cmd_trace_start_delay = 35; 649} 650