| /* |
| * Copyright (C) 2017 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| syntax = "proto2"; |
| option optimize_for = LITE_RUNTIME; |
| |
| import "perfetto/config/data_source_config.proto"; |
| |
| package perfetto.protos; |
| |
| // When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py |
| // to reflect changes in the corresponding C++ headers. |
| |
| // The overall config that is used when starting a new tracing session through |
| // ProducerPort::StartTracing(). |
| // It contains the general config for the logging buffer(s) and the configs for |
| // all the data source being enabled. |
| // |
| // Next id: 8. |
| message TraceConfig { |
| message BufferConfig { |
| optional uint32 size_kb = 1; |
| |
| reserved 2; // |page_size|, now deprecated. |
| reserved 3; // |optimize_for|, now deprecated. |
| |
| enum FillPolicy { |
| UNSPECIFIED = 0; |
| RING_BUFFER = 1; |
| // TODO: not implemented yet. |
| // STOP_WHEN_FULL = 2; |
| } |
| optional FillPolicy fill_policy = 4; |
| } |
| repeated BufferConfig buffers = 1; |
| |
| message DataSource { |
| // Filters and data-source specific config. It contains also the unique name |
| // of the data source, the one passed in the DataSourceDescriptor when they |
| // register on the service. |
| optional protos.DataSourceConfig config = 1; |
| |
| // Optional. If multiple producers (~processes) expose the same data source |
| // and |producer_name_filter| != "", the data source is enabled only for |
| // producers whose names match any of the producer_name_filter below. |
| // The |producer_name_filter| has to be an exact match. (TODO(primiano): |
| // support wildcards or regex). |
| // This allows to enable a data source only for specific processes. |
| // The "repeated" field has OR sematics: specifying a filter ["foo", "bar"] |
| // will enable data source on both "foo" and "bar" (if existent). |
| repeated string producer_name_filter = 2; |
| } |
| repeated DataSource data_sources = 2; |
| |
| optional uint32 duration_ms = 3; |
| |
| // This is set when --dropbox is passed to the Perfetto command line client |
| // and enables guardrails that limit resource usage for traces requested |
| // by statsd. |
| optional bool enable_extra_guardrails = 4; |
| |
| enum LockdownModeOperation { |
| LOCKDOWN_UNCHANGED = 0; |
| LOCKDOWN_CLEAR = 1; |
| LOCKDOWN_SET = 2; |
| } |
| // Reject producers that are not running under the same UID as the tracing |
| // service. |
| optional LockdownModeOperation lockdown_mode = 5; |
| |
| message ProducerConfig { |
| // Identifies the producer for which this config is for. |
| optional string producer_name = 1; |
| |
| // Specifies the preferred size of the shared memory buffer. If the size is |
| // larger than the max size, the max will be used. If it is smaller than |
| // the page size or doesn't fit pages evenly into it, it will fall back to |
| // the size specified by the producer or finally the default shared memory |
| // size. |
| optional uint32 shm_size_kb = 2; |
| |
| // Specifies the preferred size of each page in the shared memory buffer. |
| // Must be an integer mutiple of 4K. |
| optional uint32 page_size_kb = 3; |
| } |
| |
| repeated ProducerConfig producers = 6; |
| |
| // Contains statsd-specific metadata about an alert associated with the trace. |
| message StatsdMetadata { |
| // The identifier of the alert which triggered this trace. |
| optional int64 triggering_alert_id = 1; |
| // The uid which registered the triggering configuration with statsd. |
| optional int32 triggering_config_uid = 2; |
| // The identifier of the config which triggered the alert. |
| optional int64 triggering_config_id = 3; |
| } |
| |
| // Statsd-specific metadata. |
| optional StatsdMetadata statsd_metadata = 7; |
| |
| // When true, the EnableTracing() request must also provide a file descriptor. |
| // The service will then periodically read packets out of the trace buffer and |
| // store it into the passed file. |
| optional bool write_into_file = 8; |
| |
| // Optional. If non-zero tunes the write period. A min value of 100ms is |
| // enforced (i.e. smaller values are ignored). |
| optional uint32 file_write_period_ms = 9; |
| |
| // Optional. When non zero the periodic write stops once at most X bytes |
| // have been written into the file. Tracing is disabled when this limit is |
| // reached, even if |duration_ms| has not been reached yet. |
| optional uint64 max_file_size_bytes = 10; |
| } |