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/process_stats/process_stats_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/process_stats_config.h"
29
30 #include "perfetto/config/process_stats/process_stats_config.pb.h"
31
32 namespace perfetto {
33
34 ProcessStatsConfig::ProcessStatsConfig() = default;
35 ProcessStatsConfig::~ProcessStatsConfig() = default;
36 ProcessStatsConfig::ProcessStatsConfig(const ProcessStatsConfig&) = default;
37 ProcessStatsConfig& ProcessStatsConfig::operator=(const ProcessStatsConfig&) =
38 default;
39 ProcessStatsConfig::ProcessStatsConfig(ProcessStatsConfig&&) noexcept = default;
40 ProcessStatsConfig& ProcessStatsConfig::operator=(ProcessStatsConfig&&) =
41 default;
42
43 #pragma GCC diagnostic push
44 #pragma GCC diagnostic ignored "-Wfloat-equal"
operator ==(const ProcessStatsConfig & other) const45 bool ProcessStatsConfig::operator==(const ProcessStatsConfig& other) const {
46 return (quirks_ == other.quirks_) &&
47 (scan_all_processes_on_start_ == other.scan_all_processes_on_start_) &&
48 (record_thread_names_ == other.record_thread_names_) &&
49 (proc_stats_poll_ms_ == other.proc_stats_poll_ms_) &&
50 (proc_stats_cache_ttl_ms_ == other.proc_stats_cache_ttl_ms_);
51 }
52 #pragma GCC diagnostic pop
53
FromProto(const perfetto::protos::ProcessStatsConfig & proto)54 void ProcessStatsConfig::FromProto(
55 const perfetto::protos::ProcessStatsConfig& proto) {
56 quirks_.clear();
57 for (const auto& field : proto.quirks()) {
58 quirks_.emplace_back();
59 static_assert(sizeof(quirks_.back()) == sizeof(proto.quirks(0)),
60 "size mismatch");
61 quirks_.back() = static_cast<decltype(quirks_)::value_type>(field);
62 }
63
64 static_assert(sizeof(scan_all_processes_on_start_) ==
65 sizeof(proto.scan_all_processes_on_start()),
66 "size mismatch");
67 scan_all_processes_on_start_ =
68 static_cast<decltype(scan_all_processes_on_start_)>(
69 proto.scan_all_processes_on_start());
70
71 static_assert(
72 sizeof(record_thread_names_) == sizeof(proto.record_thread_names()),
73 "size mismatch");
74 record_thread_names_ =
75 static_cast<decltype(record_thread_names_)>(proto.record_thread_names());
76
77 static_assert(
78 sizeof(proc_stats_poll_ms_) == sizeof(proto.proc_stats_poll_ms()),
79 "size mismatch");
80 proc_stats_poll_ms_ =
81 static_cast<decltype(proc_stats_poll_ms_)>(proto.proc_stats_poll_ms());
82
83 static_assert(sizeof(proc_stats_cache_ttl_ms_) ==
84 sizeof(proto.proc_stats_cache_ttl_ms()),
85 "size mismatch");
86 proc_stats_cache_ttl_ms_ = static_cast<decltype(proc_stats_cache_ttl_ms_)>(
87 proto.proc_stats_cache_ttl_ms());
88 unknown_fields_ = proto.unknown_fields();
89 }
90
ToProto(perfetto::protos::ProcessStatsConfig * proto) const91 void ProcessStatsConfig::ToProto(
92 perfetto::protos::ProcessStatsConfig* proto) const {
93 proto->Clear();
94
95 for (const auto& it : quirks_) {
96 proto->add_quirks(static_cast<decltype(proto->quirks(0))>(it));
97 static_assert(sizeof(it) == sizeof(proto->quirks(0)), "size mismatch");
98 }
99
100 static_assert(sizeof(scan_all_processes_on_start_) ==
101 sizeof(proto->scan_all_processes_on_start()),
102 "size mismatch");
103 proto->set_scan_all_processes_on_start(
104 static_cast<decltype(proto->scan_all_processes_on_start())>(
105 scan_all_processes_on_start_));
106
107 static_assert(
108 sizeof(record_thread_names_) == sizeof(proto->record_thread_names()),
109 "size mismatch");
110 proto->set_record_thread_names(
111 static_cast<decltype(proto->record_thread_names())>(
112 record_thread_names_));
113
114 static_assert(
115 sizeof(proc_stats_poll_ms_) == sizeof(proto->proc_stats_poll_ms()),
116 "size mismatch");
117 proto->set_proc_stats_poll_ms(
118 static_cast<decltype(proto->proc_stats_poll_ms())>(proc_stats_poll_ms_));
119
120 static_assert(sizeof(proc_stats_cache_ttl_ms_) ==
121 sizeof(proto->proc_stats_cache_ttl_ms()),
122 "size mismatch");
123 proto->set_proc_stats_cache_ttl_ms(
124 static_cast<decltype(proto->proc_stats_cache_ttl_ms())>(
125 proc_stats_cache_ttl_ms_));
126 *(proto->mutable_unknown_fields()) = unknown_fields_;
127 }
128
129 } // namespace perfetto
130