1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/etw/etw_event.proto
3 
4 #include "protos/perfetto/trace/etw/etw_event.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 {
EtwTraceEvent(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR EtwTraceEvent::EtwTraceEvent(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.timestamp_)*/::uint64_t{0u}
28   , /*decltype(_impl_.cpu_)*/0u
29   , /*decltype(_impl_.event_)*/{}
30   , /*decltype(_impl_._oneof_case_)*/{}} {}
31 struct EtwTraceEventDefaultTypeInternal {
EtwTraceEventDefaultTypeInternalperfetto::protos::EtwTraceEventDefaultTypeInternal32   PROTOBUF_CONSTEXPR EtwTraceEventDefaultTypeInternal()
33       : _instance(::_pbi::ConstantInitialized{}) {}
~EtwTraceEventDefaultTypeInternalperfetto::protos::EtwTraceEventDefaultTypeInternal34   ~EtwTraceEventDefaultTypeInternal() {}
35   union {  // NOLINT(misc-non-private-member-variables-in-classes)
36     EtwTraceEvent _instance;
37   };
38 };
39 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EtwTraceEventDefaultTypeInternal _EtwTraceEvent_default_instance_;
40 }  // namespace protos
41 }  // namespace perfetto
42 namespace perfetto {
43 namespace protos {
44 
45 // ===================================================================
46 
47 class EtwTraceEvent::_Internal {
48  public:
49   using HasBits = decltype(std::declval<EtwTraceEvent>()._impl_._has_bits_);
set_has_timestamp(HasBits * has_bits)50   static void set_has_timestamp(HasBits* has_bits) {
51     (*has_bits)[0] |= 1u;
52   }
set_has_cpu(HasBits * has_bits)53   static void set_has_cpu(HasBits* has_bits) {
54     (*has_bits)[0] |= 2u;
55   }
56   static const ::perfetto::protos::CSwitchEtwEvent& c_switch(const EtwTraceEvent* msg);
57   static const ::perfetto::protos::ReadyThreadEtwEvent& ready_thread(const EtwTraceEvent* msg);
58 };
59 
60 const ::perfetto::protos::CSwitchEtwEvent&
c_switch(const EtwTraceEvent * msg)61 EtwTraceEvent::_Internal::c_switch(const EtwTraceEvent* msg) {
62   return *msg->_impl_.event_.c_switch_;
63 }
64 const ::perfetto::protos::ReadyThreadEtwEvent&
ready_thread(const EtwTraceEvent * msg)65 EtwTraceEvent::_Internal::ready_thread(const EtwTraceEvent* msg) {
66   return *msg->_impl_.event_.ready_thread_;
67 }
set_allocated_c_switch(::perfetto::protos::CSwitchEtwEvent * c_switch)68 void EtwTraceEvent::set_allocated_c_switch(::perfetto::protos::CSwitchEtwEvent* c_switch) {
69   ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
70   clear_event();
71   if (c_switch) {
72     ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
73         ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
74                 reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(c_switch));
75     if (message_arena != submessage_arena) {
76       c_switch = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
77           message_arena, c_switch, submessage_arena);
78     }
79     set_has_c_switch();
80     _impl_.event_.c_switch_ = c_switch;
81   }
82   // @@protoc_insertion_point(field_set_allocated:perfetto.protos.EtwTraceEvent.c_switch)
83 }
clear_c_switch()84 void EtwTraceEvent::clear_c_switch() {
85   if (_internal_has_c_switch()) {
86     if (GetArenaForAllocation() == nullptr) {
87       delete _impl_.event_.c_switch_;
88     }
89     clear_has_event();
90   }
91 }
set_allocated_ready_thread(::perfetto::protos::ReadyThreadEtwEvent * ready_thread)92 void EtwTraceEvent::set_allocated_ready_thread(::perfetto::protos::ReadyThreadEtwEvent* ready_thread) {
93   ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
94   clear_event();
95   if (ready_thread) {
96     ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
97         ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
98                 reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(ready_thread));
99     if (message_arena != submessage_arena) {
100       ready_thread = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
101           message_arena, ready_thread, submessage_arena);
102     }
103     set_has_ready_thread();
104     _impl_.event_.ready_thread_ = ready_thread;
105   }
106   // @@protoc_insertion_point(field_set_allocated:perfetto.protos.EtwTraceEvent.ready_thread)
107 }
clear_ready_thread()108 void EtwTraceEvent::clear_ready_thread() {
109   if (_internal_has_ready_thread()) {
110     if (GetArenaForAllocation() == nullptr) {
111       delete _impl_.event_.ready_thread_;
112     }
113     clear_has_event();
114   }
115 }
EtwTraceEvent(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)116 EtwTraceEvent::EtwTraceEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
117                          bool is_message_owned)
118   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
119   SharedCtor(arena, is_message_owned);
120   // @@protoc_insertion_point(arena_constructor:perfetto.protos.EtwTraceEvent)
121 }
EtwTraceEvent(const EtwTraceEvent & from)122 EtwTraceEvent::EtwTraceEvent(const EtwTraceEvent& from)
123   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
124   EtwTraceEvent* const _this = this; (void)_this;
125   new (&_impl_) Impl_{
126       decltype(_impl_._has_bits_){from._impl_._has_bits_}
127     , /*decltype(_impl_._cached_size_)*/{}
128     , decltype(_impl_.timestamp_){}
129     , decltype(_impl_.cpu_){}
130     , decltype(_impl_.event_){}
131     , /*decltype(_impl_._oneof_case_)*/{}};
132 
133   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
134   ::memcpy(&_impl_.timestamp_, &from._impl_.timestamp_,
135     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.cpu_) -
136     reinterpret_cast<char*>(&_impl_.timestamp_)) + sizeof(_impl_.cpu_));
137   clear_has_event();
138   switch (from.event_case()) {
139     case kCSwitch: {
140       _this->_internal_mutable_c_switch()->::perfetto::protos::CSwitchEtwEvent::MergeFrom(
141           from._internal_c_switch());
142       break;
143     }
144     case kReadyThread: {
145       _this->_internal_mutable_ready_thread()->::perfetto::protos::ReadyThreadEtwEvent::MergeFrom(
146           from._internal_ready_thread());
147       break;
148     }
149     case EVENT_NOT_SET: {
150       break;
151     }
152   }
153   // @@protoc_insertion_point(copy_constructor:perfetto.protos.EtwTraceEvent)
154 }
155 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)156 inline void EtwTraceEvent::SharedCtor(
157     ::_pb::Arena* arena, bool is_message_owned) {
158   (void)arena;
159   (void)is_message_owned;
160   new (&_impl_) Impl_{
161       decltype(_impl_._has_bits_){}
162     , /*decltype(_impl_._cached_size_)*/{}
163     , decltype(_impl_.timestamp_){::uint64_t{0u}}
164     , decltype(_impl_.cpu_){0u}
165     , decltype(_impl_.event_){}
166     , /*decltype(_impl_._oneof_case_)*/{}
167   };
168   clear_has_event();
169 }
170 
~EtwTraceEvent()171 EtwTraceEvent::~EtwTraceEvent() {
172   // @@protoc_insertion_point(destructor:perfetto.protos.EtwTraceEvent)
173   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
174   (void)arena;
175     return;
176   }
177   SharedDtor();
178 }
179 
SharedDtor()180 inline void EtwTraceEvent::SharedDtor() {
181   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
182   if (has_event()) {
183     clear_event();
184   }
185 }
186 
SetCachedSize(int size) const187 void EtwTraceEvent::SetCachedSize(int size) const {
188   _impl_._cached_size_.Set(size);
189 }
190 
clear_event()191 void EtwTraceEvent::clear_event() {
192 // @@protoc_insertion_point(one_of_clear_start:perfetto.protos.EtwTraceEvent)
193   switch (event_case()) {
194     case kCSwitch: {
195       if (GetArenaForAllocation() == nullptr) {
196         delete _impl_.event_.c_switch_;
197       }
198       break;
199     }
200     case kReadyThread: {
201       if (GetArenaForAllocation() == nullptr) {
202         delete _impl_.event_.ready_thread_;
203       }
204       break;
205     }
206     case EVENT_NOT_SET: {
207       break;
208     }
209   }
210   _impl_._oneof_case_[0] = EVENT_NOT_SET;
211 }
212 
213 
Clear()214 void EtwTraceEvent::Clear() {
215 // @@protoc_insertion_point(message_clear_start:perfetto.protos.EtwTraceEvent)
216   ::uint32_t cached_has_bits = 0;
217   // Prevent compiler warnings about cached_has_bits being unused
218   (void) cached_has_bits;
219 
220   cached_has_bits = _impl_._has_bits_[0];
221   if (cached_has_bits & 0x00000003u) {
222     ::memset(&_impl_.timestamp_, 0, static_cast<size_t>(
223         reinterpret_cast<char*>(&_impl_.cpu_) -
224         reinterpret_cast<char*>(&_impl_.timestamp_)) + sizeof(_impl_.cpu_));
225   }
226   clear_event();
227   _impl_._has_bits_.Clear();
228   _internal_metadata_.Clear<std::string>();
229 }
230 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)231 const char* EtwTraceEvent::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
232 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
233   _Internal::HasBits has_bits{};
234   while (!ctx->Done(&ptr)) {
235     ::uint32_t tag;
236     ptr = ::_pbi::ReadTag(ptr, &tag);
237     switch (tag >> 3) {
238       // optional uint64 timestamp = 1;
239       case 1:
240         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
241           _Internal::set_has_timestamp(&has_bits);
242           _impl_.timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
243           CHK_(ptr);
244         } else {
245           goto handle_unusual;
246         }
247         continue;
248       // .perfetto.protos.CSwitchEtwEvent c_switch = 2;
249       case 2:
250         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 18)) {
251           ptr = ctx->ParseMessage(_internal_mutable_c_switch(), ptr);
252           CHK_(ptr);
253         } else {
254           goto handle_unusual;
255         }
256         continue;
257       // .perfetto.protos.ReadyThreadEtwEvent ready_thread = 3;
258       case 3:
259         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 26)) {
260           ptr = ctx->ParseMessage(_internal_mutable_ready_thread(), ptr);
261           CHK_(ptr);
262         } else {
263           goto handle_unusual;
264         }
265         continue;
266       // optional uint32 cpu = 4;
267       case 4:
268         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 32)) {
269           _Internal::set_has_cpu(&has_bits);
270           _impl_.cpu_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
271           CHK_(ptr);
272         } else {
273           goto handle_unusual;
274         }
275         continue;
276       default:
277         goto handle_unusual;
278     }  // switch
279   handle_unusual:
280     if ((tag == 0) || ((tag & 7) == 4)) {
281       CHK_(ptr);
282       ctx->SetLastTag(tag);
283       goto message_done;
284     }
285     ptr = UnknownFieldParse(
286         tag,
287         _internal_metadata_.mutable_unknown_fields<std::string>(),
288         ptr, ctx);
289     CHK_(ptr != nullptr);
290   }  // while
291 message_done:
292   _impl_._has_bits_.Or(has_bits);
293   return ptr;
294 failure:
295   ptr = nullptr;
296   goto message_done;
297 #undef CHK_
298 }
299 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const300 ::uint8_t* EtwTraceEvent::_InternalSerialize(
301     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
302   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.EtwTraceEvent)
303   ::uint32_t cached_has_bits = 0;
304   (void) cached_has_bits;
305 
306   cached_has_bits = _impl_._has_bits_[0];
307   // optional uint64 timestamp = 1;
308   if (cached_has_bits & 0x00000001u) {
309     target = stream->EnsureSpace(target);
310     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_timestamp(), target);
311   }
312 
313   switch (event_case()) {
314     case kCSwitch: {
315       target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
316         InternalWriteMessage(2, _Internal::c_switch(this),
317           _Internal::c_switch(this).GetCachedSize(), target, stream);
318       break;
319     }
320     case kReadyThread: {
321       target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
322         InternalWriteMessage(3, _Internal::ready_thread(this),
323           _Internal::ready_thread(this).GetCachedSize(), target, stream);
324       break;
325     }
326     default: ;
327   }
328   // optional uint32 cpu = 4;
329   if (cached_has_bits & 0x00000002u) {
330     target = stream->EnsureSpace(target);
331     target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_cpu(), target);
332   }
333 
334   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
335     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
336         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
337   }
338   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.EtwTraceEvent)
339   return target;
340 }
341 
ByteSizeLong() const342 size_t EtwTraceEvent::ByteSizeLong() const {
343 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.EtwTraceEvent)
344   size_t total_size = 0;
345 
346   ::uint32_t cached_has_bits = 0;
347   // Prevent compiler warnings about cached_has_bits being unused
348   (void) cached_has_bits;
349 
350   cached_has_bits = _impl_._has_bits_[0];
351   if (cached_has_bits & 0x00000003u) {
352     // optional uint64 timestamp = 1;
353     if (cached_has_bits & 0x00000001u) {
354       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_timestamp());
355     }
356 
357     // optional uint32 cpu = 4;
358     if (cached_has_bits & 0x00000002u) {
359       total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_cpu());
360     }
361 
362   }
363   switch (event_case()) {
364     // .perfetto.protos.CSwitchEtwEvent c_switch = 2;
365     case kCSwitch: {
366       total_size += 1 +
367         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
368           *_impl_.event_.c_switch_);
369       break;
370     }
371     // .perfetto.protos.ReadyThreadEtwEvent ready_thread = 3;
372     case kReadyThread: {
373       total_size += 1 +
374         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
375           *_impl_.event_.ready_thread_);
376       break;
377     }
378     case EVENT_NOT_SET: {
379       break;
380     }
381   }
382   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
383     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
384   }
385   int cached_size = ::_pbi::ToCachedSize(total_size);
386   SetCachedSize(cached_size);
387   return total_size;
388 }
389 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)390 void EtwTraceEvent::CheckTypeAndMergeFrom(
391     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
392   MergeFrom(*::_pbi::DownCast<const EtwTraceEvent*>(
393       &from));
394 }
395 
MergeFrom(const EtwTraceEvent & from)396 void EtwTraceEvent::MergeFrom(const EtwTraceEvent& from) {
397   EtwTraceEvent* const _this = this;
398   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.EtwTraceEvent)
399   GOOGLE_DCHECK_NE(&from, _this);
400   ::uint32_t cached_has_bits = 0;
401   (void) cached_has_bits;
402 
403   cached_has_bits = from._impl_._has_bits_[0];
404   if (cached_has_bits & 0x00000003u) {
405     if (cached_has_bits & 0x00000001u) {
406       _this->_impl_.timestamp_ = from._impl_.timestamp_;
407     }
408     if (cached_has_bits & 0x00000002u) {
409       _this->_impl_.cpu_ = from._impl_.cpu_;
410     }
411     _this->_impl_._has_bits_[0] |= cached_has_bits;
412   }
413   switch (from.event_case()) {
414     case kCSwitch: {
415       _this->_internal_mutable_c_switch()->::perfetto::protos::CSwitchEtwEvent::MergeFrom(
416           from._internal_c_switch());
417       break;
418     }
419     case kReadyThread: {
420       _this->_internal_mutable_ready_thread()->::perfetto::protos::ReadyThreadEtwEvent::MergeFrom(
421           from._internal_ready_thread());
422       break;
423     }
424     case EVENT_NOT_SET: {
425       break;
426     }
427   }
428   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
429 }
430 
CopyFrom(const EtwTraceEvent & from)431 void EtwTraceEvent::CopyFrom(const EtwTraceEvent& from) {
432 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.EtwTraceEvent)
433   if (&from == this) return;
434   Clear();
435   MergeFrom(from);
436 }
437 
IsInitialized() const438 bool EtwTraceEvent::IsInitialized() const {
439   return true;
440 }
441 
InternalSwap(EtwTraceEvent * other)442 void EtwTraceEvent::InternalSwap(EtwTraceEvent* other) {
443   using std::swap;
444   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
445   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
446   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
447       PROTOBUF_FIELD_OFFSET(EtwTraceEvent, _impl_.cpu_)
448       + sizeof(EtwTraceEvent::_impl_.cpu_)  // NOLINT
449       - PROTOBUF_FIELD_OFFSET(EtwTraceEvent, _impl_.timestamp_)>(
450           reinterpret_cast<char*>(&_impl_.timestamp_),
451           reinterpret_cast<char*>(&other->_impl_.timestamp_));
452   swap(_impl_.event_, other->_impl_.event_);
453   swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
454 }
455 
GetTypeName() const456 std::string EtwTraceEvent::GetTypeName() const {
457   return "perfetto.protos.EtwTraceEvent";
458 }
459 
460 
461 // @@protoc_insertion_point(namespace_scope)
462 }  // namespace protos
463 }  // namespace perfetto
464 PROTOBUF_NAMESPACE_OPEN
465 template<> PROTOBUF_NOINLINE ::perfetto::protos::EtwTraceEvent*
CreateMaybeMessage(Arena * arena)466 Arena::CreateMaybeMessage< ::perfetto::protos::EtwTraceEvent >(Arena* arena) {
467   return Arena::CreateMessageInternal< ::perfetto::protos::EtwTraceEvent >(arena);
468 }
469 PROTOBUF_NAMESPACE_CLOSE
470 
471 // @@protoc_insertion_point(global_scope)
472 #include <google/protobuf/port_undef.inc>
473