1 // Generated by the protocol buffer compiler. DO NOT EDIT!
2 // source: protos/perfetto/trace/clock_snapshot.proto
3
4 #include "protos/perfetto/trace/clock_snapshot.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 {
ClockSnapshot_Clock(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR ClockSnapshot_Clock::ClockSnapshot_Clock(
24 ::_pbi::ConstantInitialized): _impl_{
25 /*decltype(_impl_._has_bits_)*/{}
26 , /*decltype(_impl_._cached_size_)*/{}
27 , /*decltype(_impl_.timestamp_)*/::uint64_t{0u}
28 , /*decltype(_impl_.clock_id_)*/0u
29 , /*decltype(_impl_.is_incremental_)*/false
30 , /*decltype(_impl_.unit_multiplier_ns_)*/::uint64_t{0u}} {}
31 struct ClockSnapshot_ClockDefaultTypeInternal {
ClockSnapshot_ClockDefaultTypeInternalperfetto::protos::ClockSnapshot_ClockDefaultTypeInternal32 PROTOBUF_CONSTEXPR ClockSnapshot_ClockDefaultTypeInternal()
33 : _instance(::_pbi::ConstantInitialized{}) {}
~ClockSnapshot_ClockDefaultTypeInternalperfetto::protos::ClockSnapshot_ClockDefaultTypeInternal34 ~ClockSnapshot_ClockDefaultTypeInternal() {}
35 union { // NOLINT(misc-non-private-member-variables-in-classes)
36 ClockSnapshot_Clock _instance;
37 };
38 };
39 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ClockSnapshot_ClockDefaultTypeInternal _ClockSnapshot_Clock_default_instance_;
ClockSnapshot(::_pbi::ConstantInitialized)40 PROTOBUF_CONSTEXPR ClockSnapshot::ClockSnapshot(
41 ::_pbi::ConstantInitialized): _impl_{
42 /*decltype(_impl_._has_bits_)*/{}
43 , /*decltype(_impl_._cached_size_)*/{}
44 , /*decltype(_impl_.clocks_)*/{}
45 , /*decltype(_impl_.primary_trace_clock_)*/0} {}
46 struct ClockSnapshotDefaultTypeInternal {
ClockSnapshotDefaultTypeInternalperfetto::protos::ClockSnapshotDefaultTypeInternal47 PROTOBUF_CONSTEXPR ClockSnapshotDefaultTypeInternal()
48 : _instance(::_pbi::ConstantInitialized{}) {}
~ClockSnapshotDefaultTypeInternalperfetto::protos::ClockSnapshotDefaultTypeInternal49 ~ClockSnapshotDefaultTypeInternal() {}
50 union { // NOLINT(misc-non-private-member-variables-in-classes)
51 ClockSnapshot _instance;
52 };
53 };
54 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ClockSnapshotDefaultTypeInternal _ClockSnapshot_default_instance_;
55 } // namespace protos
56 } // namespace perfetto
57 namespace perfetto {
58 namespace protos {
ClockSnapshot_Clock_BuiltinClocks_IsValid(int value)59 bool ClockSnapshot_Clock_BuiltinClocks_IsValid(int value) {
60 switch (value) {
61 case 0:
62 case 1:
63 case 2:
64 case 3:
65 case 4:
66 case 5:
67 case 6:
68 case 63:
69 return true;
70 default:
71 return false;
72 }
73 }
74
75 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ClockSnapshot_Clock_BuiltinClocks_strings[8] = {};
76
77 static const char ClockSnapshot_Clock_BuiltinClocks_names[] =
78 "BOOTTIME"
79 "BUILTIN_CLOCK_MAX_ID"
80 "MONOTONIC"
81 "MONOTONIC_COARSE"
82 "MONOTONIC_RAW"
83 "REALTIME"
84 "REALTIME_COARSE"
85 "UNKNOWN";
86
87 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ClockSnapshot_Clock_BuiltinClocks_entries[] = {
88 { {ClockSnapshot_Clock_BuiltinClocks_names + 0, 8}, 6 },
89 { {ClockSnapshot_Clock_BuiltinClocks_names + 8, 20}, 63 },
90 { {ClockSnapshot_Clock_BuiltinClocks_names + 28, 9}, 3 },
91 { {ClockSnapshot_Clock_BuiltinClocks_names + 37, 16}, 4 },
92 { {ClockSnapshot_Clock_BuiltinClocks_names + 53, 13}, 5 },
93 { {ClockSnapshot_Clock_BuiltinClocks_names + 66, 8}, 1 },
94 { {ClockSnapshot_Clock_BuiltinClocks_names + 74, 15}, 2 },
95 { {ClockSnapshot_Clock_BuiltinClocks_names + 89, 7}, 0 },
96 };
97
98 static const int ClockSnapshot_Clock_BuiltinClocks_entries_by_number[] = {
99 7, // 0 -> UNKNOWN
100 5, // 1 -> REALTIME
101 6, // 2 -> REALTIME_COARSE
102 2, // 3 -> MONOTONIC
103 3, // 4 -> MONOTONIC_COARSE
104 4, // 5 -> MONOTONIC_RAW
105 0, // 6 -> BOOTTIME
106 1, // 63 -> BUILTIN_CLOCK_MAX_ID
107 };
108
ClockSnapshot_Clock_BuiltinClocks_Name(ClockSnapshot_Clock_BuiltinClocks value)109 const std::string& ClockSnapshot_Clock_BuiltinClocks_Name(
110 ClockSnapshot_Clock_BuiltinClocks value) {
111 static const bool dummy =
112 ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
113 ClockSnapshot_Clock_BuiltinClocks_entries,
114 ClockSnapshot_Clock_BuiltinClocks_entries_by_number,
115 8, ClockSnapshot_Clock_BuiltinClocks_strings);
116 (void) dummy;
117 int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
118 ClockSnapshot_Clock_BuiltinClocks_entries,
119 ClockSnapshot_Clock_BuiltinClocks_entries_by_number,
120 8, value);
121 return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
122 ClockSnapshot_Clock_BuiltinClocks_strings[idx].get();
123 }
ClockSnapshot_Clock_BuiltinClocks_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,ClockSnapshot_Clock_BuiltinClocks * value)124 bool ClockSnapshot_Clock_BuiltinClocks_Parse(
125 ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ClockSnapshot_Clock_BuiltinClocks* value) {
126 int int_value;
127 bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
128 ClockSnapshot_Clock_BuiltinClocks_entries, 8, name, &int_value);
129 if (success) {
130 *value = static_cast<ClockSnapshot_Clock_BuiltinClocks>(int_value);
131 }
132 return success;
133 }
134 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
135 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::UNKNOWN;
136 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::REALTIME;
137 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::REALTIME_COARSE;
138 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::MONOTONIC;
139 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::MONOTONIC_COARSE;
140 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::MONOTONIC_RAW;
141 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::BOOTTIME;
142 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::BUILTIN_CLOCK_MAX_ID;
143 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::BuiltinClocks_MIN;
144 constexpr ClockSnapshot_Clock_BuiltinClocks ClockSnapshot_Clock::BuiltinClocks_MAX;
145 constexpr int ClockSnapshot_Clock::BuiltinClocks_ARRAYSIZE;
146 #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
147
148 // ===================================================================
149
150 class ClockSnapshot_Clock::_Internal {
151 public:
152 using HasBits = decltype(std::declval<ClockSnapshot_Clock>()._impl_._has_bits_);
set_has_clock_id(HasBits * has_bits)153 static void set_has_clock_id(HasBits* has_bits) {
154 (*has_bits)[0] |= 2u;
155 }
set_has_timestamp(HasBits * has_bits)156 static void set_has_timestamp(HasBits* has_bits) {
157 (*has_bits)[0] |= 1u;
158 }
set_has_is_incremental(HasBits * has_bits)159 static void set_has_is_incremental(HasBits* has_bits) {
160 (*has_bits)[0] |= 4u;
161 }
set_has_unit_multiplier_ns(HasBits * has_bits)162 static void set_has_unit_multiplier_ns(HasBits* has_bits) {
163 (*has_bits)[0] |= 8u;
164 }
165 };
166
ClockSnapshot_Clock(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)167 ClockSnapshot_Clock::ClockSnapshot_Clock(::PROTOBUF_NAMESPACE_ID::Arena* arena,
168 bool is_message_owned)
169 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
170 SharedCtor(arena, is_message_owned);
171 // @@protoc_insertion_point(arena_constructor:perfetto.protos.ClockSnapshot.Clock)
172 }
ClockSnapshot_Clock(const ClockSnapshot_Clock & from)173 ClockSnapshot_Clock::ClockSnapshot_Clock(const ClockSnapshot_Clock& from)
174 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
175 ClockSnapshot_Clock* const _this = this; (void)_this;
176 new (&_impl_) Impl_{
177 decltype(_impl_._has_bits_){from._impl_._has_bits_}
178 , /*decltype(_impl_._cached_size_)*/{}
179 , decltype(_impl_.timestamp_){}
180 , decltype(_impl_.clock_id_){}
181 , decltype(_impl_.is_incremental_){}
182 , decltype(_impl_.unit_multiplier_ns_){}};
183
184 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
185 ::memcpy(&_impl_.timestamp_, &from._impl_.timestamp_,
186 static_cast<size_t>(reinterpret_cast<char*>(&_impl_.unit_multiplier_ns_) -
187 reinterpret_cast<char*>(&_impl_.timestamp_)) + sizeof(_impl_.unit_multiplier_ns_));
188 // @@protoc_insertion_point(copy_constructor:perfetto.protos.ClockSnapshot.Clock)
189 }
190
SharedCtor(::_pb::Arena * arena,bool is_message_owned)191 inline void ClockSnapshot_Clock::SharedCtor(
192 ::_pb::Arena* arena, bool is_message_owned) {
193 (void)arena;
194 (void)is_message_owned;
195 new (&_impl_) Impl_{
196 decltype(_impl_._has_bits_){}
197 , /*decltype(_impl_._cached_size_)*/{}
198 , decltype(_impl_.timestamp_){::uint64_t{0u}}
199 , decltype(_impl_.clock_id_){0u}
200 , decltype(_impl_.is_incremental_){false}
201 , decltype(_impl_.unit_multiplier_ns_){::uint64_t{0u}}
202 };
203 }
204
~ClockSnapshot_Clock()205 ClockSnapshot_Clock::~ClockSnapshot_Clock() {
206 // @@protoc_insertion_point(destructor:perfetto.protos.ClockSnapshot.Clock)
207 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
208 (void)arena;
209 return;
210 }
211 SharedDtor();
212 }
213
SharedDtor()214 inline void ClockSnapshot_Clock::SharedDtor() {
215 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
216 }
217
SetCachedSize(int size) const218 void ClockSnapshot_Clock::SetCachedSize(int size) const {
219 _impl_._cached_size_.Set(size);
220 }
221
Clear()222 void ClockSnapshot_Clock::Clear() {
223 // @@protoc_insertion_point(message_clear_start:perfetto.protos.ClockSnapshot.Clock)
224 ::uint32_t cached_has_bits = 0;
225 // Prevent compiler warnings about cached_has_bits being unused
226 (void) cached_has_bits;
227
228 cached_has_bits = _impl_._has_bits_[0];
229 if (cached_has_bits & 0x0000000fu) {
230 ::memset(&_impl_.timestamp_, 0, static_cast<size_t>(
231 reinterpret_cast<char*>(&_impl_.unit_multiplier_ns_) -
232 reinterpret_cast<char*>(&_impl_.timestamp_)) + sizeof(_impl_.unit_multiplier_ns_));
233 }
234 _impl_._has_bits_.Clear();
235 _internal_metadata_.Clear<std::string>();
236 }
237
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)238 const char* ClockSnapshot_Clock::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
239 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
240 _Internal::HasBits has_bits{};
241 while (!ctx->Done(&ptr)) {
242 ::uint32_t tag;
243 ptr = ::_pbi::ReadTag(ptr, &tag);
244 switch (tag >> 3) {
245 // optional uint32 clock_id = 1;
246 case 1:
247 if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
248 _Internal::set_has_clock_id(&has_bits);
249 _impl_.clock_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
250 CHK_(ptr);
251 } else {
252 goto handle_unusual;
253 }
254 continue;
255 // optional uint64 timestamp = 2;
256 case 2:
257 if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
258 _Internal::set_has_timestamp(&has_bits);
259 _impl_.timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
260 CHK_(ptr);
261 } else {
262 goto handle_unusual;
263 }
264 continue;
265 // optional bool is_incremental = 3;
266 case 3:
267 if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
268 _Internal::set_has_is_incremental(&has_bits);
269 _impl_.is_incremental_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
270 CHK_(ptr);
271 } else {
272 goto handle_unusual;
273 }
274 continue;
275 // optional uint64 unit_multiplier_ns = 4;
276 case 4:
277 if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 32)) {
278 _Internal::set_has_unit_multiplier_ns(&has_bits);
279 _impl_.unit_multiplier_ns_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
280 CHK_(ptr);
281 } else {
282 goto handle_unusual;
283 }
284 continue;
285 default:
286 goto handle_unusual;
287 } // switch
288 handle_unusual:
289 if ((tag == 0) || ((tag & 7) == 4)) {
290 CHK_(ptr);
291 ctx->SetLastTag(tag);
292 goto message_done;
293 }
294 ptr = UnknownFieldParse(
295 tag,
296 _internal_metadata_.mutable_unknown_fields<std::string>(),
297 ptr, ctx);
298 CHK_(ptr != nullptr);
299 } // while
300 message_done:
301 _impl_._has_bits_.Or(has_bits);
302 return ptr;
303 failure:
304 ptr = nullptr;
305 goto message_done;
306 #undef CHK_
307 }
308
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const309 ::uint8_t* ClockSnapshot_Clock::_InternalSerialize(
310 ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
311 // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.ClockSnapshot.Clock)
312 ::uint32_t cached_has_bits = 0;
313 (void) cached_has_bits;
314
315 cached_has_bits = _impl_._has_bits_[0];
316 // optional uint32 clock_id = 1;
317 if (cached_has_bits & 0x00000002u) {
318 target = stream->EnsureSpace(target);
319 target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_clock_id(), target);
320 }
321
322 // optional uint64 timestamp = 2;
323 if (cached_has_bits & 0x00000001u) {
324 target = stream->EnsureSpace(target);
325 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_timestamp(), target);
326 }
327
328 // optional bool is_incremental = 3;
329 if (cached_has_bits & 0x00000004u) {
330 target = stream->EnsureSpace(target);
331 target = ::_pbi::WireFormatLite::WriteBoolToArray(3, this->_internal_is_incremental(), target);
332 }
333
334 // optional uint64 unit_multiplier_ns = 4;
335 if (cached_has_bits & 0x00000008u) {
336 target = stream->EnsureSpace(target);
337 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(4, this->_internal_unit_multiplier_ns(), target);
338 }
339
340 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
341 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
342 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
343 }
344 // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.ClockSnapshot.Clock)
345 return target;
346 }
347
ByteSizeLong() const348 size_t ClockSnapshot_Clock::ByteSizeLong() const {
349 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.ClockSnapshot.Clock)
350 size_t total_size = 0;
351
352 ::uint32_t cached_has_bits = 0;
353 // Prevent compiler warnings about cached_has_bits being unused
354 (void) cached_has_bits;
355
356 cached_has_bits = _impl_._has_bits_[0];
357 if (cached_has_bits & 0x0000000fu) {
358 // optional uint64 timestamp = 2;
359 if (cached_has_bits & 0x00000001u) {
360 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_timestamp());
361 }
362
363 // optional uint32 clock_id = 1;
364 if (cached_has_bits & 0x00000002u) {
365 total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_clock_id());
366 }
367
368 // optional bool is_incremental = 3;
369 if (cached_has_bits & 0x00000004u) {
370 total_size += 1 + 1;
371 }
372
373 // optional uint64 unit_multiplier_ns = 4;
374 if (cached_has_bits & 0x00000008u) {
375 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_unit_multiplier_ns());
376 }
377
378 }
379 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
380 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
381 }
382 int cached_size = ::_pbi::ToCachedSize(total_size);
383 SetCachedSize(cached_size);
384 return total_size;
385 }
386
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)387 void ClockSnapshot_Clock::CheckTypeAndMergeFrom(
388 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
389 MergeFrom(*::_pbi::DownCast<const ClockSnapshot_Clock*>(
390 &from));
391 }
392
MergeFrom(const ClockSnapshot_Clock & from)393 void ClockSnapshot_Clock::MergeFrom(const ClockSnapshot_Clock& from) {
394 ClockSnapshot_Clock* const _this = this;
395 // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.ClockSnapshot.Clock)
396 GOOGLE_DCHECK_NE(&from, _this);
397 ::uint32_t cached_has_bits = 0;
398 (void) cached_has_bits;
399
400 cached_has_bits = from._impl_._has_bits_[0];
401 if (cached_has_bits & 0x0000000fu) {
402 if (cached_has_bits & 0x00000001u) {
403 _this->_impl_.timestamp_ = from._impl_.timestamp_;
404 }
405 if (cached_has_bits & 0x00000002u) {
406 _this->_impl_.clock_id_ = from._impl_.clock_id_;
407 }
408 if (cached_has_bits & 0x00000004u) {
409 _this->_impl_.is_incremental_ = from._impl_.is_incremental_;
410 }
411 if (cached_has_bits & 0x00000008u) {
412 _this->_impl_.unit_multiplier_ns_ = from._impl_.unit_multiplier_ns_;
413 }
414 _this->_impl_._has_bits_[0] |= cached_has_bits;
415 }
416 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
417 }
418
CopyFrom(const ClockSnapshot_Clock & from)419 void ClockSnapshot_Clock::CopyFrom(const ClockSnapshot_Clock& from) {
420 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.ClockSnapshot.Clock)
421 if (&from == this) return;
422 Clear();
423 MergeFrom(from);
424 }
425
IsInitialized() const426 bool ClockSnapshot_Clock::IsInitialized() const {
427 return true;
428 }
429
InternalSwap(ClockSnapshot_Clock * other)430 void ClockSnapshot_Clock::InternalSwap(ClockSnapshot_Clock* other) {
431 using std::swap;
432 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
433 swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
434 ::PROTOBUF_NAMESPACE_ID::internal::memswap<
435 PROTOBUF_FIELD_OFFSET(ClockSnapshot_Clock, _impl_.unit_multiplier_ns_)
436 + sizeof(ClockSnapshot_Clock::_impl_.unit_multiplier_ns_) // NOLINT
437 - PROTOBUF_FIELD_OFFSET(ClockSnapshot_Clock, _impl_.timestamp_)>(
438 reinterpret_cast<char*>(&_impl_.timestamp_),
439 reinterpret_cast<char*>(&other->_impl_.timestamp_));
440 }
441
GetTypeName() const442 std::string ClockSnapshot_Clock::GetTypeName() const {
443 return "perfetto.protos.ClockSnapshot.Clock";
444 }
445
446
447 // ===================================================================
448
449 class ClockSnapshot::_Internal {
450 public:
451 using HasBits = decltype(std::declval<ClockSnapshot>()._impl_._has_bits_);
set_has_primary_trace_clock(HasBits * has_bits)452 static void set_has_primary_trace_clock(HasBits* has_bits) {
453 (*has_bits)[0] |= 1u;
454 }
455 };
456
ClockSnapshot(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)457 ClockSnapshot::ClockSnapshot(::PROTOBUF_NAMESPACE_ID::Arena* arena,
458 bool is_message_owned)
459 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
460 SharedCtor(arena, is_message_owned);
461 // @@protoc_insertion_point(arena_constructor:perfetto.protos.ClockSnapshot)
462 }
ClockSnapshot(const ClockSnapshot & from)463 ClockSnapshot::ClockSnapshot(const ClockSnapshot& from)
464 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
465 ClockSnapshot* const _this = this; (void)_this;
466 new (&_impl_) Impl_{
467 decltype(_impl_._has_bits_){from._impl_._has_bits_}
468 , /*decltype(_impl_._cached_size_)*/{}
469 , decltype(_impl_.clocks_){from._impl_.clocks_}
470 , decltype(_impl_.primary_trace_clock_){}};
471
472 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
473 _this->_impl_.primary_trace_clock_ = from._impl_.primary_trace_clock_;
474 // @@protoc_insertion_point(copy_constructor:perfetto.protos.ClockSnapshot)
475 }
476
SharedCtor(::_pb::Arena * arena,bool is_message_owned)477 inline void ClockSnapshot::SharedCtor(
478 ::_pb::Arena* arena, bool is_message_owned) {
479 (void)arena;
480 (void)is_message_owned;
481 new (&_impl_) Impl_{
482 decltype(_impl_._has_bits_){}
483 , /*decltype(_impl_._cached_size_)*/{}
484 , decltype(_impl_.clocks_){arena}
485 , decltype(_impl_.primary_trace_clock_){0}
486 };
487 }
488
~ClockSnapshot()489 ClockSnapshot::~ClockSnapshot() {
490 // @@protoc_insertion_point(destructor:perfetto.protos.ClockSnapshot)
491 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
492 (void)arena;
493 return;
494 }
495 SharedDtor();
496 }
497
SharedDtor()498 inline void ClockSnapshot::SharedDtor() {
499 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
500 _impl_.clocks_.~RepeatedPtrField();
501 }
502
SetCachedSize(int size) const503 void ClockSnapshot::SetCachedSize(int size) const {
504 _impl_._cached_size_.Set(size);
505 }
506
Clear()507 void ClockSnapshot::Clear() {
508 // @@protoc_insertion_point(message_clear_start:perfetto.protos.ClockSnapshot)
509 ::uint32_t cached_has_bits = 0;
510 // Prevent compiler warnings about cached_has_bits being unused
511 (void) cached_has_bits;
512
513 _impl_.clocks_.Clear();
514 _impl_.primary_trace_clock_ = 0;
515 _impl_._has_bits_.Clear();
516 _internal_metadata_.Clear<std::string>();
517 }
518
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)519 const char* ClockSnapshot::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
520 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
521 _Internal::HasBits has_bits{};
522 while (!ctx->Done(&ptr)) {
523 ::uint32_t tag;
524 ptr = ::_pbi::ReadTag(ptr, &tag);
525 switch (tag >> 3) {
526 // repeated .perfetto.protos.ClockSnapshot.Clock clocks = 1;
527 case 1:
528 if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
529 ptr -= 1;
530 do {
531 ptr += 1;
532 ptr = ctx->ParseMessage(_internal_add_clocks(), ptr);
533 CHK_(ptr);
534 if (!ctx->DataAvailable(ptr)) break;
535 } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
536 } else {
537 goto handle_unusual;
538 }
539 continue;
540 // optional .perfetto.protos.BuiltinClock primary_trace_clock = 2;
541 case 2:
542 if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
543 ::uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
544 CHK_(ptr);
545 if (PROTOBUF_PREDICT_TRUE(::perfetto::protos::BuiltinClock_IsValid(val))) {
546 _internal_set_primary_trace_clock(static_cast<::perfetto::protos::BuiltinClock>(val));
547 } else {
548 ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields());
549 }
550 } else {
551 goto handle_unusual;
552 }
553 continue;
554 default:
555 goto handle_unusual;
556 } // switch
557 handle_unusual:
558 if ((tag == 0) || ((tag & 7) == 4)) {
559 CHK_(ptr);
560 ctx->SetLastTag(tag);
561 goto message_done;
562 }
563 ptr = UnknownFieldParse(
564 tag,
565 _internal_metadata_.mutable_unknown_fields<std::string>(),
566 ptr, ctx);
567 CHK_(ptr != nullptr);
568 } // while
569 message_done:
570 _impl_._has_bits_.Or(has_bits);
571 return ptr;
572 failure:
573 ptr = nullptr;
574 goto message_done;
575 #undef CHK_
576 }
577
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const578 ::uint8_t* ClockSnapshot::_InternalSerialize(
579 ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
580 // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.ClockSnapshot)
581 ::uint32_t cached_has_bits = 0;
582 (void) cached_has_bits;
583
584 // repeated .perfetto.protos.ClockSnapshot.Clock clocks = 1;
585 for (unsigned i = 0,
586 n = static_cast<unsigned>(this->_internal_clocks_size()); i < n; i++) {
587 const auto& repfield = this->_internal_clocks(i);
588 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
589 InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream);
590 }
591
592 cached_has_bits = _impl_._has_bits_[0];
593 // optional .perfetto.protos.BuiltinClock primary_trace_clock = 2;
594 if (cached_has_bits & 0x00000001u) {
595 target = stream->EnsureSpace(target);
596 target = ::_pbi::WireFormatLite::WriteEnumToArray(
597 2, this->_internal_primary_trace_clock(), target);
598 }
599
600 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
601 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
602 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
603 }
604 // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.ClockSnapshot)
605 return target;
606 }
607
ByteSizeLong() const608 size_t ClockSnapshot::ByteSizeLong() const {
609 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.ClockSnapshot)
610 size_t total_size = 0;
611
612 ::uint32_t cached_has_bits = 0;
613 // Prevent compiler warnings about cached_has_bits being unused
614 (void) cached_has_bits;
615
616 // repeated .perfetto.protos.ClockSnapshot.Clock clocks = 1;
617 total_size += 1UL * this->_internal_clocks_size();
618 for (const auto& msg : this->_impl_.clocks_) {
619 total_size +=
620 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
621 }
622
623 // optional .perfetto.protos.BuiltinClock primary_trace_clock = 2;
624 cached_has_bits = _impl_._has_bits_[0];
625 if (cached_has_bits & 0x00000001u) {
626 total_size += 1 +
627 ::_pbi::WireFormatLite::EnumSize(this->_internal_primary_trace_clock());
628 }
629
630 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
631 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
632 }
633 int cached_size = ::_pbi::ToCachedSize(total_size);
634 SetCachedSize(cached_size);
635 return total_size;
636 }
637
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)638 void ClockSnapshot::CheckTypeAndMergeFrom(
639 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
640 MergeFrom(*::_pbi::DownCast<const ClockSnapshot*>(
641 &from));
642 }
643
MergeFrom(const ClockSnapshot & from)644 void ClockSnapshot::MergeFrom(const ClockSnapshot& from) {
645 ClockSnapshot* const _this = this;
646 // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.ClockSnapshot)
647 GOOGLE_DCHECK_NE(&from, _this);
648 ::uint32_t cached_has_bits = 0;
649 (void) cached_has_bits;
650
651 _this->_impl_.clocks_.MergeFrom(from._impl_.clocks_);
652 if (from._internal_has_primary_trace_clock()) {
653 _this->_internal_set_primary_trace_clock(from._internal_primary_trace_clock());
654 }
655 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
656 }
657
CopyFrom(const ClockSnapshot & from)658 void ClockSnapshot::CopyFrom(const ClockSnapshot& from) {
659 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.ClockSnapshot)
660 if (&from == this) return;
661 Clear();
662 MergeFrom(from);
663 }
664
IsInitialized() const665 bool ClockSnapshot::IsInitialized() const {
666 return true;
667 }
668
InternalSwap(ClockSnapshot * other)669 void ClockSnapshot::InternalSwap(ClockSnapshot* other) {
670 using std::swap;
671 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
672 swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
673 _impl_.clocks_.InternalSwap(&other->_impl_.clocks_);
674 swap(_impl_.primary_trace_clock_, other->_impl_.primary_trace_clock_);
675 }
676
GetTypeName() const677 std::string ClockSnapshot::GetTypeName() const {
678 return "perfetto.protos.ClockSnapshot";
679 }
680
681
682 // @@protoc_insertion_point(namespace_scope)
683 } // namespace protos
684 } // namespace perfetto
685 PROTOBUF_NAMESPACE_OPEN
686 template<> PROTOBUF_NOINLINE ::perfetto::protos::ClockSnapshot_Clock*
CreateMaybeMessage(Arena * arena)687 Arena::CreateMaybeMessage< ::perfetto::protos::ClockSnapshot_Clock >(Arena* arena) {
688 return Arena::CreateMessageInternal< ::perfetto::protos::ClockSnapshot_Clock >(arena);
689 }
690 template<> PROTOBUF_NOINLINE ::perfetto::protos::ClockSnapshot*
CreateMaybeMessage(Arena * arena)691 Arena::CreateMaybeMessage< ::perfetto::protos::ClockSnapshot >(Arena* arena) {
692 return Arena::CreateMessageInternal< ::perfetto::protos::ClockSnapshot >(arena);
693 }
694 PROTOBUF_NAMESPACE_CLOSE
695
696 // @@protoc_insertion_point(global_scope)
697 #include <google/protobuf/port_undef.inc>
698