1// AUTOGENERATED - DO NOT EDIT 2// --------------------------- 3// This file has been generated by 4// AOSP://external/perfetto/tools/gen_merged_protos 5// merging the perfetto config protos. 6// This fused proto is intended to be copied in: 7// - Android tree, for statsd. 8// - Google internal repos. 9 10syntax = "proto2"; 11 12package perfetto.protos; 13 14// Begin of protos/perfetto/common/gpu_counter_descriptor.proto 15 16// Description of GPU counters. 17// This message is sent by a GPU counter producer to specify the counters 18// available in the hardware. 19message GpuCounterDescriptor { 20 // Logical groups for a counter. This is used in the UI to present the 21 // related counters together. 22 enum GpuCounterGroup { 23 UNCLASSIFIED = 0; 24 SYSTEM = 1; 25 VERTICES = 2; 26 FRAGMENTS = 3; 27 PRIMITIVES = 4; 28 // Includes counters relating to caching and bandwidth. 29 MEMORY = 5; 30 COMPUTE = 6; 31 } 32 33 message GpuCounterSpec { 34 optional uint32 counter_id = 1; 35 optional string name = 2; 36 optional string description = 3; 37 // MeasureUnit unit (deprecated) 38 reserved 4; 39 oneof peak_value { 40 int64 int_peak_value = 5; 41 double double_peak_value = 6; 42 } 43 repeated MeasureUnit numerator_units = 7; 44 repeated MeasureUnit denominator_units = 8; 45 optional bool select_by_default = 9; 46 repeated GpuCounterGroup groups = 10; 47 } 48 repeated GpuCounterSpec specs = 1; 49 50 // Allow producer to group counters into block to represent counter islands. 51 // A capacity may be specified to indicate the number of counters that can be 52 // enable simultaneously in that block. 53 message GpuCounterBlock { 54 // required. Unique ID for the counter group. 55 optional uint32 block_id = 1; 56 // optional. Number of counters supported by the block. No limit if unset. 57 optional uint32 block_capacity = 2; 58 // optional. Name of block. 59 optional string name = 3; 60 // optional. Description for the block. 61 optional string description = 4; 62 // list of counters that are part of the block. 63 repeated uint32 counter_ids = 5; 64 } 65 repeated GpuCounterBlock blocks = 2; 66 67 // optional. Minimum sampling period supported by the producer in 68 // nanoseconds. 69 optional uint64 min_sampling_period_ns = 3; 70 71 // optional. Maximum sampling period supported by the producer in 72 // nanoseconds. 73 optional uint64 max_sampling_period_ns = 4; 74 75 // optional. The producer supports counter sampling by instrumenting the 76 // command buffer. 77 optional bool supports_instrumented_sampling = 5; 78 79 // next id: 41 80 enum MeasureUnit { 81 NONE = 0; 82 83 BIT = 1; 84 KILOBIT = 2; 85 MEGABIT = 3; 86 GIGABIT = 4; 87 TERABIT = 5; 88 PETABIT = 6; 89 90 BYTE = 7; 91 KILOBYTE = 8; 92 MEGABYTE = 9; 93 GIGABYTE = 10; 94 TERABYTE = 11; 95 PETABYTE = 12; 96 97 HERTZ = 13; 98 KILOHERTZ = 14; 99 MEGAHERTZ = 15; 100 GIGAHERTZ = 16; 101 TERAHERTZ = 17; 102 PETAHERTZ = 18; 103 104 NANOSECOND = 19; 105 MICROSECOND = 20; 106 MILLISECOND = 21; 107 SECOND = 22; 108 MINUTE = 23; 109 HOUR = 24; 110 111 VERTEX = 25; 112 PIXEL = 26; 113 TRIANGLE = 27; 114 PRIMITIVE = 38; 115 FRAGMENT = 39; 116 117 MILLIWATT = 28; 118 WATT = 29; 119 KILOWATT = 30; 120 121 JOULE = 31; 122 VOLT = 32; 123 AMPERE = 33; 124 125 CELSIUS = 34; 126 FAHRENHEIT = 35; 127 KELVIN = 36; 128 129 // Values should be out of 100. 130 PERCENT = 37; 131 132 INSTRUCTION = 40; 133 } 134} 135 136// End of protos/perfetto/common/gpu_counter_descriptor.proto 137 138// Begin of protos/perfetto/common/track_event_descriptor.proto 139 140message TrackEventCategory { 141 optional string name = 1; 142 optional string description = 2; 143 repeated string tags = 3; 144} 145 146message TrackEventDescriptor { 147 repeated TrackEventCategory available_categories = 1; 148} 149 150// End of protos/perfetto/common/track_event_descriptor.proto 151 152// Begin of protos/perfetto/common/data_source_descriptor.proto 153 154// This message is sent from Producer(s) to the tracing Service when registering 155// to advertise their capabilities. It describes the structure of tracing 156// protos that will be produced by the data source and the supported filters. 157message DataSourceDescriptor { 158 // e.g., "linux.ftrace", "chromium.tracing" 159 optional string name = 1; 160 161 // When true the data source is expected to ack the stop request through the 162 // NotifyDataSourceStopped() IPC. This field has been introduced after 163 // Android P in Jul 2018 and is not supported on older versions. 164 optional bool will_notify_on_stop = 2; 165 166 // When true the data source is expected to ack the start request through the 167 // NotifyDataSourceStarted() IPC. This field has been introduced after 168 // Android P in March 2019 and is not supported on older versions. 169 optional bool will_notify_on_start = 3; 170 171 // If true, opt into receiving the ClearIncrementalState() IPC. This should be 172 // set if the data source writes packets that refer to previous trace 173 // contents, and knows how to stop referring to the already-emitted data. 174 optional bool handles_incremental_state_clear = 4; 175 176 // Optional specification about available GPU counters. 177 optional GpuCounterDescriptor gpu_counter_descriptor = 5 [lazy = true]; 178 179 optional TrackEventDescriptor track_event_descriptor = 6 [lazy = true]; 180} 181 182// End of protos/perfetto/common/data_source_descriptor.proto 183 184// Begin of protos/perfetto/common/tracing_service_state.proto 185 186// Reports the state of the tracing service. Used to gather details about the 187// data sources connected. 188// See ConsumerPort::QueryServiceState(). 189message TracingServiceState { 190 // Describes a producer process. 191 message Producer { 192 // Unique ID of the producer (monotonic counter). 193 optional int32 id = 1; 194 195 // Typically matches the process name. 196 optional string name = 2; 197 198 // Unix uid of the remote process. 199 optional int32 uid = 3; 200 201 // The version of the client library used by the producer. 202 // This is a human readable string with and its format varies depending on 203 // the build system and the repo (standalone vs AOSP). 204 // This is intended for human debugging only. 205 optional string sdk_version = 4; 206 } 207 208 // Describes a data source registered by a producer. Data sources are listed 209 // regardless of the fact that they are being used or not. 210 message DataSource { 211 // Descriptor passed by the data source when calling RegisterDataSource(). 212 optional DataSourceDescriptor ds_descriptor = 1; 213 214 // ID of the producer, as per Producer.id. 215 optional int32 producer_id = 2; 216 } 217 218 // Lists all the producers connected. 219 repeated Producer producers = 1; 220 221 // Lists the data sources available. 222 repeated DataSource data_sources = 2; 223 224 // Total number of tracing sessions. 225 optional int32 num_sessions = 3; 226 227 // Number of tracing sessions in the started state. Always <= num_sessions. 228 optional int32 num_sessions_started = 4; 229 230 // The version of traced (the same returned by `traced --version`). 231 // This is a human readable string with and its format varies depending on 232 // the build system and the repo (standalone vs AOSP). 233 // This is intended for human debugging only. 234 optional string tracing_service_version = 5; 235} 236 237// End of protos/perfetto/common/tracing_service_state.proto 238 239// Begin of protos/perfetto/common/builtin_clock.proto 240 241enum BuiltinClock { 242 BUILTIN_CLOCK_UNKNOWN = 0; 243 BUILTIN_CLOCK_REALTIME = 1; 244 BUILTIN_CLOCK_REALTIME_COARSE = 2; 245 BUILTIN_CLOCK_MONOTONIC = 3; 246 BUILTIN_CLOCK_MONOTONIC_COARSE = 4; 247 BUILTIN_CLOCK_MONOTONIC_RAW = 5; 248 BUILTIN_CLOCK_BOOTTIME = 6; 249 BUILTIN_CLOCK_MAX_ID = 63; 250 251 reserved 7, 8; 252} 253 254// End of protos/perfetto/common/builtin_clock.proto 255 256// Begin of protos/perfetto/common/android_log_constants.proto 257 258// Values from NDK's android/log.h. 259enum AndroidLogId { 260 // MAIN. 261 LID_DEFAULT = 0; 262 263 LID_RADIO = 1; 264 LID_EVENTS = 2; 265 LID_SYSTEM = 3; 266 LID_CRASH = 4; 267 LID_STATS = 5; 268 LID_SECURITY = 6; 269 LID_KERNEL = 7; 270} 271 272enum AndroidLogPriority { 273 PRIO_UNSPECIFIED = 0; 274 275 // _DEFAULT, but should never be seen in logs. 276 PRIO_UNUSED = 1; 277 278 PRIO_VERBOSE = 2; 279 PRIO_DEBUG = 3; 280 PRIO_INFO = 4; 281 PRIO_WARN = 5; 282 PRIO_ERROR = 6; 283 PRIO_FATAL = 7; 284} 285 286// End of protos/perfetto/common/android_log_constants.proto 287 288// Begin of protos/perfetto/config/android/android_log_config.proto 289 290message AndroidLogConfig { 291 repeated AndroidLogId log_ids = 1; 292 293 // Was |poll_ms|, deprecated. 294 reserved 2; 295 296 // If set ignores all log messages whose prio is < the given value. 297 optional AndroidLogPriority min_prio = 3; 298 299 // If non-empty ignores all log messages whose tag doesn't match one of the 300 // specified values. 301 repeated string filter_tags = 4; 302} 303 304// End of protos/perfetto/config/android/android_log_config.proto 305 306// Begin of protos/perfetto/config/android/android_polled_state_config.proto 307 308// Data source that polls for display state. 309message AndroidPolledStateConfig { 310 // Frequency of polling. If absent the state will be recorded once, at the 311 // start of the trace. 312 // This is required to be > 100ms to avoid excessive CPU usage. 313 optional uint32 poll_ms = 1; 314} 315 316// End of protos/perfetto/config/android/android_polled_state_config.proto 317 318// Begin of protos/perfetto/config/android/packages_list_config.proto 319 320// Data source that lists details (such as version code) about packages on an 321// Android device. 322message PackagesListConfig { 323 // If not empty, emit info about only the following list of package names 324 // (exact match, no regex). Otherwise, emit info about all packages. 325 repeated string package_name_filter = 1; 326} 327 328// End of protos/perfetto/config/android/packages_list_config.proto 329 330// Begin of protos/perfetto/config/chrome/chrome_config.proto 331 332message ChromeConfig { 333 optional string trace_config = 1; 334 335 // When enabled, the data source should only fill in fields in the output that 336 // are not potentially privacy sensitive. 337 optional bool privacy_filtering_enabled = 2; 338 339 // Instead of emitting binary protobuf, convert the trace data to the legacy 340 // JSON format. Note that the trace data will still be returned as a series of 341 // TracePackets, but the embedded data will be JSON instead of serialized 342 // protobuf. 343 optional bool convert_to_legacy_json = 3; 344 345 // Priority of the tracing session client. A higher priority session may 346 // preempt a lower priority one in configurations where concurrent sessions 347 // aren't supported. 348 enum ClientPriority { 349 UNKNOWN = 0; 350 BACKGROUND = 1; 351 USER_INITIATED = 2; 352 } 353 optional ClientPriority client_priority = 4; 354 355 // Applicable only when using legacy JSON format. 356 // If |json_agent_label_filter| is not empty, only data pertaining to 357 // the specified tracing agent label (e.g. "traceEvents") will be returned. 358 optional string json_agent_label_filter = 5; 359} 360 361// End of protos/perfetto/config/chrome/chrome_config.proto 362 363// Begin of protos/perfetto/config/ftrace/ftrace_config.proto 364 365message FtraceConfig { 366 repeated string ftrace_events = 1; 367 repeated string atrace_categories = 2; 368 repeated string atrace_apps = 3; 369 // *Per-CPU* buffer size. 370 optional uint32 buffer_size_kb = 10; 371 optional uint32 drain_period_ms = 11; 372 373 // Configuration for compact encoding of scheduler events. When enabled (and 374 // recording the relevant ftrace events), specific high-volume events are 375 // encoded in a denser format than normal. 376 message CompactSchedConfig { 377 // If true, and sched_switch or sched_waking ftrace events are enabled, 378 // record those events in the compact format. 379 optional bool enabled = 1; 380 } 381 optional CompactSchedConfig compact_sched = 12; 382 383 // Enables symbol name resolution against /proc/kallsyms. 384 // It requires that either traced_probes is running as root or that 385 // kptr_restrict has been manually lowered. 386 // It does not disclose KASLR, symbol addresses are mangled. 387 optional bool symbolize_ksyms = 13; 388 389 // By default the kernel symbolizer is lazily initialized on a deferred task 390 // to reduce ftrace's time-to-start-recording. Unfortunately that makes 391 // ksyms integration tests hard. This flag forces the kernel symbolizer to be 392 // initialized synchronously on the data source start and hence avoiding 393 // timing races in tests. 394 optional bool initialize_ksyms_synchronously_for_testing = 14; 395} 396 397// End of protos/perfetto/config/ftrace/ftrace_config.proto 398 399// Begin of protos/perfetto/config/gpu/gpu_counter_config.proto 400 401message GpuCounterConfig { 402 // Desired sampling interval for counters. 403 optional uint64 counter_period_ns = 1; 404 405 // List of counters to be sampled. Counter IDs correspond to the ones 406 // described in GpuCounterSpec in the data source descriptor. 407 repeated uint32 counter_ids = 2; 408 409 // Sample counters by instrumenting command buffers. 410 optional bool instrumented_sampling = 3; 411 412 // Fix gpu clock rate during trace session. 413 optional bool fix_gpu_clock = 4; 414} 415 416// End of protos/perfetto/config/gpu/gpu_counter_config.proto 417 418// Begin of protos/perfetto/config/gpu/vulkan_memory_config.proto 419 420message VulkanMemoryConfig { 421 // Tracking driver memory usage events 422 optional bool track_driver_memory_usage = 1; 423 424 // Tracking device memory usage events 425 optional bool track_device_memory_usage = 2; 426} 427 428// End of protos/perfetto/config/gpu/vulkan_memory_config.proto 429 430// Begin of protos/perfetto/config/inode_file/inode_file_config.proto 431 432message InodeFileConfig { 433 message MountPointMappingEntry { 434 optional string mountpoint = 1; 435 repeated string scan_roots = 2; 436 } 437 438 // How long to pause between batches. 439 optional uint32 scan_interval_ms = 1; 440 441 // How long to wait before the first scan in order to accumulate inodes. 442 optional uint32 scan_delay_ms = 2; 443 444 // How many inodes to scan in one batch. 445 optional uint32 scan_batch_size = 3; 446 447 // Do not scan for inodes not found in the static map. 448 optional bool do_not_scan = 4; 449 450 // If non-empty, only scan inodes corresponding to block devices named in 451 // this list. 452 repeated string scan_mount_points = 5; 453 454 // When encountering an inode belonging to a block device corresponding 455 // to one of the mount points in this map, scan its scan_roots instead. 456 repeated MountPointMappingEntry mount_point_mapping = 6; 457} 458 459// End of protos/perfetto/config/inode_file/inode_file_config.proto 460 461// Begin of protos/perfetto/config/interceptors/console_config.proto 462 463message ConsoleConfig { 464 enum Output { 465 OUTPUT_UNSPECIFIED = 0; 466 OUTPUT_STDOUT = 1; 467 OUTPUT_STDERR = 2; 468 } 469 optional Output output = 1; 470 optional bool enable_colors = 2; 471} 472 473// End of protos/perfetto/config/interceptors/console_config.proto 474 475// Begin of protos/perfetto/config/interceptor_config.proto 476 477// Configuration for trace packet interception. Used for diverting trace data to 478// non-Perfetto sources (e.g., logging to the console, ETW) when using the 479// Perfetto SDK. 480message InterceptorConfig { 481 // Matches the name given to RegisterInterceptor(). 482 optional string name = 1; 483 484 optional ConsoleConfig console_config = 100 [lazy = true]; 485} 486 487// End of protos/perfetto/config/interceptor_config.proto 488 489// Begin of protos/perfetto/config/power/android_power_config.proto 490 491message AndroidPowerConfig { 492 enum BatteryCounters { 493 BATTERY_COUNTER_UNSPECIFIED = 0; 494 495 // Coulomb counter. 496 BATTERY_COUNTER_CHARGE = 1; 497 498 // Charge (%). 499 BATTERY_COUNTER_CAPACITY_PERCENT = 2; 500 501 // Instantaneous current. 502 BATTERY_COUNTER_CURRENT = 3; 503 504 // Avg current. 505 BATTERY_COUNTER_CURRENT_AVG = 4; 506 } 507 optional uint32 battery_poll_ms = 1; 508 repeated BatteryCounters battery_counters = 2; 509 510 // Where available enables per-power-rail measurements. 511 optional bool collect_power_rails = 3; 512 513 // Provides a breakdown of energy estimation for various subsystem (e.g. GPU). 514 // Available from Android S. 515 optional bool collect_energy_estimation_breakdown = 4; 516} 517 518// End of protos/perfetto/config/power/android_power_config.proto 519 520// Begin of protos/perfetto/config/process_stats/process_stats_config.proto 521 522message ProcessStatsConfig { 523 enum Quirks { 524 QUIRKS_UNSPECIFIED = 0; 525 526 // This has been deprecated and ignored as per 2018-05-01. Full scan at 527 // startup is now disabled by default and can be re-enabled using the 528 // |scan_all_processes_on_start| arg. 529 DISABLE_INITIAL_DUMP = 1 [deprecated = true]; 530 531 DISABLE_ON_DEMAND = 2; 532 } 533 534 repeated Quirks quirks = 1; 535 536 // If enabled all processes will be scanned and dumped when the trace starts. 537 optional bool scan_all_processes_on_start = 2; 538 539 // If enabled thread names are also recoded (this is redundant if sched_switch 540 // is enabled). 541 optional bool record_thread_names = 3; 542 543 // If > 0 samples counters (see process_stats.proto) from 544 // /proc/pid/status and oom_score_adj every X ms. 545 // This is required to be > 100ms to avoid excessive CPU usage. 546 // TODO(primiano): add CPU cost for change this value. 547 optional uint32 proc_stats_poll_ms = 4; 548 549 // If empty samples stats for all processes. If non empty samples stats only 550 // for processes matching the given string in their argv0 (i.e. the first 551 // entry of /proc/pid/cmdline). 552 // TODO(primiano): implement this feature. 553 // repeated string proc_stats_filter = 5; 554 555 // This is required to be either = 0 or a multiple of |proc_stats_poll_ms| 556 // (default: |proc_stats_poll_ms|). If = 0, will be set to 557 // |proc_stats_poll_ms|. Non-multiples will be rounded down to the nearest 558 // multiple. 559 optional uint32 proc_stats_cache_ttl_ms = 6; 560 561 // Whether to record /proc/tid/time_in_state. 562 optional bool record_thread_time_in_state = 7; 563 564 // Size of the cache for thread time_in_state cpu freq values. 565 // If not specificed, the default is used. 566 optional uint32 thread_time_in_state_cache_size = 8; 567} 568 569// End of protos/perfetto/config/process_stats/process_stats_config.proto 570 571// Begin of protos/perfetto/config/profiling/heapprofd_config.proto 572 573// Configuration for go/heapprofd. 574// Next id: 27 575message HeapprofdConfig { 576 message ContinuousDumpConfig { 577 // ms to wait before first dump. 578 optional uint32 dump_phase_ms = 5; 579 // ms to wait between following dumps. 580 optional uint32 dump_interval_ms = 6; 581 } 582 583 // Sampling rate for all heaps not specified via heap_sampling_intervals. 584 // 585 // These are: 586 // * All heaps if heap_sampling_intervals is empty. 587 // * Those profiled due to all_heaps and not named in heaps if 588 // heap_sampling_intervals is not empty. 589 // * The implicit libc.malloc heap if heaps is empty. 590 // 591 // Set to 1 for perfect accuracy. 592 // Otherwise, sample every sample_interval_bytes on average. 593 // 594 // See 595 // https://perfetto.dev/docs/data-sources/native-heap-profiler#sampling-interval 596 // for more details. 597 // 598 // BUGS 599 // Before Android 12, setting this to 0 would crash the target process. 600 optional uint64 sampling_interval_bytes = 1; 601 602 // If less than the given numbers of bytes are left free in the shared 603 // memory buffer, increase sampling interval by a factor of two. 604 // Adaptive sampling is disabled when set to 0. 605 optional uint64 adaptive_sampling_shmem_threshold = 24; 606 // Stop doubling the sampling_interval once the sampling interval has reached 607 // this value. 608 optional uint64 adaptive_sampling_max_sampling_interval_bytes = 25; 609 610 // E.g. surfaceflinger, com.android.phone 611 // This input is normalized in the following way: if it contains slashes, 612 // everything up to the last slash is discarded. If it contains "@", 613 // everything after the first @ is discared. 614 // E.g. /system/bin/surfaceflinger@1.0 normalizes to surfaceflinger. 615 // This transformation is also applied to the processes' command lines when 616 // matching. 617 repeated string process_cmdline = 2; 618 619 // For watermark based triggering or local debugging. 620 repeated uint64 pid = 4; 621 622 // Only profile target if it was installed by one of the packages given. 623 // Special values are: 624 // * @system: installed on the system partition 625 // * @product: installed on the product partition 626 // * @null: sideloaded 627 // Supported on Android 12+. 628 repeated string target_installed_by = 26; 629 630 // Which heaps to sample, e.g. "libc.malloc". If left empty, only samples 631 // "malloc". 632 // 633 // Introduced in Android 12. 634 repeated string heaps = 20; 635 636 // Which heaps not to sample, e.g. "libc.malloc". This is useful when used in 637 // combination with all_heaps; 638 // 639 // Introduced in Android 12. 640 repeated string exclude_heaps = 27; 641 642 optional bool stream_allocations = 23; 643 644 // If given, needs to be the same length as heaps and gives the sampling 645 // interval for the respective entry in heaps. 646 // 647 // Otherwise, sampling_interval_bytes is used. 648 // 649 // It is recommended to set sampling_interval_bytes to a reasonable default 650 // value when using this, as a value of 0 for sampling_interval_bytes will 651 // crash the target process before Android 12. 652 // 653 // Introduced in Android 12. 654 repeated uint64 heap_sampling_intervals = 22; 655 656 // Sample all heaps registered by target process. Introduced in Android 12. 657 optional bool all_heaps = 21; 658 659 // Profile all processes eligible for profiling on the system. 660 // See 661 // https://perfetto.dev/docs/data-sources/native-heap-profiler#heapprofd-targets 662 // for which processes are eligible. 663 // 664 // On unmodified userdebug builds, this will lead to system crashes. Zygote 665 // will crash when trying to launch a new process as it will have an 666 // unexpected open socket to heapprofd. 667 // 668 // heapprofd will likely be overloaded by the amount of data for low 669 // sampling intervals. 670 optional bool all = 5; 671 672 // Do not profile processes whose anon RSS + swap < given value. 673 // Introduced in Android 11. 674 optional uint32 min_anonymous_memory_kb = 15; 675 676 // Stop profile if heapprofd memory usage goes beyond the given value. 677 // Introduced in Android 11. 678 optional uint32 max_heapprofd_memory_kb = 16; 679 680 // Stop profile if heapprofd CPU time since start of this data-source 681 // goes beyond given value. 682 // Introduced in Android 11. 683 optional uint64 max_heapprofd_cpu_secs = 17; 684 685 // Do not emit function names for mappings starting with this prefix. 686 // E.g. /system to not emit symbols for any system libraries. 687 repeated string skip_symbol_prefix = 7; 688 689 // Dump at a predefined interval. 690 optional ContinuousDumpConfig continuous_dump_config = 6; 691 692 // Size of the shared memory buffer between the profiled processes and 693 // heapprofd. Defaults to 8 MiB. If larger than 500 MiB, truncated to 500 694 // MiB. 695 // 696 // Needs to be: 697 // * at least 8192, 698 // * a power of two, 699 // * a multiple of 4096. 700 optional uint64 shmem_size_bytes = 8; 701 702 // When the shmem buffer is full, block the client instead of ending the 703 // trace. Use with caution as this will significantly slow down the target 704 // process. 705 optional bool block_client = 9; 706 707 // If set, stop the trace session after blocking the client for this 708 // timeout. Needs to be larger than 100 us, otherwise no retries are done. 709 // Introduced in Android 11. 710 optional uint32 block_client_timeout_us = 14; 711 712 // Do not profile processes from startup, only match already running 713 // processes. 714 // 715 // Can not be set at the same time as no_running. 716 // Introduced in Android 11. 717 optional bool no_startup = 10; 718 719 // Do not profile running processes. Only match processes on startup. 720 // 721 // Can not be set at the same time as no_startup. 722 // Introduced in Android 11. 723 optional bool no_running = 11; 724 725 // deprecated idle_allocations. 726 reserved 12; 727 728 // Cause heapprofd to emit a single dump at the end, showing the memory usage 729 // at the point in time when the sampled heap usage of the process was at its 730 // maximum. This causes ProfilePacket.HeapSample.self_max to be set, and 731 // self_allocated and self_freed to not be set. 732 // Introduced in Android 11. 733 optional bool dump_at_max = 13; 734 735 // FEATURE FLAGS. THERE BE DRAGONS. 736 737 // Escape hatch if the session is being torn down because of a forked child 738 // that shares memory space, but is not correctly identified as a vforked 739 // child. 740 // Introduced in Android 11. 741 optional bool disable_fork_teardown = 18; 742 743 // We try to automatically detect when a target applicatation vforks but then 744 // does a memory allocation (or free). This auto-detection can be disabled 745 // with this. 746 // Introduced in Android 11. 747 optional bool disable_vfork_detection = 19; 748} 749 750// End of protos/perfetto/config/profiling/heapprofd_config.proto 751 752// Begin of protos/perfetto/config/profiling/java_hprof_config.proto 753 754// Configuration for go/heapprofd. 755message JavaHprofConfig { 756 // If dump_interval_ms != 0, the following configuration is used. 757 message ContinuousDumpConfig { 758 // ms to wait before first continuous dump. 759 // A dump is always created at the beginning of the trace. 760 optional uint32 dump_phase_ms = 1; 761 // ms to wait between following dumps. 762 optional uint32 dump_interval_ms = 2; 763 } 764 765 // This input is normalized in the following way: if it contains slashes, 766 // everything up to the last slash is discarded. If it contains "@", 767 // everything after the first @ is discared. 768 // E.g. /system/bin/surfaceflinger@1.0 normalizes to surfaceflinger. 769 // This transformation is also applied to the processes' command lines when 770 // matching. 771 repeated string process_cmdline = 1; 772 773 // For watermark based triggering or local debugging. 774 repeated uint64 pid = 2; 775 776 // Only profile target if it was installed by one of the packages given. 777 // Special values are: 778 // * @system: installed on the system partition 779 // * @product: installed on the product partition 780 // * @null: sideloaded 781 // Supported on Android 12+. 782 repeated string target_installed_by = 7; 783 784 // Dump at a predefined interval. 785 optional ContinuousDumpConfig continuous_dump_config = 3; 786 787 // Do not profile processes whose anon RSS + swap < given value. 788 optional uint32 min_anonymous_memory_kb = 4; 789 790 // Include the process' /proc/self/smaps. 791 // This only shows maps that: 792 // * start with /system 793 // * start with /vendor 794 // * start with /data/app 795 // * contain "extracted in memory from Y", where Y matches any of the above 796 optional bool dump_smaps = 5; 797 798 // Exclude objects of the following types from the profile. This can be 799 // useful if lots of uninteresting objects, e.g. "sun.misc.Cleaner". 800 repeated string ignored_types = 6; 801} 802 803// End of protos/perfetto/config/profiling/java_hprof_config.proto 804 805// Begin of protos/perfetto/common/perf_events.proto 806 807message PerfEvents { 808 // What event to sample on, and how often. Commented from the perspective of 809 // its use in |PerfEventConfig|. 810 message Timebase { 811 // How often the per-cpu sampling will occur. Not guaranteed to be honored 812 // as the kernel can throttle the sampling rate if it's too high. 813 // If unset, an implementation-defined default is used. 814 oneof interval { 815 // Per-cpu sampling frequency in Hz, as requested from the kernel. Not the 816 // same as 1/period. 817 // Details: the actual sampling will still be based on a period, but the 818 // kernel will dynamically adjust it based on the observed event rate, to 819 // approximate this frequency. Works best with steady-rate events like 820 // timers. 821 uint64 frequency = 2; 822 823 // Per-cpu sampling will occur every |period| counts of |event|. 824 // Prefer |frequency| by default, as it's easier to oversample with a 825 // fixed period. 826 uint64 period = 1; 827 } 828 829 // Counting event to use as a timebase for the sampling. 830 // If unset, implies the CPU timer (SW_CPU_CLOCK) as the event, 831 // which is what you usually want. 832 // See common/perf_events.proto for the definitions. 833 oneof event { 834 Counter counter = 4; 835 Tracepoint tracepoint = 3; 836 RawEvent raw_event = 5; 837 } 838 839 // If set, samples will be timestamped with the given clock. 840 // If unset, the clock is chosen by the implementation. 841 // For software events, prefer PERF_CLOCK_BOOTTIME. However it cannot be 842 // used for hardware events (due to interrupt safety), for which the 843 // recommendation is to use one of the monotonic clocks. 844 optional PerfClock timestamp_clock = 11; 845 846 // Optional arbitrary name for the event, to identify it in the parsed 847 // trace. Does *not* affect the profiling itself. If unset, the trace 848 // parser will choose a suitable name. 849 optional string name = 10; 850 } 851 852 enum Counter { 853 UNKNOWN_COUNTER = 0; 854 // software: 855 SW_CPU_CLOCK = 1; 856 SW_PAGE_FAULTS = 2; 857 // hardware: 858 HW_CPU_CYCLES = 10; 859 HW_INSTRUCTIONS = 11; 860 } 861 862 message Tracepoint { 863 // Group and name for the tracepoint, acceptable forms: 864 // * "sched/sched_switch" 865 // * "sched:sched_switch" 866 optional string name = 1; 867 868 // Optional field-level filter for the tracepoint. Only events matching this 869 // filter will be counted (and therefore contribute to the sampling period). 870 // Example: "prev_pid >= 42 && next_pid == 0". 871 // For full syntax, see kernel documentation on "Event filtering": 872 // https://www.kernel.org/doc/Documentation/trace/events.txt 873 optional string filter = 2; 874 } 875 876 // Syscall-level description of the event, propagated to the perf_event_attr 877 // struct. Primarily for local use-cases, since the event availability and 878 // encoding is hardware-specific. 879 message RawEvent { 880 optional uint32 type = 1; 881 optional uint64 config = 2; 882 optional uint64 config1 = 3; 883 optional uint64 config2 = 4; 884 } 885 886 // Subset of clocks that is supported by perf timestamping. 887 // CLOCK_TAI is excluded since it's not expected to be used in practice, but 888 // would require additions to the trace clock synchronisation logic. 889 enum PerfClock { 890 UNKNOWN_PERF_CLOCK = 0; 891 PERF_CLOCK_REALTIME = 1; 892 PERF_CLOCK_MONOTONIC = 2; 893 PERF_CLOCK_MONOTONIC_RAW = 3; 894 PERF_CLOCK_BOOTTIME = 4; 895 } 896} 897 898// End of protos/perfetto/common/perf_events.proto 899 900// Begin of protos/perfetto/config/profiling/perf_event_config.proto 901 902// Configuration for the traced_perf profiler. 903// 904// Example config for basic cpu profiling: 905// perf_event_config { 906// timebase { 907// frequency: 80 908// } 909// callstack_sampling { 910// scope { 911// target_cmdline: "surfaceflinger" 912// target_cmdline: "system_server" 913// } 914// kernel_frames: true 915// } 916// } 917// 918// Next id: 19 919message PerfEventConfig { 920 // What event to sample on, and how often. 921 // Defined in common/perf_events.proto. 922 optional PerfEvents.Timebase timebase = 15; 923 924 // If set, the profiler will sample userspace processes' callstacks at the 925 // interval specified by the |timebase|. 926 // If unset, the profiler will record only the event counts. 927 optional CallstackSampling callstack_sampling = 16; 928 929 // 930 // Kernel <-> userspace ring buffer options: 931 // 932 933 // How often the per-cpu ring buffers are read by the producer. 934 // If unset, an implementation-defined default is used. 935 optional uint32 ring_buffer_read_period_ms = 8; 936 937 // Size (in 4k pages) of each per-cpu ring buffer that is filled by the 938 // kernel. If set, must be a power of two. 939 // If unset, an implementation-defined default is used. 940 optional uint32 ring_buffer_pages = 3; 941 942 // 943 // Daemon's resource usage limits: 944 // 945 946 // Drop samples if the heap memory held by the samples in the unwinder queue 947 // is above the given limit. This counts the memory across all concurrent data 948 // sources (not just this one's), and there is no fairness guarantee - the 949 // whole quota might be used up by a concurrent source. 950 optional uint64 max_enqueued_footprint_kb = 17; 951 952 // Stop the data source if traced_perf's combined {RssAnon + Swap} memory 953 // footprint exceeds this value. 954 optional uint32 max_daemon_memory_kb = 13; 955 956 // 957 // Uncommon options: 958 // 959 960 // Timeout for the remote /proc/<pid>/{maps,mem} file descriptors for a 961 // sampled process. This is primarily for Android, where this lookup is 962 // asynchronous. As long as the producer is waiting, the associated samples 963 // will be kept enqueued (putting pressure on the capacity of the shared 964 // unwinding queue). Once a lookup for a process expires, all associated 965 // samples are discarded. However, if the lookup still succeeds after the 966 // timeout, future samples will be handled normally. 967 // If unset, an implementation-defined default is used. 968 optional uint32 remote_descriptor_timeout_ms = 9; 969 970 // Optional period for clearing state cached by the unwinder. This is a heavy 971 // operation that is only necessary for traces that target a wide set of 972 // processes, and require the memory footprint to be reset periodically. 973 // If unset, the cached state will not be cleared. 974 optional uint32 unwind_state_clear_period_ms = 10; 975 976 // If set, only profile target if it was installed by a package with one of 977 // these names. Special values: 978 // * "@system": installed on the system partition 979 // * "@product": installed on the product partition 980 // * "@null": sideloaded 981 // Supported on Android 12+. 982 repeated string target_installed_by = 18; 983 984 // 985 // Deprecated (superseded by options above): 986 // 987 // Do not set *any* of these fields in new configs. 988 // 989 990 // Note: legacy configs had to set |all_cpus| to true to pass parsing. 991 // We rely on this to detect such configs. 992 optional bool all_cpus = 1; 993 optional uint32 sampling_frequency = 2; 994 optional bool kernel_frames = 12; 995 repeated int32 target_pid = 4; 996 repeated string target_cmdline = 5; 997 repeated int32 exclude_pid = 6; 998 repeated string exclude_cmdline = 7; 999 optional uint32 additional_cmdline_count = 11; 1000 // previously |tracepoint| 1001 reserved 14; 1002 1003 // 1004 // Sub-messages (nested for generated code namespacing). 1005 // 1006 1007 message CallstackSampling { 1008 // Defines a set of processes for which samples are retained/skipped. If 1009 // unset, all userspace samples are kept, but beware that it will be very 1010 // heavy on the stack unwinder, which might start dropping samples due to 1011 // overload. 1012 optional Scope scope = 1; 1013 1014 // If true, callstacks will include the kernel-space frames. Such frames can 1015 // be identified by a magical "kernel" string as their mapping name. 1016 // Requires traced_perf to be running as root, or kptr_restrict to have been 1017 // manually unrestricted. On Android, the platform should do the right thing 1018 // on debug builds. 1019 // This does *not* disclose KASLR, as only the function names are emitted. 1020 optional bool kernel_frames = 2; 1021 } 1022 1023 message Scope { 1024 // Process ID (TGID) allowlist. If this list is not empty, only matching 1025 // samples will be retained. If multiple allow/deny-lists are 1026 // specified by the config, then all of them are evaluated for each sampled 1027 // process. 1028 repeated int32 target_pid = 1; 1029 1030 // Command line allowlist, matched against the 1031 // /proc/<pid>/cmdline (not the comm string), with both sides being 1032 // "normalized". Normalization is as follows: (1) trim everything beyond the 1033 // first null or "@" byte; (2) if the string contains forward slashes, trim 1034 // everything up to and including the last one. 1035 repeated string target_cmdline = 2; 1036 1037 // List of excluded pids. 1038 repeated int32 exclude_pid = 3; 1039 1040 // List of excluded cmdlines. Normalized in the same way as 1041 // |target_cmdline|. 1042 repeated string exclude_cmdline = 4; 1043 1044 // Number of additional command lines to sample. Only those which are 1045 // neither explicitly included nor excluded will be considered. Processes 1046 // are accepted on a first come, first served basis. 1047 optional uint32 additional_cmdline_count = 5; 1048 } 1049} 1050 1051// End of protos/perfetto/config/profiling/perf_event_config.proto 1052 1053// Begin of protos/perfetto/common/sys_stats_counters.proto 1054 1055// When editing entries here remember also to update "sys_stats_counters.h" with 1056// the corresponding string definitions for the actual /proc files parser. 1057 1058// Counter definitions for Linux's /proc/meminfo. 1059enum MeminfoCounters { 1060 MEMINFO_UNSPECIFIED = 0; 1061 MEMINFO_MEM_TOTAL = 1; 1062 MEMINFO_MEM_FREE = 2; 1063 MEMINFO_MEM_AVAILABLE = 3; 1064 MEMINFO_BUFFERS = 4; 1065 MEMINFO_CACHED = 5; 1066 MEMINFO_SWAP_CACHED = 6; 1067 MEMINFO_ACTIVE = 7; 1068 MEMINFO_INACTIVE = 8; 1069 MEMINFO_ACTIVE_ANON = 9; 1070 MEMINFO_INACTIVE_ANON = 10; 1071 MEMINFO_ACTIVE_FILE = 11; 1072 MEMINFO_INACTIVE_FILE = 12; 1073 MEMINFO_UNEVICTABLE = 13; 1074 MEMINFO_MLOCKED = 14; 1075 MEMINFO_SWAP_TOTAL = 15; 1076 MEMINFO_SWAP_FREE = 16; 1077 MEMINFO_DIRTY = 17; 1078 MEMINFO_WRITEBACK = 18; 1079 MEMINFO_ANON_PAGES = 19; 1080 MEMINFO_MAPPED = 20; 1081 MEMINFO_SHMEM = 21; 1082 MEMINFO_SLAB = 22; 1083 MEMINFO_SLAB_RECLAIMABLE = 23; 1084 MEMINFO_SLAB_UNRECLAIMABLE = 24; 1085 MEMINFO_KERNEL_STACK = 25; 1086 MEMINFO_PAGE_TABLES = 26; 1087 MEMINFO_COMMIT_LIMIT = 27; 1088 MEMINFO_COMMITED_AS = 28; 1089 MEMINFO_VMALLOC_TOTAL = 29; 1090 MEMINFO_VMALLOC_USED = 30; 1091 MEMINFO_VMALLOC_CHUNK = 31; 1092 MEMINFO_CMA_TOTAL = 32; 1093 MEMINFO_CMA_FREE = 33; 1094} 1095 1096// Counter definitions for Linux's /proc/vmstat. 1097enum VmstatCounters { 1098 VMSTAT_UNSPECIFIED = 0; 1099 VMSTAT_NR_FREE_PAGES = 1; 1100 VMSTAT_NR_ALLOC_BATCH = 2; 1101 VMSTAT_NR_INACTIVE_ANON = 3; 1102 VMSTAT_NR_ACTIVE_ANON = 4; 1103 VMSTAT_NR_INACTIVE_FILE = 5; 1104 VMSTAT_NR_ACTIVE_FILE = 6; 1105 VMSTAT_NR_UNEVICTABLE = 7; 1106 VMSTAT_NR_MLOCK = 8; 1107 VMSTAT_NR_ANON_PAGES = 9; 1108 VMSTAT_NR_MAPPED = 10; 1109 VMSTAT_NR_FILE_PAGES = 11; 1110 VMSTAT_NR_DIRTY = 12; 1111 VMSTAT_NR_WRITEBACK = 13; 1112 VMSTAT_NR_SLAB_RECLAIMABLE = 14; 1113 VMSTAT_NR_SLAB_UNRECLAIMABLE = 15; 1114 VMSTAT_NR_PAGE_TABLE_PAGES = 16; 1115 VMSTAT_NR_KERNEL_STACK = 17; 1116 VMSTAT_NR_OVERHEAD = 18; 1117 VMSTAT_NR_UNSTABLE = 19; 1118 VMSTAT_NR_BOUNCE = 20; 1119 VMSTAT_NR_VMSCAN_WRITE = 21; 1120 VMSTAT_NR_VMSCAN_IMMEDIATE_RECLAIM = 22; 1121 VMSTAT_NR_WRITEBACK_TEMP = 23; 1122 VMSTAT_NR_ISOLATED_ANON = 24; 1123 VMSTAT_NR_ISOLATED_FILE = 25; 1124 VMSTAT_NR_SHMEM = 26; 1125 VMSTAT_NR_DIRTIED = 27; 1126 VMSTAT_NR_WRITTEN = 28; 1127 VMSTAT_NR_PAGES_SCANNED = 29; 1128 VMSTAT_WORKINGSET_REFAULT = 30; 1129 VMSTAT_WORKINGSET_ACTIVATE = 31; 1130 VMSTAT_WORKINGSET_NODERECLAIM = 32; 1131 VMSTAT_NR_ANON_TRANSPARENT_HUGEPAGES = 33; 1132 VMSTAT_NR_FREE_CMA = 34; 1133 VMSTAT_NR_SWAPCACHE = 35; 1134 VMSTAT_NR_DIRTY_THRESHOLD = 36; 1135 VMSTAT_NR_DIRTY_BACKGROUND_THRESHOLD = 37; 1136 VMSTAT_PGPGIN = 38; 1137 VMSTAT_PGPGOUT = 39; 1138 VMSTAT_PGPGOUTCLEAN = 40; 1139 VMSTAT_PSWPIN = 41; 1140 VMSTAT_PSWPOUT = 42; 1141 VMSTAT_PGALLOC_DMA = 43; 1142 VMSTAT_PGALLOC_NORMAL = 44; 1143 VMSTAT_PGALLOC_MOVABLE = 45; 1144 VMSTAT_PGFREE = 46; 1145 VMSTAT_PGACTIVATE = 47; 1146 VMSTAT_PGDEACTIVATE = 48; 1147 VMSTAT_PGFAULT = 49; 1148 VMSTAT_PGMAJFAULT = 50; 1149 VMSTAT_PGREFILL_DMA = 51; 1150 VMSTAT_PGREFILL_NORMAL = 52; 1151 VMSTAT_PGREFILL_MOVABLE = 53; 1152 VMSTAT_PGSTEAL_KSWAPD_DMA = 54; 1153 VMSTAT_PGSTEAL_KSWAPD_NORMAL = 55; 1154 VMSTAT_PGSTEAL_KSWAPD_MOVABLE = 56; 1155 VMSTAT_PGSTEAL_DIRECT_DMA = 57; 1156 VMSTAT_PGSTEAL_DIRECT_NORMAL = 58; 1157 VMSTAT_PGSTEAL_DIRECT_MOVABLE = 59; 1158 VMSTAT_PGSCAN_KSWAPD_DMA = 60; 1159 VMSTAT_PGSCAN_KSWAPD_NORMAL = 61; 1160 VMSTAT_PGSCAN_KSWAPD_MOVABLE = 62; 1161 VMSTAT_PGSCAN_DIRECT_DMA = 63; 1162 VMSTAT_PGSCAN_DIRECT_NORMAL = 64; 1163 VMSTAT_PGSCAN_DIRECT_MOVABLE = 65; 1164 VMSTAT_PGSCAN_DIRECT_THROTTLE = 66; 1165 VMSTAT_PGINODESTEAL = 67; 1166 VMSTAT_SLABS_SCANNED = 68; 1167 VMSTAT_KSWAPD_INODESTEAL = 69; 1168 VMSTAT_KSWAPD_LOW_WMARK_HIT_QUICKLY = 70; 1169 VMSTAT_KSWAPD_HIGH_WMARK_HIT_QUICKLY = 71; 1170 VMSTAT_PAGEOUTRUN = 72; 1171 VMSTAT_ALLOCSTALL = 73; 1172 VMSTAT_PGROTATED = 74; 1173 VMSTAT_DROP_PAGECACHE = 75; 1174 VMSTAT_DROP_SLAB = 76; 1175 VMSTAT_PGMIGRATE_SUCCESS = 77; 1176 VMSTAT_PGMIGRATE_FAIL = 78; 1177 VMSTAT_COMPACT_MIGRATE_SCANNED = 79; 1178 VMSTAT_COMPACT_FREE_SCANNED = 80; 1179 VMSTAT_COMPACT_ISOLATED = 81; 1180 VMSTAT_COMPACT_STALL = 82; 1181 VMSTAT_COMPACT_FAIL = 83; 1182 VMSTAT_COMPACT_SUCCESS = 84; 1183 VMSTAT_COMPACT_DAEMON_WAKE = 85; 1184 VMSTAT_UNEVICTABLE_PGS_CULLED = 86; 1185 VMSTAT_UNEVICTABLE_PGS_SCANNED = 87; 1186 VMSTAT_UNEVICTABLE_PGS_RESCUED = 88; 1187 VMSTAT_UNEVICTABLE_PGS_MLOCKED = 89; 1188 VMSTAT_UNEVICTABLE_PGS_MUNLOCKED = 90; 1189 VMSTAT_UNEVICTABLE_PGS_CLEARED = 91; 1190 VMSTAT_UNEVICTABLE_PGS_STRANDED = 92; 1191 VMSTAT_NR_ZSPAGES = 93; 1192 VMSTAT_NR_ION_HEAP = 94; 1193 VMSTAT_NR_GPU_HEAP = 95; 1194 VMSTAT_ALLOCSTALL_DMA = 96; 1195 VMSTAT_ALLOCSTALL_MOVABLE = 97; 1196 VMSTAT_ALLOCSTALL_NORMAL = 98; 1197 VMSTAT_COMPACT_DAEMON_FREE_SCANNED = 99; 1198 VMSTAT_COMPACT_DAEMON_MIGRATE_SCANNED = 100; 1199 VMSTAT_NR_FASTRPC = 101; 1200 VMSTAT_NR_INDIRECTLY_RECLAIMABLE = 102; 1201 VMSTAT_NR_ION_HEAP_POOL = 103; 1202 VMSTAT_NR_KERNEL_MISC_RECLAIMABLE = 104; 1203 VMSTAT_NR_SHADOW_CALL_STACK_BYTES = 105; 1204 VMSTAT_NR_SHMEM_HUGEPAGES = 106; 1205 VMSTAT_NR_SHMEM_PMDMAPPED = 107; 1206 VMSTAT_NR_UNRECLAIMABLE_PAGES = 108; 1207 VMSTAT_NR_ZONE_ACTIVE_ANON = 109; 1208 VMSTAT_NR_ZONE_ACTIVE_FILE = 110; 1209 VMSTAT_NR_ZONE_INACTIVE_ANON = 111; 1210 VMSTAT_NR_ZONE_INACTIVE_FILE = 112; 1211 VMSTAT_NR_ZONE_UNEVICTABLE = 113; 1212 VMSTAT_NR_ZONE_WRITE_PENDING = 114; 1213 VMSTAT_OOM_KILL = 115; 1214 VMSTAT_PGLAZYFREE = 116; 1215 VMSTAT_PGLAZYFREED = 117; 1216 VMSTAT_PGREFILL = 118; 1217 VMSTAT_PGSCAN_DIRECT = 119; 1218 VMSTAT_PGSCAN_KSWAPD = 120; 1219 VMSTAT_PGSKIP_DMA = 121; 1220 VMSTAT_PGSKIP_MOVABLE = 122; 1221 VMSTAT_PGSKIP_NORMAL = 123; 1222 VMSTAT_PGSTEAL_DIRECT = 124; 1223 VMSTAT_PGSTEAL_KSWAPD = 125; 1224 VMSTAT_SWAP_RA = 126; 1225 VMSTAT_SWAP_RA_HIT = 127; 1226 VMSTAT_WORKINGSET_RESTORE = 128; 1227} 1228// End of protos/perfetto/common/sys_stats_counters.proto 1229 1230// Begin of protos/perfetto/config/sys_stats/sys_stats_config.proto 1231 1232// This file defines the configuration for the Linux /proc poller data source, 1233// which injects counters in the trace. 1234// Counters that are needed in the trace must be explicitly listed in the 1235// *_counters fields. This is to avoid spamming the trace with all counters 1236// at all times. 1237// The sampling rate is configurable. All polling rates (*_period_ms) need 1238// to be integer multiples of each other. 1239// OK: [10ms, 10ms, 10ms], [10ms, 20ms, 10ms], [10ms, 20ms, 60ms] 1240// Not OK: [10ms, 10ms, 11ms], [10ms, 15ms, 20ms] 1241message SysStatsConfig { 1242 // Polls /proc/meminfo every X ms, if non-zero. 1243 // This is required to be > 10ms to avoid excessive CPU usage. 1244 // Cost: 0.3 ms [read] + 0.07 ms [parse + trace injection] 1245 optional uint32 meminfo_period_ms = 1; 1246 1247 // If empty all known counters are reported. Otherwise, only the counters 1248 // specified below are reported. 1249 repeated MeminfoCounters meminfo_counters = 2; 1250 1251 // Polls /proc/vmstat every X ms, if non-zero. 1252 // This is required to be > 10ms to avoid excessive CPU usage. 1253 // Cost: 0.2 ms [read] + 0.3 ms [parse + trace injection] 1254 optional uint32 vmstat_period_ms = 3; 1255 repeated VmstatCounters vmstat_counters = 4; 1256 1257 // Pols /proc/stat every X ms, if non-zero. 1258 // This is required to be > 10ms to avoid excessive CPU usage. 1259 // Cost: 4.1 ms [read] + 1.9 ms [parse + trace injection] 1260 optional uint32 stat_period_ms = 5; 1261 enum StatCounters { 1262 STAT_UNSPECIFIED = 0; 1263 STAT_CPU_TIMES = 1; 1264 STAT_IRQ_COUNTS = 2; 1265 STAT_SOFTIRQ_COUNTS = 3; 1266 STAT_FORK_COUNT = 4; 1267 } 1268 repeated StatCounters stat_counters = 6; 1269 1270 // Polls /sys/devfreq/*/curfreq every X ms, if non-zero. 1271 // This is required to be > 10ms to avoid excessive CPU usage. 1272 // This option can be used to record unchanging values. 1273 // Updates from frequency changes can come from ftrace/set_clock_rate. 1274 optional uint32 devfreq_period_ms = 7; 1275} 1276 1277// End of protos/perfetto/config/sys_stats/sys_stats_config.proto 1278 1279// Begin of protos/perfetto/config/test_config.proto 1280 1281// The configuration for a fake producer used in tests. 1282message TestConfig { 1283 message DummyFields { 1284 optional uint32 field_uint32 = 1; 1285 optional int32 field_int32 = 2; 1286 optional uint64 field_uint64 = 3; 1287 optional int64 field_int64 = 4; 1288 optional fixed64 field_fixed64 = 5; 1289 optional sfixed64 field_sfixed64 = 6; 1290 optional fixed32 field_fixed32 = 7; 1291 optional sfixed32 field_sfixed32 = 8; 1292 optional double field_double = 9; 1293 optional float field_float = 10; 1294 optional sint64 field_sint64 = 11; 1295 optional sint32 field_sint32 = 12; 1296 optional string field_string = 13; 1297 optional bytes field_bytes = 14; 1298 } 1299 1300 // The number of messages the fake producer should send. 1301 optional uint32 message_count = 1; 1302 1303 // The maximum number of messages which should be sent each second. 1304 // The actual obserced speed may be lower if the producer is unable to 1305 // work fast enough. 1306 // If this is zero or unset, the producer will send as fast as possible. 1307 optional uint32 max_messages_per_second = 2; 1308 1309 // The seed value for a simple multiplicative congruential pseudo-random 1310 // number sequence. 1311 optional uint32 seed = 3; 1312 1313 // The size of each message in bytes. Should be greater than or equal 5 to 1314 // account for the number of bytes needed to encode the random number and a 1315 // null byte for the string. 1316 optional uint32 message_size = 4; 1317 1318 // Whether the producer should send a event batch when the data source is 1319 // is initially registered. 1320 optional bool send_batch_on_register = 5; 1321 1322 optional DummyFields dummy_fields = 6; 1323} 1324 1325// End of protos/perfetto/config/test_config.proto 1326 1327// Begin of protos/perfetto/config/track_event/track_event_config.proto 1328 1329message TrackEventConfig { 1330 // The following fields define the set of enabled trace categories. Each list 1331 // item is a glob. 1332 // 1333 // To determine if category is enabled, it is checked against the filters in 1334 // the following order: 1335 // 1336 // 1. Exact matches in enabled categories. 1337 // 2. Exact matches in enabled tags. 1338 // 3. Exact matches in disabled categories. 1339 // 4. Exact matches in disabled tags. 1340 // 5. Pattern matches in enabled categories. 1341 // 6. Pattern matches in enabled tags. 1342 // 7. Pattern matches in disabled categories. 1343 // 8. Pattern matches in disabled tags. 1344 // 1345 // If none of the steps produced a match, the category is enabled by default. 1346 // 1347 // Examples: 1348 // 1349 // - To enable all non-slow/debug categories: 1350 // 1351 // No configuration needed, happens by default. 1352 // 1353 // - To enable a specific category: 1354 // 1355 // disabled_categories = ["*"] 1356 // enabled_categories = ["my_category"] 1357 // 1358 // - To enable only categories with a specific tag: 1359 // 1360 // disabled_tags = ["*"] 1361 // enabled_tags = ["my_tag"] 1362 // 1363 1364 // Default: [] 1365 repeated string disabled_categories = 1; 1366 1367 // Default: [] 1368 repeated string enabled_categories = 2; 1369 1370 // Default: ["slow", "debug"] 1371 repeated string disabled_tags = 3; 1372 1373 // Default: [] 1374 repeated string enabled_tags = 4; 1375} 1376 1377// End of protos/perfetto/config/track_event/track_event_config.proto 1378 1379// Begin of protos/perfetto/config/data_source_config.proto 1380 1381// The configuration that is passed to each data source when starting tracing. 1382// Next id: 116 1383message DataSourceConfig { 1384 enum SessionInitiator { 1385 SESSION_INITIATOR_UNSPECIFIED = 0; 1386 // This trace was initiated from a trusted system app has DUMP and 1387 // USAGE_STATS permission. This system app is expected to not expose the 1388 // trace to the user of the device. 1389 // This is determined by checking the UID initiating the trace. 1390 SESSION_INITIATOR_TRUSTED_SYSTEM = 1; 1391 }; 1392 // Data source unique name, e.g., "linux.ftrace". This must match 1393 // the name passed by the data source when it registers (see 1394 // RegisterDataSource()). 1395 optional string name = 1; 1396 1397 // The index of the logging buffer where TracePacket(s) will be stored. 1398 // This field doesn't make a major difference for the Producer(s). The final 1399 // logging buffers, in fact, are completely owned by the Service. We just ask 1400 // the Producer to copy this number into the chunk headers it emits, so that 1401 // the Service can quickly identify the buffer where to move the chunks into 1402 // without expensive lookups on its fastpath. 1403 optional uint32 target_buffer = 2; 1404 1405 // Set by the service to indicate the duration of the trace. 1406 // DO NOT SET in consumer as this will be overridden by the service. 1407 optional uint32 trace_duration_ms = 3; 1408 1409 // Set by the service to indicate how long it waits after StopDataSource. 1410 // DO NOT SET in consumer as this will be overridden by the service. 1411 optional uint32 stop_timeout_ms = 7; 1412 1413 // Set by the service to indicate whether this tracing session has extra 1414 // guardrails. 1415 // DO NOT SET in consumer as this will be overridden by the service. 1416 optional bool enable_extra_guardrails = 6; 1417 1418 // Set by the service to indicate which user initiated this trace. 1419 // DO NOT SET in consumer as this will be overridden by the service. 1420 optional SessionInitiator session_initiator = 8; 1421 1422 // Set by the service to indicate which tracing session the data source 1423 // belongs to. The intended use case for this is checking if two data sources, 1424 // one of which produces metadata for the other one, belong to the same trace 1425 // session and hence should be linked together. 1426 // This field was introduced in Aug 2018 after Android P. 1427 // DO NOT SET in consumer as this will be overridden by the service. 1428 optional uint64 tracing_session_id = 4; 1429 1430 // Keeep the lower IDs (up to 99) for fields that are *not* specific to 1431 // data-sources and needs to be processed by the traced daemon. 1432 1433 // All data source config fields must be marked as [lazy=true]. This prevents 1434 // the proto-to-cpp generator from recursing into those when generating the 1435 // cpp classes and polluting tracing/core with data-source-specific classes. 1436 // Instead they are treated as opaque strings containing raw proto bytes. 1437 1438 // Data source name: linux.ftrace 1439 optional FtraceConfig ftrace_config = 100 [lazy = true]; 1440 // Data source name: linux.inode_file_map 1441 optional InodeFileConfig inode_file_config = 102 [lazy = true]; 1442 // Data source name: linux.process_stats 1443 optional ProcessStatsConfig process_stats_config = 103 [lazy = true]; 1444 // Data source name: linux.sys_stats 1445 optional SysStatsConfig sys_stats_config = 104 [lazy = true]; 1446 // Data source name: android.heapprofd 1447 // Introduced in Android 10. 1448 optional HeapprofdConfig heapprofd_config = 105 [lazy = true]; 1449 // Data source name: android.java_hprof 1450 // Introduced in Android 11. 1451 optional JavaHprofConfig java_hprof_config = 110 [lazy = true]; 1452 // Data source name: android.power 1453 optional AndroidPowerConfig android_power_config = 106 [lazy = true]; 1454 // Data source name: android.log 1455 optional AndroidLogConfig android_log_config = 107 [lazy = true]; 1456 // TODO(fmayer): Add data source name for this. 1457 optional GpuCounterConfig gpu_counter_config = 108 [lazy = true]; 1458 // Data source name: android.packages_list 1459 optional PackagesListConfig packages_list_config = 109 [lazy = true]; 1460 // Data source name: linux.perf 1461 optional PerfEventConfig perf_event_config = 111 [lazy = true]; 1462 // Data source name: vulkan.memory_tracker 1463 optional VulkanMemoryConfig vulkan_memory_config = 112 [lazy = true]; 1464 // Data source name: track_event 1465 optional TrackEventConfig track_event_config = 113 [lazy = true]; 1466 // Data source name: android.polled_state 1467 optional AndroidPolledStateConfig android_polled_state_config = 114 1468 [lazy = true]; 1469 1470 // Chrome is special as it doesn't use the perfetto IPC layer. We want to 1471 // avoid proto serialization and de-serialization there because that would 1472 // just add extra hops on top of the Mojo ser/des. Instead we auto-generate a 1473 // C++ class for it so it can pass around plain C++ objets. 1474 optional ChromeConfig chrome_config = 101; 1475 1476 // If an interceptor is specified here, packets for this data source will be 1477 // rerouted to the interceptor instead of the main trace buffer. This can be 1478 // used, for example, to write trace data into ETW or for logging trace points 1479 // to the console. 1480 // 1481 // Note that interceptors are only supported by data sources registered 1482 // through the Perfetto SDK API. Data sources that don't use that API (e.g., 1483 // traced_probes) may not support interception. 1484 optional InterceptorConfig interceptor_config = 115; 1485 1486 // This is a fallback mechanism to send a free-form text config to the 1487 // producer. In theory this should never be needed. All the code that 1488 // is part of the platform (i.e. traced service) is supposed to *not* truncate 1489 // the trace config proto and propagate unknown fields. However, if anything 1490 // in the pipeline (client or backend) ends up breaking this forward compat 1491 // plan, this field will become the escape hatch to allow future data sources 1492 // to get some meaningful configuration. 1493 optional string legacy_config = 1000; 1494 1495 // This field is only used for testing. 1496 optional TestConfig for_testing = 1001; 1497 1498 // Was |for_testing|. Caused more problems then found. 1499 reserved 268435455; 1500} 1501 1502// End of protos/perfetto/config/data_source_config.proto 1503 1504// Begin of protos/perfetto/config/trace_config.proto 1505 1506// The overall config that is used when starting a new tracing session through 1507// ProducerPort::StartTracing(). 1508// It contains the general config for the logging buffer(s) and the configs for 1509// all the data source being enabled. 1510// 1511// Next id: 33. 1512message TraceConfig { 1513 message BufferConfig { 1514 optional uint32 size_kb = 1; 1515 1516 // |page_size|, now deprecated. 1517 reserved 2; 1518 1519 // |optimize_for|, now deprecated. 1520 reserved 3; 1521 1522 enum FillPolicy { 1523 UNSPECIFIED = 0; 1524 1525 // Default behavior. The buffer operates as a conventional ring buffer. 1526 // If the writer is faster than the reader (or if the reader reads only 1527 // after tracing is stopped) newly written packets will overwrite old 1528 // packets. 1529 RING_BUFFER = 1; 1530 1531 // Behaves like RING_BUFFER as long as there is space in the buffer or 1532 // the reader catches up with the writer. As soon as the writer hits 1533 // an unread chunk, it stops accepting new data in the buffer. 1534 DISCARD = 2; 1535 } 1536 optional FillPolicy fill_policy = 4; 1537 } 1538 repeated BufferConfig buffers = 1; 1539 1540 message DataSource { 1541 // Filters and data-source specific config. It contains also the unique name 1542 // of the data source, the one passed in the DataSourceDescriptor when they 1543 // register on the service. 1544 optional protos.DataSourceConfig config = 1; 1545 1546 // Optional. If multiple producers (~processes) expose the same data source 1547 // and either |producer_name_filter| or |producer_name_regex_filter| is set, 1548 // the data source is enabled only for producers whose names match any of 1549 // the filters. 1550 // |producer_name_filter| has to be an exact match, while 1551 // |producer_name_regex_filter| is a regular expression. 1552 // This allows to enable a data source only for specific processes. 1553 // The "repeated" fields have OR semantics: specifying a filter ["foo", 1554 // "bar"] will enable data sources on both "foo" and "bar" (if they exist). 1555 repeated string producer_name_filter = 2; 1556 repeated string producer_name_regex_filter = 3; 1557 } 1558 repeated DataSource data_sources = 2; 1559 1560 // Config for disabling builtin data sources in the tracing service. 1561 message BuiltinDataSource { 1562 // Disable emitting clock timestamps into the trace. 1563 optional bool disable_clock_snapshotting = 1; 1564 1565 // Disable echoing the original trace config in the trace. 1566 optional bool disable_trace_config = 2; 1567 1568 // Disable emitting system info (build fingerprint, cpuinfo, etc). 1569 optional bool disable_system_info = 3; 1570 1571 // Disable emitting events for data-source state changes (e.g. the marker 1572 // for all data sources having ACKed the start of the trace). 1573 optional bool disable_service_events = 4; 1574 1575 // The authoritative clock domain for the trace. Defaults to BOOTTIME. See 1576 // also ClockSnapshot's primary_trace_clock. The configured value is written 1577 // into the trace as part of the ClockSnapshots emitted by the service. 1578 // Trace processor will attempt to translate packet/event timestamps from 1579 // various data sources (and their chosen clock domains) to this domain 1580 // during import. Added in Android R. 1581 optional BuiltinClock primary_trace_clock = 5; 1582 1583 // Time interval in between snapshotting of sync markers, clock snapshots, 1584 // stats, and other periodic service-emitted events. Note that the service 1585 // only keeps track of the first and the most recent snapshot until 1586 // ReadBuffers() is called. 1587 optional uint32 snapshot_interval_ms = 6; 1588 1589 // Hints to the service that a suspend-aware (i.e. counting time in suspend) 1590 // clock should be used for periodic snapshots of service-emitted events. 1591 // This means, if a snapshot *should* have happened during suspend, it will 1592 // happen immediately after the device resumes. 1593 // 1594 // Choosing a clock like this is done on best-effort basis; not all 1595 // platforms (e.g. Windows) expose a clock which can be used for periodic 1596 // tasks counting suspend. If such a clock is not available, the service 1597 // falls back to the best-available alternative. 1598 // 1599 // Introduced in Android S. 1600 // TODO(lalitm): deprecate this in T and make this the default if nothing 1601 // crashes in S. 1602 optional bool prefer_suspend_clock_for_snapshot = 7; 1603 } 1604 optional BuiltinDataSource builtin_data_sources = 20; 1605 1606 // If specified, the trace will be stopped |duration_ms| after starting. 1607 // This does *not* count the time the system is suspended, so we will run 1608 // for duration_ms of system activity, not wall time. 1609 // 1610 // However in case of traces with triggers, see 1611 // TriggerConfig.trigger_timeout_ms instead. 1612 optional uint32 duration_ms = 3; 1613 1614 // This is set when --dropbox is passed to the Perfetto command line client 1615 // and enables guardrails that limit resource usage for traces requested 1616 // by statsd. 1617 optional bool enable_extra_guardrails = 4; 1618 1619 enum LockdownModeOperation { 1620 LOCKDOWN_UNCHANGED = 0; 1621 LOCKDOWN_CLEAR = 1; 1622 LOCKDOWN_SET = 2; 1623 } 1624 // Reject producers that are not running under the same UID as the tracing 1625 // service. 1626 optional LockdownModeOperation lockdown_mode = 5; 1627 1628 message ProducerConfig { 1629 // Identifies the producer for which this config is for. 1630 optional string producer_name = 1; 1631 1632 // Specifies the preferred size of the shared memory buffer. If the size is 1633 // larger than the max size, the max will be used. If it is smaller than 1634 // the page size or doesn't fit pages evenly into it, it will fall back to 1635 // the size specified by the producer or finally the default shared memory 1636 // size. 1637 optional uint32 shm_size_kb = 2; 1638 1639 // Specifies the preferred size of each page in the shared memory buffer. 1640 // Must be an integer multiple of 4K. 1641 optional uint32 page_size_kb = 3; 1642 } 1643 1644 repeated ProducerConfig producers = 6; 1645 1646 // Contains statsd-specific metadata about an alert associated with the trace. 1647 message StatsdMetadata { 1648 // The identifier of the alert which triggered this trace. 1649 optional int64 triggering_alert_id = 1; 1650 // The uid which registered the triggering configuration with statsd. 1651 optional int32 triggering_config_uid = 2; 1652 // The identifier of the config which triggered the alert. 1653 optional int64 triggering_config_id = 3; 1654 // The identifier of the subscription which triggered this trace. 1655 optional int64 triggering_subscription_id = 4; 1656 } 1657 1658 // Statsd-specific metadata. 1659 optional StatsdMetadata statsd_metadata = 7; 1660 1661 // When true && |output_path| is empty, the EnableTracing() request must 1662 // provide a file descriptor. The service will then periodically read packets 1663 // out of the trace buffer and store it into the passed file. 1664 // If |output_path| is not empty no fd should be passed, the service 1665 // will create a new file and write into that (see comment below). 1666 optional bool write_into_file = 8; 1667 1668 // This must point to a non-existing file. If the file exists the service 1669 // will NOT overwrite and will fail instead as a security precaution. 1670 // On Android, when this is used with the system traced, the path must be 1671 // within /data/misc/perfetto-traces/ or the trace will fail. 1672 // This option has been introduced in Android R. Before R write_into_file 1673 // can be used only with the "pass a file descriptor over IPC" mode. 1674 optional string output_path = 29; 1675 1676 // Optional. If non-zero tunes the write period. A min value of 100ms is 1677 // enforced (i.e. smaller values are ignored). 1678 optional uint32 file_write_period_ms = 9; 1679 1680 // Optional. When non zero the periodic write stops once at most X bytes 1681 // have been written into the file. Tracing is disabled when this limit is 1682 // reached, even if |duration_ms| has not been reached yet. 1683 optional uint64 max_file_size_bytes = 10; 1684 1685 // Contains flags which override the default values of the guardrails inside 1686 // Perfetto. 1687 message GuardrailOverrides { 1688 // Override the default limit (in bytes) for uploading data to server within 1689 // a 24 hour period. 1690 // On R-, this override only affected userdebug builds. Since S, it also 1691 // affects user builds. 1692 optional uint64 max_upload_per_day_bytes = 1; 1693 } 1694 optional GuardrailOverrides guardrail_overrides = 11; 1695 1696 // When true, data sources are not started until an explicit call to 1697 // StartTracing() on the consumer port. This is to support early 1698 // initialization and fast trace triggering. This can be used only when the 1699 // Consumer explicitly triggers the StartTracing() method. 1700 // This should not be used in a remote trace config via statsd, doing so will 1701 // result in a hung trace session. 1702 optional bool deferred_start = 12; 1703 1704 // When set, it periodically issues a Flush() to all data source, forcing them 1705 // to commit their data into the tracing service. This can be used for 1706 // quasi-real-time streaming mode and to guarantee some partial ordering of 1707 // events in the trace in windows of X ms. 1708 optional uint32 flush_period_ms = 13; 1709 1710 // Wait for this long for producers to acknowledge flush requests. 1711 // Default 5s. 1712 optional uint32 flush_timeout_ms = 14; 1713 1714 // Wait for this long for producers to acknowledge stop requests. 1715 // Default 5s. 1716 optional uint32 data_source_stop_timeout_ms = 23; 1717 1718 // |disable_clock_snapshotting| moved. 1719 reserved 15; 1720 1721 // Android-only. If set, sends an intent to the Traceur system app when the 1722 // trace ends to notify it about the trace readiness. 1723 optional bool notify_traceur = 16; 1724 1725 // Android-only. If set to a value > 0, marks the trace session as a candidate 1726 // for being attached to a bugreport. This field effectively acts as a z-index 1727 // for bugreports. When Android's dumpstate runs perfetto 1728 // --save-for-bugreport, traced will pick the tracing session with the highest 1729 // score (score <= 0 is ignored), will steal its contents, save the trace into 1730 // a known path and stop prematurely. 1731 // This field was introduced in Android S. 1732 optional int32 bugreport_score = 30; 1733 1734 // Triggers allow producers to start or stop the tracing session when an event 1735 // occurs. 1736 // 1737 // For example if we are tracing probabilistically, most traces will be 1738 // uninteresting. Triggers allow us to keep only the interesting ones such as 1739 // those traces during which the device temperature reached a certain 1740 // threshold. In this case the producer can activate a trigger to keep 1741 // (STOP_TRACING) the trace, otherwise it can also begin a trace 1742 // (START_TRACING) because it knows something is about to happen. 1743 message TriggerConfig { 1744 enum TriggerMode { 1745 UNSPECIFIED = 0; 1746 1747 // When this mode is chosen, data sources are not started until one of the 1748 // |triggers| are received. This supports early initialization and fast 1749 // starting of the tracing system. On triggering, the session will then 1750 // record for |stop_delay_ms|. However if no trigger is seen 1751 // after |trigger_timeout_ms| the session will be stopped and no data will 1752 // be returned. 1753 START_TRACING = 1; 1754 1755 // When this mode is chosen, the session will be started via the normal 1756 // EnableTracing() & StartTracing(). If no trigger is ever seen 1757 // the session will be stopped after |trigger_timeout_ms| and no data will 1758 // be returned. However if triggered the trace will stop after 1759 // |stop_delay_ms| and any data in the buffer will be returned to the 1760 // consumer. 1761 STOP_TRACING = 2; 1762 } 1763 optional TriggerMode trigger_mode = 1; 1764 1765 message Trigger { 1766 // The producer must specify this name to activate the trigger. 1767 optional string name = 1; 1768 1769 // An std::regex that will match the producer that can activate this 1770 // trigger. This is optional. If unset any producers can activate this 1771 // trigger. 1772 optional string producer_name_regex = 2; 1773 1774 // After a trigger is received either in START_TRACING or STOP_TRACING 1775 // mode then the trace will end |stop_delay_ms| after triggering. 1776 optional uint32 stop_delay_ms = 3; 1777 1778 // Limits the number of traces this trigger can start/stop in a rolling 1779 // 24 hour window. If this field is unset or zero, no limit is applied and 1780 // activiation of this trigger *always* starts/stops the trace. 1781 optional uint32 max_per_24_h = 4; 1782 1783 // A value between 0 and 1 which encodes the probability of skipping a 1784 // trigger with this name. This is useful for reducing the probability 1785 // of high-frequency triggers from dominating trace finaization. If this 1786 // field is unset or zero, the trigger will *never* be skipped. If this 1787 // field is greater than or equal to 1, this trigger will *always* be 1788 // skipped i.e. it will be as if this trigger was never included in the 1789 // first place. 1790 // This probability check is applied *before* any other limits. For 1791 // example, if |max_per_24_h| is also set, first we will check if the 1792 // probability bar is met and only then will we check the |max_per_24_h| 1793 // limit. 1794 optional double skip_probability = 5; 1795 } 1796 // A list of triggers which are related to this configuration. If ANY 1797 // trigger is seen then an action will be performed based on |trigger_mode|. 1798 repeated Trigger triggers = 2; 1799 1800 // Required and must be positive if a TriggerConfig is specified. This is 1801 // how long this TraceConfig should wait for a trigger to arrive. After this 1802 // period of time if no trigger is seen the TracingSession will be cleaned 1803 // up. 1804 optional uint32 trigger_timeout_ms = 3; 1805 } 1806 optional TriggerConfig trigger_config = 17; 1807 1808 // When this is non-empty the perfetto command line tool will ignore the rest 1809 // of this TraceConfig and instead connect to the perfetto service as a 1810 // producer and send these triggers, potentially stopping or starting traces 1811 // that were previous configured to use a TriggerConfig. 1812 repeated string activate_triggers = 18; 1813 1814 // Configuration for trace contents that reference earlier trace data. For 1815 // example, a data source might intern strings, and emit packets containing 1816 // {interned id : string} pairs. Future packets from that data source can then 1817 // use the interned ids instead of duplicating the raw string contents. The 1818 // trace parser will then need to use that interning table to fully interpret 1819 // the rest of the trace. 1820 message IncrementalStateConfig { 1821 // If nonzero, notify eligible data sources to clear their incremental state 1822 // periodically, with the given period. The notification is sent only to 1823 // data sources that have |handles_incremental_state_clear| set in their 1824 // DataSourceDescriptor. The notification requests that the data source 1825 // stops referring to past trace contents. This is particularly useful when 1826 // tracing in ring buffer mode, where it is not exceptional to overwrite old 1827 // trace data. 1828 // 1829 // Warning: this time-based global clearing is likely to be removed in the 1830 // future, to be replaced with a smarter way of sending the notifications 1831 // only when necessary. 1832 optional uint32 clear_period_ms = 1; 1833 } 1834 optional IncrementalStateConfig incremental_state_config = 21; 1835 1836 // Additional guardrail used by the Perfetto command line client. 1837 // On user builds when --dropbox is set perfetto will refuse to trace unless 1838 // this is also set. 1839 // Added in Q. 1840 optional bool allow_user_build_tracing = 19; 1841 1842 // If set the tracing service will ensure there is at most one tracing session 1843 // with this key. 1844 optional string unique_session_name = 22; 1845 1846 // Compress trace with the given method. Best effort. 1847 enum CompressionType { 1848 COMPRESSION_TYPE_UNSPECIFIED = 0; 1849 COMPRESSION_TYPE_DEFLATE = 1; 1850 } 1851 optional CompressionType compression_type = 24; 1852 1853 // Android-only. Not for general use. If set, saves the trace into an 1854 // incident. This field is read by perfetto_cmd, rather than the tracing 1855 // service. This field must be set when passing the --upload flag to 1856 // perfetto_cmd. 1857 message IncidentReportConfig { 1858 // In this message, either: 1859 // * all of |destination_package|, |destination_class| and |privacy_level| 1860 // must be set. 1861 // * |skip_incidentd| must be explicitly set to true. 1862 1863 optional string destination_package = 1; 1864 optional string destination_class = 2; 1865 // Level of filtering in the requested incident. See |Destination| in 1866 // frameworks/base/core/proto/android/privacy.proto. 1867 optional int32 privacy_level = 3; 1868 1869 // If true, then skips saving the trace to incidentd. 1870 // 1871 // This flag is useful in testing (e.g. Perfetto-statsd integration tests) 1872 // or when we explicitly don't want traces to go to incidentd even when they 1873 // usually would (e.g. configs deployed using statsd but only used for 1874 // inclusion in bugreports using |bugreport_score|). 1875 // 1876 // The motivation for having this flag, instead of just not setting 1877 // |incident_report_config|, is prevent accidents where 1878 // |incident_report_config| is omitted by mistake. 1879 optional bool skip_incidentd = 5; 1880 1881 // If true, do not write the trace into dropbox (i.e. incident only). 1882 // Otherwise, write to both dropbox and incident. 1883 // TODO(lalitm): remove this field as we no longer use Dropbox. 1884 optional bool skip_dropbox = 4 [deprecated = true]; 1885 } 1886 optional IncidentReportConfig incident_report_config = 25; 1887 1888 enum StatsdLogging { 1889 STATSD_LOGGING_UNSPECIFIED = 0; 1890 STATSD_LOGGING_ENABLED = 1; 1891 STATSD_LOGGING_DISABLED = 2; 1892 } 1893 1894 // Android-only. Not for general use. If specified, sets the logging to statsd 1895 // of guardrails and checkpoints in the tracing service. perfetto_cmd sets 1896 // this to enabled (if not explicitly set in the config) when specifying 1897 // --upload. 1898 optional StatsdLogging statsd_logging = 31; 1899 1900 // DEPRECATED. Was trace_uuid, use trace_uuid_msb and trace_uuid_lsb instead. 1901 reserved 26; 1902 // An identifier clients can use to tie this trace to other logging. 1903 // Alternative encoding of trace_uuid as two int64s. 1904 optional int64 trace_uuid_msb = 27; 1905 optional int64 trace_uuid_lsb = 28; 1906 1907 // When set applies a post-filter to the trace contents using the filter 1908 // provided. The filter is applied at ReadBuffers() time and works both in the 1909 // case of IPC readback and write_into_file. This filter can be generated 1910 // using `tools/proto_filter -s schema.proto -F filter_out.bytes` or 1911 // `-T filter_out.escaped_string` (for .pbtx). 1912 // Introduced in Android S. See go/trace-filtering for design. 1913 message TraceFilter { optional bytes bytecode = 1; } 1914 optional TraceFilter trace_filter = 32; 1915} 1916 1917// End of protos/perfetto/config/trace_config.proto