Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /*******************************************************************************
     18  * AUTOGENERATED - DO NOT EDIT
     19  *******************************************************************************
     20  * This file has been generated from the protobuf message
     21  * perfetto/common/trace_stats.proto
     22  * by
     23  * ../../tools/proto_to_cpp/proto_to_cpp.cc.
     24  * If you need to make changes here, change the .proto file and then run
     25  * ./tools/gen_tracing_cpp_headers_from_protos
     26  */
     27 
     28 #include "perfetto/tracing/core/trace_stats.h"
     29 
     30 #include "perfetto/common/trace_stats.pb.h"
     31 
     32 namespace perfetto {
     33 
     34 TraceStats::TraceStats() = default;
     35 TraceStats::~TraceStats() = default;
     36 TraceStats::TraceStats(const TraceStats&) = default;
     37 TraceStats& TraceStats::operator=(const TraceStats&) = default;
     38 TraceStats::TraceStats(TraceStats&&) noexcept = default;
     39 TraceStats& TraceStats::operator=(TraceStats&&) = default;
     40 
     41 #pragma GCC diagnostic push
     42 #pragma GCC diagnostic ignored "-Wfloat-equal"
     43 bool TraceStats::operator==(const TraceStats& other) const {
     44   return (buffer_stats_ == other.buffer_stats_) &&
     45          (producers_connected_ == other.producers_connected_) &&
     46          (producers_seen_ == other.producers_seen_) &&
     47          (data_sources_registered_ == other.data_sources_registered_) &&
     48          (data_sources_seen_ == other.data_sources_seen_) &&
     49          (tracing_sessions_ == other.tracing_sessions_) &&
     50          (total_buffers_ == other.total_buffers_) &&
     51          (chunks_discarded_ == other.chunks_discarded_) &&
     52          (patches_discarded_ == other.patches_discarded_);
     53 }
     54 #pragma GCC diagnostic pop
     55 
     56 void TraceStats::FromProto(const perfetto::protos::TraceStats& proto) {
     57   buffer_stats_.clear();
     58   for (const auto& field : proto.buffer_stats()) {
     59     buffer_stats_.emplace_back();
     60     buffer_stats_.back().FromProto(field);
     61   }
     62 
     63   static_assert(
     64       sizeof(producers_connected_) == sizeof(proto.producers_connected()),
     65       "size mismatch");
     66   producers_connected_ =
     67       static_cast<decltype(producers_connected_)>(proto.producers_connected());
     68 
     69   static_assert(sizeof(producers_seen_) == sizeof(proto.producers_seen()),
     70                 "size mismatch");
     71   producers_seen_ =
     72       static_cast<decltype(producers_seen_)>(proto.producers_seen());
     73 
     74   static_assert(sizeof(data_sources_registered_) ==
     75                     sizeof(proto.data_sources_registered()),
     76                 "size mismatch");
     77   data_sources_registered_ = static_cast<decltype(data_sources_registered_)>(
     78       proto.data_sources_registered());
     79 
     80   static_assert(sizeof(data_sources_seen_) == sizeof(proto.data_sources_seen()),
     81                 "size mismatch");
     82   data_sources_seen_ =
     83       static_cast<decltype(data_sources_seen_)>(proto.data_sources_seen());
     84 
     85   static_assert(sizeof(tracing_sessions_) == sizeof(proto.tracing_sessions()),
     86                 "size mismatch");
     87   tracing_sessions_ =
     88       static_cast<decltype(tracing_sessions_)>(proto.tracing_sessions());
     89 
     90   static_assert(sizeof(total_buffers_) == sizeof(proto.total_buffers()),
     91                 "size mismatch");
     92   total_buffers_ = static_cast<decltype(total_buffers_)>(proto.total_buffers());
     93 
     94   static_assert(sizeof(chunks_discarded_) == sizeof(proto.chunks_discarded()),
     95                 "size mismatch");
     96   chunks_discarded_ =
     97       static_cast<decltype(chunks_discarded_)>(proto.chunks_discarded());
     98 
     99   static_assert(sizeof(patches_discarded_) == sizeof(proto.patches_discarded()),
    100                 "size mismatch");
    101   patches_discarded_ =
    102       static_cast<decltype(patches_discarded_)>(proto.patches_discarded());
    103   unknown_fields_ = proto.unknown_fields();
    104 }
    105 
    106 void TraceStats::ToProto(perfetto::protos::TraceStats* proto) const {
    107   proto->Clear();
    108 
    109   for (const auto& it : buffer_stats_) {
    110     auto* entry = proto->add_buffer_stats();
    111     it.ToProto(entry);
    112   }
    113 
    114   static_assert(
    115       sizeof(producers_connected_) == sizeof(proto->producers_connected()),
    116       "size mismatch");
    117   proto->set_producers_connected(
    118       static_cast<decltype(proto->producers_connected())>(
    119           producers_connected_));
    120 
    121   static_assert(sizeof(producers_seen_) == sizeof(proto->producers_seen()),
    122                 "size mismatch");
    123   proto->set_producers_seen(
    124       static_cast<decltype(proto->producers_seen())>(producers_seen_));
    125 
    126   static_assert(sizeof(data_sources_registered_) ==
    127                     sizeof(proto->data_sources_registered()),
    128                 "size mismatch");
    129   proto->set_data_sources_registered(
    130       static_cast<decltype(proto->data_sources_registered())>(
    131           data_sources_registered_));
    132 
    133   static_assert(
    134       sizeof(data_sources_seen_) == sizeof(proto->data_sources_seen()),
    135       "size mismatch");
    136   proto->set_data_sources_seen(
    137       static_cast<decltype(proto->data_sources_seen())>(data_sources_seen_));
    138 
    139   static_assert(sizeof(tracing_sessions_) == sizeof(proto->tracing_sessions()),
    140                 "size mismatch");
    141   proto->set_tracing_sessions(
    142       static_cast<decltype(proto->tracing_sessions())>(tracing_sessions_));
    143 
    144   static_assert(sizeof(total_buffers_) == sizeof(proto->total_buffers()),
    145                 "size mismatch");
    146   proto->set_total_buffers(
    147       static_cast<decltype(proto->total_buffers())>(total_buffers_));
    148 
    149   static_assert(sizeof(chunks_discarded_) == sizeof(proto->chunks_discarded()),
    150                 "size mismatch");
    151   proto->set_chunks_discarded(
    152       static_cast<decltype(proto->chunks_discarded())>(chunks_discarded_));
    153 
    154   static_assert(
    155       sizeof(patches_discarded_) == sizeof(proto->patches_discarded()),
    156       "size mismatch");
    157   proto->set_patches_discarded(
    158       static_cast<decltype(proto->patches_discarded())>(patches_discarded_));
    159   *(proto->mutable_unknown_fields()) = unknown_fields_;
    160 }
    161 
    162 TraceStats::BufferStats::BufferStats() = default;
    163 TraceStats::BufferStats::~BufferStats() = default;
    164 TraceStats::BufferStats::BufferStats(const TraceStats::BufferStats&) = default;
    165 TraceStats::BufferStats& TraceStats::BufferStats::operator=(
    166     const TraceStats::BufferStats&) = default;
    167 TraceStats::BufferStats::BufferStats(TraceStats::BufferStats&&) noexcept =
    168     default;
    169 TraceStats::BufferStats& TraceStats::BufferStats::operator=(
    170     TraceStats::BufferStats&&) = default;
    171 
    172 #pragma GCC diagnostic push
    173 #pragma GCC diagnostic ignored "-Wfloat-equal"
    174 bool TraceStats::BufferStats::operator==(
    175     const TraceStats::BufferStats& other) const {
    176   return (buffer_size_ == other.buffer_size_) &&
    177          (bytes_written_ == other.bytes_written_) &&
    178          (bytes_overwritten_ == other.bytes_overwritten_) &&
    179          (bytes_read_ == other.bytes_read_) &&
    180          (padding_bytes_written_ == other.padding_bytes_written_) &&
    181          (padding_bytes_cleared_ == other.padding_bytes_cleared_) &&
    182          (chunks_written_ == other.chunks_written_) &&
    183          (chunks_rewritten_ == other.chunks_rewritten_) &&
    184          (chunks_overwritten_ == other.chunks_overwritten_) &&
    185          (chunks_discarded_ == other.chunks_discarded_) &&
    186          (chunks_read_ == other.chunks_read_) &&
    187          (chunks_committed_out_of_order_ ==
    188           other.chunks_committed_out_of_order_) &&
    189          (write_wrap_count_ == other.write_wrap_count_) &&
    190          (patches_succeeded_ == other.patches_succeeded_) &&
    191          (patches_failed_ == other.patches_failed_) &&
    192          (readaheads_succeeded_ == other.readaheads_succeeded_) &&
    193          (readaheads_failed_ == other.readaheads_failed_) &&
    194          (abi_violations_ == other.abi_violations_);
    195 }
    196 #pragma GCC diagnostic pop
    197 
    198 void TraceStats::BufferStats::FromProto(
    199     const perfetto::protos::TraceStats_BufferStats& proto) {
    200   static_assert(sizeof(buffer_size_) == sizeof(proto.buffer_size()),
    201                 "size mismatch");
    202   buffer_size_ = static_cast<decltype(buffer_size_)>(proto.buffer_size());
    203 
    204   static_assert(sizeof(bytes_written_) == sizeof(proto.bytes_written()),
    205                 "size mismatch");
    206   bytes_written_ = static_cast<decltype(bytes_written_)>(proto.bytes_written());
    207 
    208   static_assert(sizeof(bytes_overwritten_) == sizeof(proto.bytes_overwritten()),
    209                 "size mismatch");
    210   bytes_overwritten_ =
    211       static_cast<decltype(bytes_overwritten_)>(proto.bytes_overwritten());
    212 
    213   static_assert(sizeof(bytes_read_) == sizeof(proto.bytes_read()),
    214                 "size mismatch");
    215   bytes_read_ = static_cast<decltype(bytes_read_)>(proto.bytes_read());
    216 
    217   static_assert(
    218       sizeof(padding_bytes_written_) == sizeof(proto.padding_bytes_written()),
    219       "size mismatch");
    220   padding_bytes_written_ = static_cast<decltype(padding_bytes_written_)>(
    221       proto.padding_bytes_written());
    222 
    223   static_assert(
    224       sizeof(padding_bytes_cleared_) == sizeof(proto.padding_bytes_cleared()),
    225       "size mismatch");
    226   padding_bytes_cleared_ = static_cast<decltype(padding_bytes_cleared_)>(
    227       proto.padding_bytes_cleared());
    228 
    229   static_assert(sizeof(chunks_written_) == sizeof(proto.chunks_written()),
    230                 "size mismatch");
    231   chunks_written_ =
    232       static_cast<decltype(chunks_written_)>(proto.chunks_written());
    233 
    234   static_assert(sizeof(chunks_rewritten_) == sizeof(proto.chunks_rewritten()),
    235                 "size mismatch");
    236   chunks_rewritten_ =
    237       static_cast<decltype(chunks_rewritten_)>(proto.chunks_rewritten());
    238 
    239   static_assert(
    240       sizeof(chunks_overwritten_) == sizeof(proto.chunks_overwritten()),
    241       "size mismatch");
    242   chunks_overwritten_ =
    243       static_cast<decltype(chunks_overwritten_)>(proto.chunks_overwritten());
    244 
    245   static_assert(sizeof(chunks_discarded_) == sizeof(proto.chunks_discarded()),
    246                 "size mismatch");
    247   chunks_discarded_ =
    248       static_cast<decltype(chunks_discarded_)>(proto.chunks_discarded());
    249 
    250   static_assert(sizeof(chunks_read_) == sizeof(proto.chunks_read()),
    251                 "size mismatch");
    252   chunks_read_ = static_cast<decltype(chunks_read_)>(proto.chunks_read());
    253 
    254   static_assert(sizeof(chunks_committed_out_of_order_) ==
    255                     sizeof(proto.chunks_committed_out_of_order()),
    256                 "size mismatch");
    257   chunks_committed_out_of_order_ =
    258       static_cast<decltype(chunks_committed_out_of_order_)>(
    259           proto.chunks_committed_out_of_order());
    260 
    261   static_assert(sizeof(write_wrap_count_) == sizeof(proto.write_wrap_count()),
    262                 "size mismatch");
    263   write_wrap_count_ =
    264       static_cast<decltype(write_wrap_count_)>(proto.write_wrap_count());
    265 
    266   static_assert(sizeof(patches_succeeded_) == sizeof(proto.patches_succeeded()),
    267                 "size mismatch");
    268   patches_succeeded_ =
    269       static_cast<decltype(patches_succeeded_)>(proto.patches_succeeded());
    270 
    271   static_assert(sizeof(patches_failed_) == sizeof(proto.patches_failed()),
    272                 "size mismatch");
    273   patches_failed_ =
    274       static_cast<decltype(patches_failed_)>(proto.patches_failed());
    275 
    276   static_assert(
    277       sizeof(readaheads_succeeded_) == sizeof(proto.readaheads_succeeded()),
    278       "size mismatch");
    279   readaheads_succeeded_ = static_cast<decltype(readaheads_succeeded_)>(
    280       proto.readaheads_succeeded());
    281 
    282   static_assert(sizeof(readaheads_failed_) == sizeof(proto.readaheads_failed()),
    283                 "size mismatch");
    284   readaheads_failed_ =
    285       static_cast<decltype(readaheads_failed_)>(proto.readaheads_failed());
    286 
    287   static_assert(sizeof(abi_violations_) == sizeof(proto.abi_violations()),
    288                 "size mismatch");
    289   abi_violations_ =
    290       static_cast<decltype(abi_violations_)>(proto.abi_violations());
    291   unknown_fields_ = proto.unknown_fields();
    292 }
    293 
    294 void TraceStats::BufferStats::ToProto(
    295     perfetto::protos::TraceStats_BufferStats* proto) const {
    296   proto->Clear();
    297 
    298   static_assert(sizeof(buffer_size_) == sizeof(proto->buffer_size()),
    299                 "size mismatch");
    300   proto->set_buffer_size(
    301       static_cast<decltype(proto->buffer_size())>(buffer_size_));
    302 
    303   static_assert(sizeof(bytes_written_) == sizeof(proto->bytes_written()),
    304                 "size mismatch");
    305   proto->set_bytes_written(
    306       static_cast<decltype(proto->bytes_written())>(bytes_written_));
    307 
    308   static_assert(
    309       sizeof(bytes_overwritten_) == sizeof(proto->bytes_overwritten()),
    310       "size mismatch");
    311   proto->set_bytes_overwritten(
    312       static_cast<decltype(proto->bytes_overwritten())>(bytes_overwritten_));
    313 
    314   static_assert(sizeof(bytes_read_) == sizeof(proto->bytes_read()),
    315                 "size mismatch");
    316   proto->set_bytes_read(
    317       static_cast<decltype(proto->bytes_read())>(bytes_read_));
    318 
    319   static_assert(
    320       sizeof(padding_bytes_written_) == sizeof(proto->padding_bytes_written()),
    321       "size mismatch");
    322   proto->set_padding_bytes_written(
    323       static_cast<decltype(proto->padding_bytes_written())>(
    324           padding_bytes_written_));
    325 
    326   static_assert(
    327       sizeof(padding_bytes_cleared_) == sizeof(proto->padding_bytes_cleared()),
    328       "size mismatch");
    329   proto->set_padding_bytes_cleared(
    330       static_cast<decltype(proto->padding_bytes_cleared())>(
    331           padding_bytes_cleared_));
    332 
    333   static_assert(sizeof(chunks_written_) == sizeof(proto->chunks_written()),
    334                 "size mismatch");
    335   proto->set_chunks_written(
    336       static_cast<decltype(proto->chunks_written())>(chunks_written_));
    337 
    338   static_assert(sizeof(chunks_rewritten_) == sizeof(proto->chunks_rewritten()),
    339                 "size mismatch");
    340   proto->set_chunks_rewritten(
    341       static_cast<decltype(proto->chunks_rewritten())>(chunks_rewritten_));
    342 
    343   static_assert(
    344       sizeof(chunks_overwritten_) == sizeof(proto->chunks_overwritten()),
    345       "size mismatch");
    346   proto->set_chunks_overwritten(
    347       static_cast<decltype(proto->chunks_overwritten())>(chunks_overwritten_));
    348 
    349   static_assert(sizeof(chunks_discarded_) == sizeof(proto->chunks_discarded()),
    350                 "size mismatch");
    351   proto->set_chunks_discarded(
    352       static_cast<decltype(proto->chunks_discarded())>(chunks_discarded_));
    353 
    354   static_assert(sizeof(chunks_read_) == sizeof(proto->chunks_read()),
    355                 "size mismatch");
    356   proto->set_chunks_read(
    357       static_cast<decltype(proto->chunks_read())>(chunks_read_));
    358 
    359   static_assert(sizeof(chunks_committed_out_of_order_) ==
    360                     sizeof(proto->chunks_committed_out_of_order()),
    361                 "size mismatch");
    362   proto->set_chunks_committed_out_of_order(
    363       static_cast<decltype(proto->chunks_committed_out_of_order())>(
    364           chunks_committed_out_of_order_));
    365 
    366   static_assert(sizeof(write_wrap_count_) == sizeof(proto->write_wrap_count()),
    367                 "size mismatch");
    368   proto->set_write_wrap_count(
    369       static_cast<decltype(proto->write_wrap_count())>(write_wrap_count_));
    370 
    371   static_assert(
    372       sizeof(patches_succeeded_) == sizeof(proto->patches_succeeded()),
    373       "size mismatch");
    374   proto->set_patches_succeeded(
    375       static_cast<decltype(proto->patches_succeeded())>(patches_succeeded_));
    376 
    377   static_assert(sizeof(patches_failed_) == sizeof(proto->patches_failed()),
    378                 "size mismatch");
    379   proto->set_patches_failed(
    380       static_cast<decltype(proto->patches_failed())>(patches_failed_));
    381 
    382   static_assert(
    383       sizeof(readaheads_succeeded_) == sizeof(proto->readaheads_succeeded()),
    384       "size mismatch");
    385   proto->set_readaheads_succeeded(
    386       static_cast<decltype(proto->readaheads_succeeded())>(
    387           readaheads_succeeded_));
    388 
    389   static_assert(
    390       sizeof(readaheads_failed_) == sizeof(proto->readaheads_failed()),
    391       "size mismatch");
    392   proto->set_readaheads_failed(
    393       static_cast<decltype(proto->readaheads_failed())>(readaheads_failed_));
    394 
    395   static_assert(sizeof(abi_violations_) == sizeof(proto->abi_violations()),
    396                 "size mismatch");
    397   proto->set_abi_violations(
    398       static_cast<decltype(proto->abi_violations())>(abi_violations_));
    399   *(proto->mutable_unknown_fields()) = unknown_fields_;
    400 }
    401 
    402 }  // namespace perfetto
    403