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/config/data_source_config.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/data_source_config.h"
29 
30 #include "perfetto/config/android/android_log_config.pb.h"
31 #include "perfetto/config/android/packages_list_config.pb.h"
32 #include "perfetto/config/chrome/chrome_config.pb.h"
33 #include "perfetto/config/data_source_config.pb.h"
34 #include "perfetto/config/ftrace/ftrace_config.pb.h"
35 #include "perfetto/config/inode_file/inode_file_config.pb.h"
36 #include "perfetto/config/power/android_power_config.pb.h"
37 #include "perfetto/config/process_stats/process_stats_config.pb.h"
38 #include "perfetto/config/profiling/heapprofd_config.pb.h"
39 #include "perfetto/config/sys_stats/sys_stats_config.pb.h"
40 #include "perfetto/config/test_config.pb.h"
41 
42 namespace perfetto {
43 
44 DataSourceConfig::DataSourceConfig() = default;
45 DataSourceConfig::~DataSourceConfig() = default;
46 DataSourceConfig::DataSourceConfig(const DataSourceConfig&) = default;
47 DataSourceConfig& DataSourceConfig::operator=(const DataSourceConfig&) =
48     default;
49 DataSourceConfig::DataSourceConfig(DataSourceConfig&&) noexcept = default;
50 DataSourceConfig& DataSourceConfig::operator=(DataSourceConfig&&) = default;
51 
52 #pragma GCC diagnostic push
53 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const DataSourceConfig & other) const54 bool DataSourceConfig::operator==(const DataSourceConfig& other) const {
55   return (name_ == other.name_) && (target_buffer_ == other.target_buffer_) &&
56          (trace_duration_ms_ == other.trace_duration_ms_) &&
57          (enable_extra_guardrails_ == other.enable_extra_guardrails_) &&
58          (tracing_session_id_ == other.tracing_session_id_) &&
59          (ftrace_config_ == other.ftrace_config_) &&
60          (chrome_config_ == other.chrome_config_) &&
61          (inode_file_config_ == other.inode_file_config_) &&
62          (process_stats_config_ == other.process_stats_config_) &&
63          (sys_stats_config_ == other.sys_stats_config_) &&
64          (heapprofd_config_ == other.heapprofd_config_) &&
65          (android_power_config_ == other.android_power_config_) &&
66          (android_log_config_ == other.android_log_config_) &&
67          (packages_list_config_ == other.packages_list_config_) &&
68          (legacy_config_ == other.legacy_config_) &&
69          (for_testing_ == other.for_testing_);
70 }
71 #pragma GCC diagnostic pop
72 
FromProto(const perfetto::protos::DataSourceConfig & proto)73 void DataSourceConfig::FromProto(
74     const perfetto::protos::DataSourceConfig& proto) {
75   static_assert(sizeof(name_) == sizeof(proto.name()), "size mismatch");
76   name_ = static_cast<decltype(name_)>(proto.name());
77 
78   static_assert(sizeof(target_buffer_) == sizeof(proto.target_buffer()),
79                 "size mismatch");
80   target_buffer_ = static_cast<decltype(target_buffer_)>(proto.target_buffer());
81 
82   static_assert(sizeof(trace_duration_ms_) == sizeof(proto.trace_duration_ms()),
83                 "size mismatch");
84   trace_duration_ms_ =
85       static_cast<decltype(trace_duration_ms_)>(proto.trace_duration_ms());
86 
87   static_assert(sizeof(enable_extra_guardrails_) ==
88                     sizeof(proto.enable_extra_guardrails()),
89                 "size mismatch");
90   enable_extra_guardrails_ = static_cast<decltype(enable_extra_guardrails_)>(
91       proto.enable_extra_guardrails());
92 
93   static_assert(
94       sizeof(tracing_session_id_) == sizeof(proto.tracing_session_id()),
95       "size mismatch");
96   tracing_session_id_ =
97       static_cast<decltype(tracing_session_id_)>(proto.tracing_session_id());
98 
99   ftrace_config_.FromProto(proto.ftrace_config());
100 
101   chrome_config_.FromProto(proto.chrome_config());
102 
103   inode_file_config_.FromProto(proto.inode_file_config());
104 
105   process_stats_config_.FromProto(proto.process_stats_config());
106 
107   sys_stats_config_.FromProto(proto.sys_stats_config());
108 
109   heapprofd_config_.FromProto(proto.heapprofd_config());
110 
111   android_power_config_.FromProto(proto.android_power_config());
112 
113   android_log_config_.FromProto(proto.android_log_config());
114 
115   packages_list_config_.FromProto(proto.packages_list_config());
116 
117   static_assert(sizeof(legacy_config_) == sizeof(proto.legacy_config()),
118                 "size mismatch");
119   legacy_config_ = static_cast<decltype(legacy_config_)>(proto.legacy_config());
120 
121   for_testing_.FromProto(proto.for_testing());
122   unknown_fields_ = proto.unknown_fields();
123 }
124 
ToProto(perfetto::protos::DataSourceConfig * proto) const125 void DataSourceConfig::ToProto(
126     perfetto::protos::DataSourceConfig* proto) const {
127   proto->Clear();
128 
129   static_assert(sizeof(name_) == sizeof(proto->name()), "size mismatch");
130   proto->set_name(static_cast<decltype(proto->name())>(name_));
131 
132   static_assert(sizeof(target_buffer_) == sizeof(proto->target_buffer()),
133                 "size mismatch");
134   proto->set_target_buffer(
135       static_cast<decltype(proto->target_buffer())>(target_buffer_));
136 
137   static_assert(
138       sizeof(trace_duration_ms_) == sizeof(proto->trace_duration_ms()),
139       "size mismatch");
140   proto->set_trace_duration_ms(
141       static_cast<decltype(proto->trace_duration_ms())>(trace_duration_ms_));
142 
143   static_assert(sizeof(enable_extra_guardrails_) ==
144                     sizeof(proto->enable_extra_guardrails()),
145                 "size mismatch");
146   proto->set_enable_extra_guardrails(
147       static_cast<decltype(proto->enable_extra_guardrails())>(
148           enable_extra_guardrails_));
149 
150   static_assert(
151       sizeof(tracing_session_id_) == sizeof(proto->tracing_session_id()),
152       "size mismatch");
153   proto->set_tracing_session_id(
154       static_cast<decltype(proto->tracing_session_id())>(tracing_session_id_));
155 
156   ftrace_config_.ToProto(proto->mutable_ftrace_config());
157 
158   chrome_config_.ToProto(proto->mutable_chrome_config());
159 
160   inode_file_config_.ToProto(proto->mutable_inode_file_config());
161 
162   process_stats_config_.ToProto(proto->mutable_process_stats_config());
163 
164   sys_stats_config_.ToProto(proto->mutable_sys_stats_config());
165 
166   heapprofd_config_.ToProto(proto->mutable_heapprofd_config());
167 
168   android_power_config_.ToProto(proto->mutable_android_power_config());
169 
170   android_log_config_.ToProto(proto->mutable_android_log_config());
171 
172   packages_list_config_.ToProto(proto->mutable_packages_list_config());
173 
174   static_assert(sizeof(legacy_config_) == sizeof(proto->legacy_config()),
175                 "size mismatch");
176   proto->set_legacy_config(
177       static_cast<decltype(proto->legacy_config())>(legacy_config_));
178 
179   for_testing_.ToProto(proto->mutable_for_testing());
180   *(proto->mutable_unknown_fields()) = unknown_fields_;
181 }
182 
183 }  // namespace perfetto
184