1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/config/gpu/gpu_counter_config.proto
3 
4 #include "protos/perfetto/config/gpu/gpu_counter_config.pb.h"
5 
6 #include <algorithm>
7 #include <cstdint>
8 
9 #include <google/protobuf/io/coded_stream.h>
10 #include <google/protobuf/extension_set.h>
11 #include <google/protobuf/wire_format_lite.h>
12 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
13 // @@protoc_insertion_point(includes)
14 #include <google/protobuf/port_def.inc>
15 
16 PROTOBUF_PRAGMA_INIT_SEG
17 
18 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
19 namespace _pbi = _pb::internal;
20 
21 namespace perfetto {
22 namespace protos {
GpuCounterConfig(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR GpuCounterConfig::GpuCounterConfig(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.counter_ids_)*/{}
28   , /*decltype(_impl_.counter_period_ns_)*/::uint64_t{0u}
29   , /*decltype(_impl_.instrumented_sampling_)*/false
30   , /*decltype(_impl_.fix_gpu_clock_)*/false} {}
31 struct GpuCounterConfigDefaultTypeInternal {
GpuCounterConfigDefaultTypeInternalperfetto::protos::GpuCounterConfigDefaultTypeInternal32   PROTOBUF_CONSTEXPR GpuCounterConfigDefaultTypeInternal()
33       : _instance(::_pbi::ConstantInitialized{}) {}
~GpuCounterConfigDefaultTypeInternalperfetto::protos::GpuCounterConfigDefaultTypeInternal34   ~GpuCounterConfigDefaultTypeInternal() {}
35   union {  // NOLINT(misc-non-private-member-variables-in-classes)
36     GpuCounterConfig _instance;
37   };
38 };
39 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GpuCounterConfigDefaultTypeInternal _GpuCounterConfig_default_instance_;
40 }  // namespace protos
41 }  // namespace perfetto
42 namespace perfetto {
43 namespace protos {
44 
45 // ===================================================================
46 
47 class GpuCounterConfig::_Internal {
48  public:
49   using HasBits = decltype(std::declval<GpuCounterConfig>()._impl_._has_bits_);
set_has_counter_period_ns(HasBits * has_bits)50   static void set_has_counter_period_ns(HasBits* has_bits) {
51     (*has_bits)[0] |= 1u;
52   }
set_has_instrumented_sampling(HasBits * has_bits)53   static void set_has_instrumented_sampling(HasBits* has_bits) {
54     (*has_bits)[0] |= 2u;
55   }
set_has_fix_gpu_clock(HasBits * has_bits)56   static void set_has_fix_gpu_clock(HasBits* has_bits) {
57     (*has_bits)[0] |= 4u;
58   }
59 };
60 
GpuCounterConfig(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)61 GpuCounterConfig::GpuCounterConfig(::PROTOBUF_NAMESPACE_ID::Arena* arena,
62                          bool is_message_owned)
63   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
64   SharedCtor(arena, is_message_owned);
65   // @@protoc_insertion_point(arena_constructor:perfetto.protos.GpuCounterConfig)
66 }
GpuCounterConfig(const GpuCounterConfig & from)67 GpuCounterConfig::GpuCounterConfig(const GpuCounterConfig& from)
68   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
69   GpuCounterConfig* const _this = this; (void)_this;
70   new (&_impl_) Impl_{
71       decltype(_impl_._has_bits_){from._impl_._has_bits_}
72     , /*decltype(_impl_._cached_size_)*/{}
73     , decltype(_impl_.counter_ids_){from._impl_.counter_ids_}
74     , decltype(_impl_.counter_period_ns_){}
75     , decltype(_impl_.instrumented_sampling_){}
76     , decltype(_impl_.fix_gpu_clock_){}};
77 
78   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
79   ::memcpy(&_impl_.counter_period_ns_, &from._impl_.counter_period_ns_,
80     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.fix_gpu_clock_) -
81     reinterpret_cast<char*>(&_impl_.counter_period_ns_)) + sizeof(_impl_.fix_gpu_clock_));
82   // @@protoc_insertion_point(copy_constructor:perfetto.protos.GpuCounterConfig)
83 }
84 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)85 inline void GpuCounterConfig::SharedCtor(
86     ::_pb::Arena* arena, bool is_message_owned) {
87   (void)arena;
88   (void)is_message_owned;
89   new (&_impl_) Impl_{
90       decltype(_impl_._has_bits_){}
91     , /*decltype(_impl_._cached_size_)*/{}
92     , decltype(_impl_.counter_ids_){arena}
93     , decltype(_impl_.counter_period_ns_){::uint64_t{0u}}
94     , decltype(_impl_.instrumented_sampling_){false}
95     , decltype(_impl_.fix_gpu_clock_){false}
96   };
97 }
98 
~GpuCounterConfig()99 GpuCounterConfig::~GpuCounterConfig() {
100   // @@protoc_insertion_point(destructor:perfetto.protos.GpuCounterConfig)
101   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
102   (void)arena;
103     return;
104   }
105   SharedDtor();
106 }
107 
SharedDtor()108 inline void GpuCounterConfig::SharedDtor() {
109   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
110   _impl_.counter_ids_.~RepeatedField();
111 }
112 
SetCachedSize(int size) const113 void GpuCounterConfig::SetCachedSize(int size) const {
114   _impl_._cached_size_.Set(size);
115 }
116 
Clear()117 void GpuCounterConfig::Clear() {
118 // @@protoc_insertion_point(message_clear_start:perfetto.protos.GpuCounterConfig)
119   ::uint32_t cached_has_bits = 0;
120   // Prevent compiler warnings about cached_has_bits being unused
121   (void) cached_has_bits;
122 
123   _impl_.counter_ids_.Clear();
124   cached_has_bits = _impl_._has_bits_[0];
125   if (cached_has_bits & 0x00000007u) {
126     ::memset(&_impl_.counter_period_ns_, 0, static_cast<size_t>(
127         reinterpret_cast<char*>(&_impl_.fix_gpu_clock_) -
128         reinterpret_cast<char*>(&_impl_.counter_period_ns_)) + sizeof(_impl_.fix_gpu_clock_));
129   }
130   _impl_._has_bits_.Clear();
131   _internal_metadata_.Clear<std::string>();
132 }
133 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)134 const char* GpuCounterConfig::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
135 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
136   _Internal::HasBits has_bits{};
137   while (!ctx->Done(&ptr)) {
138     ::uint32_t tag;
139     ptr = ::_pbi::ReadTag(ptr, &tag);
140     switch (tag >> 3) {
141       // optional uint64 counter_period_ns = 1;
142       case 1:
143         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
144           _Internal::set_has_counter_period_ns(&has_bits);
145           _impl_.counter_period_ns_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
146           CHK_(ptr);
147         } else {
148           goto handle_unusual;
149         }
150         continue;
151       // repeated uint32 counter_ids = 2;
152       case 2:
153         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
154           ptr -= 1;
155           do {
156             ptr += 1;
157             _internal_add_counter_ids(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
158             CHK_(ptr);
159             if (!ctx->DataAvailable(ptr)) break;
160           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<16>(ptr));
161         } else if (static_cast<::uint8_t>(tag) == 18) {
162           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedUInt32Parser(_internal_mutable_counter_ids(), ptr, ctx);
163           CHK_(ptr);
164         } else {
165           goto handle_unusual;
166         }
167         continue;
168       // optional bool instrumented_sampling = 3;
169       case 3:
170         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
171           _Internal::set_has_instrumented_sampling(&has_bits);
172           _impl_.instrumented_sampling_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
173           CHK_(ptr);
174         } else {
175           goto handle_unusual;
176         }
177         continue;
178       // optional bool fix_gpu_clock = 4;
179       case 4:
180         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 32)) {
181           _Internal::set_has_fix_gpu_clock(&has_bits);
182           _impl_.fix_gpu_clock_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
183           CHK_(ptr);
184         } else {
185           goto handle_unusual;
186         }
187         continue;
188       default:
189         goto handle_unusual;
190     }  // switch
191   handle_unusual:
192     if ((tag == 0) || ((tag & 7) == 4)) {
193       CHK_(ptr);
194       ctx->SetLastTag(tag);
195       goto message_done;
196     }
197     ptr = UnknownFieldParse(
198         tag,
199         _internal_metadata_.mutable_unknown_fields<std::string>(),
200         ptr, ctx);
201     CHK_(ptr != nullptr);
202   }  // while
203 message_done:
204   _impl_._has_bits_.Or(has_bits);
205   return ptr;
206 failure:
207   ptr = nullptr;
208   goto message_done;
209 #undef CHK_
210 }
211 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const212 ::uint8_t* GpuCounterConfig::_InternalSerialize(
213     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
214   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.GpuCounterConfig)
215   ::uint32_t cached_has_bits = 0;
216   (void) cached_has_bits;
217 
218   cached_has_bits = _impl_._has_bits_[0];
219   // optional uint64 counter_period_ns = 1;
220   if (cached_has_bits & 0x00000001u) {
221     target = stream->EnsureSpace(target);
222     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_counter_period_ns(), target);
223   }
224 
225   // repeated uint32 counter_ids = 2;
226   for (int i = 0, n = this->_internal_counter_ids_size(); i < n; i++) {
227     target = stream->EnsureSpace(target);
228     target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_counter_ids(i), target);
229   }
230 
231   // optional bool instrumented_sampling = 3;
232   if (cached_has_bits & 0x00000002u) {
233     target = stream->EnsureSpace(target);
234     target = ::_pbi::WireFormatLite::WriteBoolToArray(3, this->_internal_instrumented_sampling(), target);
235   }
236 
237   // optional bool fix_gpu_clock = 4;
238   if (cached_has_bits & 0x00000004u) {
239     target = stream->EnsureSpace(target);
240     target = ::_pbi::WireFormatLite::WriteBoolToArray(4, this->_internal_fix_gpu_clock(), target);
241   }
242 
243   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
244     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
245         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
246   }
247   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.GpuCounterConfig)
248   return target;
249 }
250 
ByteSizeLong() const251 size_t GpuCounterConfig::ByteSizeLong() const {
252 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.GpuCounterConfig)
253   size_t total_size = 0;
254 
255   ::uint32_t cached_has_bits = 0;
256   // Prevent compiler warnings about cached_has_bits being unused
257   (void) cached_has_bits;
258 
259   // repeated uint32 counter_ids = 2;
260   {
261     size_t data_size = ::_pbi::WireFormatLite::
262       UInt32Size(this->_impl_.counter_ids_);
263     total_size += 1 *
264                   ::_pbi::FromIntSize(this->_internal_counter_ids_size());
265     total_size += data_size;
266   }
267 
268   cached_has_bits = _impl_._has_bits_[0];
269   if (cached_has_bits & 0x00000007u) {
270     // optional uint64 counter_period_ns = 1;
271     if (cached_has_bits & 0x00000001u) {
272       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_counter_period_ns());
273     }
274 
275     // optional bool instrumented_sampling = 3;
276     if (cached_has_bits & 0x00000002u) {
277       total_size += 1 + 1;
278     }
279 
280     // optional bool fix_gpu_clock = 4;
281     if (cached_has_bits & 0x00000004u) {
282       total_size += 1 + 1;
283     }
284 
285   }
286   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
287     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
288   }
289   int cached_size = ::_pbi::ToCachedSize(total_size);
290   SetCachedSize(cached_size);
291   return total_size;
292 }
293 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)294 void GpuCounterConfig::CheckTypeAndMergeFrom(
295     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
296   MergeFrom(*::_pbi::DownCast<const GpuCounterConfig*>(
297       &from));
298 }
299 
MergeFrom(const GpuCounterConfig & from)300 void GpuCounterConfig::MergeFrom(const GpuCounterConfig& from) {
301   GpuCounterConfig* const _this = this;
302   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.GpuCounterConfig)
303   GOOGLE_DCHECK_NE(&from, _this);
304   ::uint32_t cached_has_bits = 0;
305   (void) cached_has_bits;
306 
307   _this->_impl_.counter_ids_.MergeFrom(from._impl_.counter_ids_);
308   cached_has_bits = from._impl_._has_bits_[0];
309   if (cached_has_bits & 0x00000007u) {
310     if (cached_has_bits & 0x00000001u) {
311       _this->_impl_.counter_period_ns_ = from._impl_.counter_period_ns_;
312     }
313     if (cached_has_bits & 0x00000002u) {
314       _this->_impl_.instrumented_sampling_ = from._impl_.instrumented_sampling_;
315     }
316     if (cached_has_bits & 0x00000004u) {
317       _this->_impl_.fix_gpu_clock_ = from._impl_.fix_gpu_clock_;
318     }
319     _this->_impl_._has_bits_[0] |= cached_has_bits;
320   }
321   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
322 }
323 
CopyFrom(const GpuCounterConfig & from)324 void GpuCounterConfig::CopyFrom(const GpuCounterConfig& from) {
325 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.GpuCounterConfig)
326   if (&from == this) return;
327   Clear();
328   MergeFrom(from);
329 }
330 
IsInitialized() const331 bool GpuCounterConfig::IsInitialized() const {
332   return true;
333 }
334 
InternalSwap(GpuCounterConfig * other)335 void GpuCounterConfig::InternalSwap(GpuCounterConfig* other) {
336   using std::swap;
337   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
338   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
339   _impl_.counter_ids_.InternalSwap(&other->_impl_.counter_ids_);
340   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
341       PROTOBUF_FIELD_OFFSET(GpuCounterConfig, _impl_.fix_gpu_clock_)
342       + sizeof(GpuCounterConfig::_impl_.fix_gpu_clock_)  // NOLINT
343       - PROTOBUF_FIELD_OFFSET(GpuCounterConfig, _impl_.counter_period_ns_)>(
344           reinterpret_cast<char*>(&_impl_.counter_period_ns_),
345           reinterpret_cast<char*>(&other->_impl_.counter_period_ns_));
346 }
347 
GetTypeName() const348 std::string GpuCounterConfig::GetTypeName() const {
349   return "perfetto.protos.GpuCounterConfig";
350 }
351 
352 
353 // @@protoc_insertion_point(namespace_scope)
354 }  // namespace protos
355 }  // namespace perfetto
356 PROTOBUF_NAMESPACE_OPEN
357 template<> PROTOBUF_NOINLINE ::perfetto::protos::GpuCounterConfig*
CreateMaybeMessage(Arena * arena)358 Arena::CreateMaybeMessage< ::perfetto::protos::GpuCounterConfig >(Arena* arena) {
359   return Arena::CreateMessageInternal< ::perfetto::protos::GpuCounterConfig >(arena);
360 }
361 PROTOBUF_NAMESPACE_CLOSE
362 
363 // @@protoc_insertion_point(global_scope)
364 #include <google/protobuf/port_undef.inc>
365