1/* 2 * Copyright (C) 2021 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 19// NOTE: We get away with a copy of the proto definitions here only because in this module 20// we are using mutable types. Otherwise benchmark's definitions and this would collide and cause 21// builds to fail. Consider re-packaging this to a separate package in the future. b/392165540 22package perfetto.protos; 23 24/////////////////////////////////////////////////////////////////////////////// 25// NOTE: THIS FILE IS A MANUALLY MINIFIED VERSION OF PERFETTO_TRACE.PROTO 26/////////////////////////////////////////////////////////////////////////////// 27 28message EventName { 29 optional uint64 iid = 1; 30 optional string name = 2; 31} 32 33message InternedData { 34 repeated EventName event_names = 2; 35} 36 37message TracePacketDefaults { 38 optional uint32 timestamp_clock_id = 58; 39 optional TrackEventDefaults track_event_defaults = 11; 40} 41 42// A random unique ID that identifies the trace. 43// This message has been introduced in v32. Prior to that, the UUID was 44// only (optionally) present in the TraceConfig.trace_uuid_msb/lsb fields. 45message TraceUuid { 46 optional int64 msb = 1; 47 optional int64 lsb = 2; 48} 49 50message ProcessDescriptor { 51 required int32 pid = 1; // Making this required to avoid boxing an Int 52 repeated string cmdline = 2; 53 optional string process_name = 6; 54 // Labels can be used to further describe properties of the work performed by 55 // the process. For example, these can be used by Chrome renderer process to 56 // provide titles of frames being rendered. 57 repeated string process_labels = 8; 58} 59 60message TrackEvent { 61 oneof name_field { 62 // non-interned variant. 63 string name = 23; 64 } 65 enum Type { 66 TYPE_SLICE_BEGIN = 1; 67 TYPE_SLICE_END = 2; 68 TYPE_INSTANT = 3; 69 TYPE_COUNTER = 4; 70 } 71 optional Type type = 9; 72 required uint64 track_uuid = 11; // Making this required to avoid boxing 73 oneof counter_value_field { 74 int64 counter_value = 30; 75 double double_counter_value = 44; 76 } 77 repeated fixed64 flow_ids = 47; 78} 79 80message ThreadDescriptor { 81 required int32 pid = 1; // Making this required to avoid boxing an Int 82 required int32 tid = 2; // Making this required to avoid boxing an Int 83 optional string thread_name = 5; 84} 85 86message CounterDescriptor { 87 // Built-in counters, usually with special meaning in the client library, 88 // trace processor, legacy JSON format, or UI. Trace processor will infer a 89 // track name from the enum value if none is provided in TrackDescriptor. 90 enum BuiltinCounterType { 91 COUNTER_UNSPECIFIED = 0; 92 93 // Thread-scoped counters. The thread's track should be specified via 94 // |parent_uuid| in the TrackDescriptor for such a counter. 95 96 // implies UNIT_TIME_NS. 97 COUNTER_THREAD_TIME_NS = 1; 98 99 // implies UNIT_COUNT. 100 COUNTER_THREAD_INSTRUCTION_COUNT = 2; 101 } 102 103 // Type of the values for the counters - to supply lower granularity units, 104 // see also |unit_multiplier|. 105 enum Unit { 106 UNIT_UNSPECIFIED = 0; 107 UNIT_TIME_NS = 1; 108 UNIT_COUNT = 2; 109 UNIT_SIZE_BYTES = 3; 110 } 111 112 // For built-in counters (e.g. thread time). Custom user-specified counters 113 // (e.g. those emitted by TRACE_COUNTER macros of the client library) 114 // shouldn't set this, and instead provide a counter name via TrackDescriptor. 115 optional BuiltinCounterType type = 1; 116 117 // Names of categories of the counter (usually for user-specified counters). 118 // In the client library, categories are a way to turn groups of individual 119 // counters (or events) on or off. 120 repeated string categories = 2; 121 122 // Type of the counter's values. Built-in counters imply a value for this 123 // field. 124 optional Unit unit = 3; 125 126 // In order to use a unit not defined as a part of |Unit|, a free-form unit 127 // name can be used instead. 128 optional string unit_name = 6; 129 130 // Multiplication factor of this counter's values, e.g. to supply 131 // COUNTER_THREAD_TIME_NS timestamps in microseconds instead. 132 optional int64 unit_multiplier = 4; 133 134 // Whether values for this counter are provided as delta values. Only 135 // supported for counters that are emitted on a single packet-sequence (e.g. 136 // thread time). Counter values in subsequent packets on the current packet 137 // sequence will be interpreted as delta values from the sequence's most 138 // recent value for the counter. When incremental state is cleared, the 139 // counter value is considered to be reset to 0. Thus, the first value after 140 // incremental state is cleared is effectively an absolute value. 141 optional bool is_incremental = 5; 142} 143 144message TrackDescriptor { 145 optional uint64 uuid = 1; 146 optional string name = 2; 147 optional uint64 parent_uuid = 5; 148 optional ProcessDescriptor process = 3; 149 optional ThreadDescriptor thread = 4; 150 optional CounterDescriptor counter = 8; 151 optional bool disallow_merging_with_system_tracks = 9; 152} 153 154message TrackEventDefaults { 155 optional uint64 track_uuid = 11; 156} 157 158message TracePacket { 159 required uint64 timestamp = 8; // Making this required to avoid boxing 160 optional uint32 timestamp_clock_id = 58; 161 oneof data { 162 TrackEvent track_event = 11; 163 TrackDescriptor track_descriptor = 60; 164 TraceUuid trace_uuid = 89; 165 bytes compressed_packets = 50; // kept for testing purposes 166 } 167 required uint32 trusted_packet_sequence_id = 10; // Making this required to avoid boxing 168 optional InternedData interned_data = 12; 169 170 enum SequenceFlags { 171 SEQ_UNSPECIFIED = 0; 172 SEQ_INCREMENTAL_STATE_CLEARED = 1; 173 SEQ_NEEDS_INCREMENTAL_STATE = 2; 174 }; 175 optional uint32 sequence_flags = 13; 176 optional bool incremental_state_cleared = 41; 177 optional TracePacketDefaults trace_packet_defaults = 59; 178} 179 180message Trace { 181 repeated TracePacket packet = 1; 182} 183