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.py
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
FromProto(const perfetto::protos::ProcessStatsConfig & proto)43 void ProcessStatsConfig::FromProto(
44 const perfetto::protos::ProcessStatsConfig& proto) {
45 quirks_.clear();
46 for (const auto& field : proto.quirks()) {
47 quirks_.emplace_back();
48 static_assert(sizeof(quirks_.back()) == sizeof(proto.quirks(0)),
49 "size mismatch");
50 quirks_.back() = static_cast<decltype(quirks_)::value_type>(field);
51 }
52
53 static_assert(sizeof(scan_all_processes_on_start_) ==
54 sizeof(proto.scan_all_processes_on_start()),
55 "size mismatch");
56 scan_all_processes_on_start_ =
57 static_cast<decltype(scan_all_processes_on_start_)>(
58 proto.scan_all_processes_on_start());
59
60 static_assert(
61 sizeof(record_thread_names_) == sizeof(proto.record_thread_names()),
62 "size mismatch");
63 record_thread_names_ =
64 static_cast<decltype(record_thread_names_)>(proto.record_thread_names());
65 unknown_fields_ = proto.unknown_fields();
66 }
67
ToProto(perfetto::protos::ProcessStatsConfig * proto) const68 void ProcessStatsConfig::ToProto(
69 perfetto::protos::ProcessStatsConfig* proto) const {
70 proto->Clear();
71
72 for (const auto& it : quirks_) {
73 proto->add_quirks(static_cast<decltype(proto->quirks(0))>(it));
74 static_assert(sizeof(it) == sizeof(proto->quirks(0)), "size mismatch");
75 }
76
77 static_assert(sizeof(scan_all_processes_on_start_) ==
78 sizeof(proto->scan_all_processes_on_start()),
79 "size mismatch");
80 proto->set_scan_all_processes_on_start(
81 static_cast<decltype(proto->scan_all_processes_on_start())>(
82 scan_all_processes_on_start_));
83
84 static_assert(
85 sizeof(record_thread_names_) == sizeof(proto->record_thread_names()),
86 "size mismatch");
87 proto->set_record_thread_names(
88 static_cast<decltype(proto->record_thread_names())>(
89 record_thread_names_));
90 *(proto->mutable_unknown_fields()) = unknown_fields_;
91 }
92
93 } // namespace perfetto
94