| 1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | // IMPORTANT: This file should only ever be modified by modifying the |
| 6 | // corresponding .proto file and then running |
| 7 | // `dart runtime/vm/protos/tools/compile_perfetto_protos.dart` from the SDK root |
| 8 | // directory. |
| 9 | // Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT. |
| 10 | |
| 11 | #ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACE_PACKET_PROTO_H_ |
| 12 | #define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACE_PACKET_PROTO_H_ |
| 13 | |
| 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
| 16 | |
| 17 | #include "perfetto/protozero/field_writer.h" |
| 18 | #include "perfetto/protozero/message.h" |
| 19 | #include "perfetto/protozero/packed_repeated_fields.h" |
| 20 | #include "perfetto/protozero/proto_decoder.h" |
| 21 | #include "perfetto/protozero/proto_utils.h" |
| 22 | |
| 23 | namespace perfetto { |
| 24 | namespace protos { |
| 25 | namespace pbzero { |
| 26 | |
| 27 | class ClockSnapshot; |
| 28 | class InternedData; |
| 29 | class PerfSample; |
| 30 | class TrackDescriptor; |
| 31 | class TrackEvent; |
| 32 | |
| 33 | namespace perfetto_pbzero_enum_TracePacket { |
| 34 | enum SequenceFlags : int32_t { |
| 35 | SEQ_UNSPECIFIED = 0, |
| 36 | SEQ_INCREMENTAL_STATE_CLEARED = 1, |
| 37 | SEQ_NEEDS_INCREMENTAL_STATE = 2, |
| 38 | }; |
| 39 | } // namespace perfetto_pbzero_enum_TracePacket |
| 40 | using TracePacket_SequenceFlags = |
| 41 | perfetto_pbzero_enum_TracePacket::SequenceFlags; |
| 42 | |
| 43 | constexpr TracePacket_SequenceFlags TracePacket_SequenceFlags_MIN = |
| 44 | TracePacket_SequenceFlags::SEQ_UNSPECIFIED; |
| 45 | constexpr TracePacket_SequenceFlags TracePacket_SequenceFlags_MAX = |
| 46 | TracePacket_SequenceFlags::SEQ_NEEDS_INCREMENTAL_STATE; |
| 47 | |
| 48 | PERFETTO_PROTOZERO_CONSTEXPR14_OR_INLINE |
| 49 | const char* TracePacket_SequenceFlags_Name( |
| 50 | ::perfetto::protos::pbzero::TracePacket_SequenceFlags value) { |
| 51 | switch (value) { |
| 52 | case ::perfetto::protos::pbzero::TracePacket_SequenceFlags::SEQ_UNSPECIFIED: |
| 53 | return "SEQ_UNSPECIFIED" ; |
| 54 | |
| 55 | case ::perfetto::protos::pbzero::TracePacket_SequenceFlags:: |
| 56 | SEQ_INCREMENTAL_STATE_CLEARED: |
| 57 | return "SEQ_INCREMENTAL_STATE_CLEARED" ; |
| 58 | |
| 59 | case ::perfetto::protos::pbzero::TracePacket_SequenceFlags:: |
| 60 | SEQ_NEEDS_INCREMENTAL_STATE: |
| 61 | return "SEQ_NEEDS_INCREMENTAL_STATE" ; |
| 62 | } |
| 63 | return "PBZERO_UNKNOWN_ENUM_VALUE" ; |
| 64 | } |
| 65 | |
| 66 | class TracePacket_Decoder : public ::protozero::TypedProtoDecoder< |
| 67 | /*MAX_FIELD_ID=*/66, |
| 68 | /*HAS_NONPACKED_REPEATED_FIELDS=*/false> { |
| 69 | public: |
| 70 | TracePacket_Decoder(const uint8_t* data, size_t len) |
| 71 | : TypedProtoDecoder(data, len) {} |
| 72 | explicit TracePacket_Decoder(const std::string& raw) |
| 73 | : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), |
| 74 | raw.size()) {} |
| 75 | explicit TracePacket_Decoder(const ::protozero::ConstBytes& raw) |
| 76 | : TypedProtoDecoder(raw.data, raw.size) {} |
| 77 | bool has_timestamp() const { return at<8>().valid(); } |
| 78 | uint64_t timestamp() const { return at<8>().as_uint64(); } |
| 79 | bool has_timestamp_clock_id() const { return at<58>().valid(); } |
| 80 | uint32_t timestamp_clock_id() const { return at<58>().as_uint32(); } |
| 81 | bool has_clock_snapshot() const { return at<6>().valid(); } |
| 82 | ::protozero::ConstBytes clock_snapshot() const { return at<6>().as_bytes(); } |
| 83 | bool has_track_event() const { return at<11>().valid(); } |
| 84 | ::protozero::ConstBytes track_event() const { return at<11>().as_bytes(); } |
| 85 | bool has_track_descriptor() const { return at<60>().valid(); } |
| 86 | ::protozero::ConstBytes track_descriptor() const { |
| 87 | return at<60>().as_bytes(); |
| 88 | } |
| 89 | bool has_perf_sample() const { return at<66>().valid(); } |
| 90 | ::protozero::ConstBytes perf_sample() const { return at<66>().as_bytes(); } |
| 91 | bool has_trusted_packet_sequence_id() const { return at<10>().valid(); } |
| 92 | uint32_t trusted_packet_sequence_id() const { return at<10>().as_uint32(); } |
| 93 | bool has_interned_data() const { return at<12>().valid(); } |
| 94 | ::protozero::ConstBytes interned_data() const { return at<12>().as_bytes(); } |
| 95 | bool has_sequence_flags() const { return at<13>().valid(); } |
| 96 | uint32_t sequence_flags() const { return at<13>().as_uint32(); } |
| 97 | }; |
| 98 | |
| 99 | class TracePacket : public ::protozero::Message { |
| 100 | public: |
| 101 | using Decoder = TracePacket_Decoder; |
| 102 | enum : int32_t { |
| 103 | kTimestampFieldNumber = 8, |
| 104 | kTimestampClockIdFieldNumber = 58, |
| 105 | kClockSnapshotFieldNumber = 6, |
| 106 | kTrackEventFieldNumber = 11, |
| 107 | kTrackDescriptorFieldNumber = 60, |
| 108 | kPerfSampleFieldNumber = 66, |
| 109 | kTrustedPacketSequenceIdFieldNumber = 10, |
| 110 | kInternedDataFieldNumber = 12, |
| 111 | kSequenceFlagsFieldNumber = 13, |
| 112 | }; |
| 113 | static constexpr const char* GetName() { |
| 114 | return ".perfetto.protos.TracePacket" ; |
| 115 | } |
| 116 | |
| 117 | using SequenceFlags = ::perfetto::protos::pbzero::TracePacket_SequenceFlags; |
| 118 | static inline const char* SequenceFlags_Name(SequenceFlags value) { |
| 119 | return ::perfetto::protos::pbzero::TracePacket_SequenceFlags_Name(value); |
| 120 | } |
| 121 | static const SequenceFlags SEQ_UNSPECIFIED = SequenceFlags::SEQ_UNSPECIFIED; |
| 122 | static const SequenceFlags SEQ_INCREMENTAL_STATE_CLEARED = |
| 123 | SequenceFlags::SEQ_INCREMENTAL_STATE_CLEARED; |
| 124 | static const SequenceFlags SEQ_NEEDS_INCREMENTAL_STATE = |
| 125 | SequenceFlags::SEQ_NEEDS_INCREMENTAL_STATE; |
| 126 | |
| 127 | using FieldMetadata_Timestamp = ::protozero::proto_utils::FieldMetadata< |
| 128 | 8, |
| 129 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 130 | ::protozero::proto_utils::ProtoSchemaType::kUint64, |
| 131 | uint64_t, |
| 132 | TracePacket>; |
| 133 | |
| 134 | // Ceci n'est pas une pipe. |
| 135 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 136 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 137 | // It is declared as a function to keep protozero bindings header-only as |
| 138 | // inline constexpr variables are not available until C++17 (while inline |
| 139 | // functions are). |
| 140 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 141 | static constexpr FieldMetadata_Timestamp kTimestamp() { return {}; } |
| 142 | void set_timestamp(uint64_t value) { |
| 143 | static constexpr uint32_t field_id = FieldMetadata_Timestamp::kFieldId; |
| 144 | // Call the appropriate protozero::Message::Append(field_id, ...) |
| 145 | // method based on the type of the field. |
| 146 | ::protozero::internal::FieldWriter< |
| 147 | ::protozero::proto_utils::ProtoSchemaType::kUint64>::Append(message&: *this, |
| 148 | field_id, |
| 149 | value); |
| 150 | } |
| 151 | |
| 152 | using FieldMetadata_TimestampClockId = |
| 153 | ::protozero::proto_utils::FieldMetadata< |
| 154 | 58, |
| 155 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 156 | ::protozero::proto_utils::ProtoSchemaType::kUint32, |
| 157 | uint32_t, |
| 158 | TracePacket>; |
| 159 | |
| 160 | // Ceci n'est pas une pipe. |
| 161 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 162 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 163 | // It is declared as a function to keep protozero bindings header-only as |
| 164 | // inline constexpr variables are not available until C++17 (while inline |
| 165 | // functions are). |
| 166 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 167 | static constexpr FieldMetadata_TimestampClockId kTimestampClockId() { |
| 168 | return {}; |
| 169 | } |
| 170 | void set_timestamp_clock_id(uint32_t value) { |
| 171 | static constexpr uint32_t field_id = |
| 172 | FieldMetadata_TimestampClockId::kFieldId; |
| 173 | // Call the appropriate protozero::Message::Append(field_id, ...) |
| 174 | // method based on the type of the field. |
| 175 | ::protozero::internal::FieldWriter< |
| 176 | ::protozero::proto_utils::ProtoSchemaType::kUint32>::Append(message&: *this, |
| 177 | field_id, |
| 178 | value); |
| 179 | } |
| 180 | |
| 181 | using FieldMetadata_ClockSnapshot = ::protozero::proto_utils::FieldMetadata< |
| 182 | 6, |
| 183 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 184 | ::protozero::proto_utils::ProtoSchemaType::kMessage, |
| 185 | ClockSnapshot, |
| 186 | TracePacket>; |
| 187 | |
| 188 | // Ceci n'est pas une pipe. |
| 189 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 190 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 191 | // It is declared as a function to keep protozero bindings header-only as |
| 192 | // inline constexpr variables are not available until C++17 (while inline |
| 193 | // functions are). |
| 194 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 195 | static constexpr FieldMetadata_ClockSnapshot kClockSnapshot() { return {}; } |
| 196 | template <typename T = ClockSnapshot> |
| 197 | T* set_clock_snapshot() { |
| 198 | return BeginNestedMessage<T>(6); |
| 199 | } |
| 200 | |
| 201 | using FieldMetadata_TrackEvent = ::protozero::proto_utils::FieldMetadata< |
| 202 | 11, |
| 203 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 204 | ::protozero::proto_utils::ProtoSchemaType::kMessage, |
| 205 | TrackEvent, |
| 206 | TracePacket>; |
| 207 | |
| 208 | // Ceci n'est pas une pipe. |
| 209 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 210 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 211 | // It is declared as a function to keep protozero bindings header-only as |
| 212 | // inline constexpr variables are not available until C++17 (while inline |
| 213 | // functions are). |
| 214 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 215 | static constexpr FieldMetadata_TrackEvent kTrackEvent() { return {}; } |
| 216 | template <typename T = TrackEvent> |
| 217 | T* set_track_event() { |
| 218 | return BeginNestedMessage<T>(11); |
| 219 | } |
| 220 | |
| 221 | using FieldMetadata_TrackDescriptor = ::protozero::proto_utils::FieldMetadata< |
| 222 | 60, |
| 223 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 224 | ::protozero::proto_utils::ProtoSchemaType::kMessage, |
| 225 | TrackDescriptor, |
| 226 | TracePacket>; |
| 227 | |
| 228 | // Ceci n'est pas une pipe. |
| 229 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 230 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 231 | // It is declared as a function to keep protozero bindings header-only as |
| 232 | // inline constexpr variables are not available until C++17 (while inline |
| 233 | // functions are). |
| 234 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 235 | static constexpr FieldMetadata_TrackDescriptor kTrackDescriptor() { |
| 236 | return {}; |
| 237 | } |
| 238 | template <typename T = TrackDescriptor> |
| 239 | T* set_track_descriptor() { |
| 240 | return BeginNestedMessage<T>(60); |
| 241 | } |
| 242 | |
| 243 | using FieldMetadata_PerfSample = ::protozero::proto_utils::FieldMetadata< |
| 244 | 66, |
| 245 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 246 | ::protozero::proto_utils::ProtoSchemaType::kMessage, |
| 247 | PerfSample, |
| 248 | TracePacket>; |
| 249 | |
| 250 | // Ceci n'est pas une pipe. |
| 251 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 252 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 253 | // It is declared as a function to keep protozero bindings header-only as |
| 254 | // inline constexpr variables are not available until C++17 (while inline |
| 255 | // functions are). |
| 256 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 257 | static constexpr FieldMetadata_PerfSample kPerfSample() { return {}; } |
| 258 | template <typename T = PerfSample> |
| 259 | T* set_perf_sample() { |
| 260 | return BeginNestedMessage<T>(66); |
| 261 | } |
| 262 | |
| 263 | using FieldMetadata_TrustedPacketSequenceId = |
| 264 | ::protozero::proto_utils::FieldMetadata< |
| 265 | 10, |
| 266 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 267 | ::protozero::proto_utils::ProtoSchemaType::kUint32, |
| 268 | uint32_t, |
| 269 | TracePacket>; |
| 270 | |
| 271 | // Ceci n'est pas une pipe. |
| 272 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 273 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 274 | // It is declared as a function to keep protozero bindings header-only as |
| 275 | // inline constexpr variables are not available until C++17 (while inline |
| 276 | // functions are). |
| 277 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 278 | static constexpr FieldMetadata_TrustedPacketSequenceId |
| 279 | kTrustedPacketSequenceId() { |
| 280 | return {}; |
| 281 | } |
| 282 | void set_trusted_packet_sequence_id(uint32_t value) { |
| 283 | static constexpr uint32_t field_id = |
| 284 | FieldMetadata_TrustedPacketSequenceId::kFieldId; |
| 285 | // Call the appropriate protozero::Message::Append(field_id, ...) |
| 286 | // method based on the type of the field. |
| 287 | ::protozero::internal::FieldWriter< |
| 288 | ::protozero::proto_utils::ProtoSchemaType::kUint32>::Append(message&: *this, |
| 289 | field_id, |
| 290 | value); |
| 291 | } |
| 292 | |
| 293 | using FieldMetadata_InternedData = ::protozero::proto_utils::FieldMetadata< |
| 294 | 12, |
| 295 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 296 | ::protozero::proto_utils::ProtoSchemaType::kMessage, |
| 297 | InternedData, |
| 298 | TracePacket>; |
| 299 | |
| 300 | // Ceci n'est pas une pipe. |
| 301 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 302 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 303 | // It is declared as a function to keep protozero bindings header-only as |
| 304 | // inline constexpr variables are not available until C++17 (while inline |
| 305 | // functions are). |
| 306 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 307 | static constexpr FieldMetadata_InternedData kInternedData() { return {}; } |
| 308 | template <typename T = InternedData> |
| 309 | T* set_interned_data() { |
| 310 | return BeginNestedMessage<T>(12); |
| 311 | } |
| 312 | |
| 313 | using FieldMetadata_SequenceFlags = ::protozero::proto_utils::FieldMetadata< |
| 314 | 13, |
| 315 | ::protozero::proto_utils::RepetitionType::kNotRepeated, |
| 316 | ::protozero::proto_utils::ProtoSchemaType::kUint32, |
| 317 | uint32_t, |
| 318 | TracePacket>; |
| 319 | |
| 320 | // Ceci n'est pas une pipe. |
| 321 | // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>> |
| 322 | // type (and users are expected to use it as such, hence kCamelCase name). |
| 323 | // It is declared as a function to keep protozero bindings header-only as |
| 324 | // inline constexpr variables are not available until C++17 (while inline |
| 325 | // functions are). |
| 326 | // TODO(altimin): Use inline variable instead after adopting C++17. |
| 327 | static constexpr FieldMetadata_SequenceFlags kSequenceFlags() { return {}; } |
| 328 | void set_sequence_flags(uint32_t value) { |
| 329 | static constexpr uint32_t field_id = FieldMetadata_SequenceFlags::kFieldId; |
| 330 | // Call the appropriate protozero::Message::Append(field_id, ...) |
| 331 | // method based on the type of the field. |
| 332 | ::protozero::internal::FieldWriter< |
| 333 | ::protozero::proto_utils::ProtoSchemaType::kUint32>::Append(message&: *this, |
| 334 | field_id, |
| 335 | value); |
| 336 | } |
| 337 | }; |
| 338 | |
| 339 | } // namespace pbzero |
| 340 | } // namespace protos |
| 341 | } // namespace perfetto |
| 342 | #endif // Include guard. |
| 343 | |