Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
thread_descriptor.pbzero.h
Go to the documentation of this file.
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_TRACK_EVENT_THREAD_DESCRIPTOR_PROTO_H_
12#define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_THREAD_DESCRIPTOR_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
23namespace perfetto {
24namespace protos {
25namespace pbzero {
26
27class ThreadDescriptor_Decoder : public ::protozero::TypedProtoDecoder<
28 /*MAX_FIELD_ID=*/5,
29 /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
30 public:
31 ThreadDescriptor_Decoder(const uint8_t* data, size_t len)
32 : TypedProtoDecoder(data, len) {}
33 explicit ThreadDescriptor_Decoder(const std::string& raw)
34 : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()),
35 raw.size()) {}
36 explicit ThreadDescriptor_Decoder(const ::protozero::ConstBytes& raw)
37 : TypedProtoDecoder(raw.data, raw.size) {}
38 bool has_pid() const { return at<1>().valid(); }
39 int32_t pid() const { return at<1>().as_int32(); }
40 bool has_tid() const { return at<2>().valid(); }
41 int32_t tid() const { return at<2>().as_int32(); }
42 bool has_thread_name() const { return at<5>().valid(); }
43 ::protozero::ConstChars thread_name() const { return at<5>().as_string(); }
44};
45
46class ThreadDescriptor : public ::protozero::Message {
47 public:
49 enum : int32_t {
53 };
54 static constexpr const char* GetName() {
55 return ".perfetto.protos.ThreadDescriptor";
56 }
57
58 using FieldMetadata_Pid = ::protozero::proto_utils::FieldMetadata<
59 1,
60 ::protozero::proto_utils::RepetitionType::kNotRepeated,
61 ::protozero::proto_utils::ProtoSchemaType::kInt32,
62 int32_t,
64
65 // Ceci n'est pas une pipe.
66 // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
67 // type (and users are expected to use it as such, hence kCamelCase name).
68 // It is declared as a function to keep protozero bindings header-only as
69 // inline constexpr variables are not available until C++17 (while inline
70 // functions are).
71 // TODO(altimin): Use inline variable instead after adopting C++17.
72 static constexpr FieldMetadata_Pid kPid() { return {}; }
73 void set_pid(int32_t value) {
74 static constexpr uint32_t field_id = FieldMetadata_Pid::kFieldId;
75 // Call the appropriate protozero::Message::Append(field_id, ...)
76 // method based on the type of the field.
77 ::protozero::internal::FieldWriter<
78 ::protozero::proto_utils::ProtoSchemaType::kInt32>::Append(*this,
79 field_id,
80 value);
81 }
82
83 using FieldMetadata_Tid = ::protozero::proto_utils::FieldMetadata<
84 2,
85 ::protozero::proto_utils::RepetitionType::kNotRepeated,
86 ::protozero::proto_utils::ProtoSchemaType::kInt32,
87 int32_t,
89
90 // Ceci n'est pas une pipe.
91 // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
92 // type (and users are expected to use it as such, hence kCamelCase name).
93 // It is declared as a function to keep protozero bindings header-only as
94 // inline constexpr variables are not available until C++17 (while inline
95 // functions are).
96 // TODO(altimin): Use inline variable instead after adopting C++17.
97 static constexpr FieldMetadata_Tid kTid() { return {}; }
98 void set_tid(int32_t value) {
99 static constexpr uint32_t field_id = FieldMetadata_Tid::kFieldId;
100 // Call the appropriate protozero::Message::Append(field_id, ...)
101 // method based on the type of the field.
102 ::protozero::internal::FieldWriter<
103 ::protozero::proto_utils::ProtoSchemaType::kInt32>::Append(*this,
104 field_id,
105 value);
106 }
107
108 using FieldMetadata_ThreadName = ::protozero::proto_utils::FieldMetadata<
109 5,
110 ::protozero::proto_utils::RepetitionType::kNotRepeated,
111 ::protozero::proto_utils::ProtoSchemaType::kString,
112 std::string,
114
115 // Ceci n'est pas une pipe.
116 // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
117 // type (and users are expected to use it as such, hence kCamelCase name).
118 // It is declared as a function to keep protozero bindings header-only as
119 // inline constexpr variables are not available until C++17 (while inline
120 // functions are).
121 // TODO(altimin): Use inline variable instead after adopting C++17.
122 static constexpr FieldMetadata_ThreadName kThreadName() { return {}; }
123 void set_thread_name(const char* data, size_t size) {
124 AppendBytes(FieldMetadata_ThreadName::kFieldId, data, size);
125 }
126 void set_thread_name(::protozero::ConstChars chars) {
127 AppendBytes(FieldMetadata_ThreadName::kFieldId, chars.data, chars.size);
128 }
129 void set_thread_name(std::string value) {
130 static constexpr uint32_t field_id = FieldMetadata_ThreadName::kFieldId;
131 // Call the appropriate protozero::Message::Append(field_id, ...)
132 // method based on the type of the field.
133 ::protozero::internal::FieldWriter<
134 ::protozero::proto_utils::ProtoSchemaType::kString>::Append(*this,
135 field_id,
136 value);
137 }
138};
139
140} // namespace pbzero
141} // namespace protos
142} // namespace perfetto
143#endif // Include guard.
ThreadDescriptor_Decoder(const ::protozero::ConstBytes &raw)
::protozero::proto_utils::FieldMetadata< 2, ::protozero::proto_utils::RepetitionType::kNotRepeated, ::protozero::proto_utils::ProtoSchemaType::kInt32, int32_t, ThreadDescriptor > FieldMetadata_Tid
static constexpr FieldMetadata_Pid kPid()
::protozero::proto_utils::FieldMetadata< 5, ::protozero::proto_utils::RepetitionType::kNotRepeated, ::protozero::proto_utils::ProtoSchemaType::kString, std::string, ThreadDescriptor > FieldMetadata_ThreadName
::protozero::proto_utils::FieldMetadata< 1, ::protozero::proto_utils::RepetitionType::kNotRepeated, ::protozero::proto_utils::ProtoSchemaType::kInt32, int32_t, ThreadDescriptor > FieldMetadata_Pid
static constexpr FieldMetadata_Tid kTid()
static constexpr FieldMetadata_ThreadName kThreadName()
void set_thread_name(const char *data, size_t size)
void set_thread_name(::protozero::ConstChars chars)
uint8_t value