perfetto: refactor testing code to make benchmarks easier to write

Bug: 74380167
Change-Id: Idfb37433e610dd4871127fb5fe01fe6ca6ea28a1
diff --git a/src/tracing/core/test_config.cc b/src/tracing/core/test_config.cc
new file mode 100644
index 0000000..c20f8f5
--- /dev/null
+++ b/src/tracing/core/test_config.cc
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*******************************************************************************
+ * AUTOGENERATED - DO NOT EDIT
+ *******************************************************************************
+ * This file has been generated from the protobuf message
+ * perfetto/config/test_config.proto
+ * by
+ * ../../tools/proto_to_cpp/proto_to_cpp.cc.
+ * If you need to make changes here, change the .proto file and then run
+ * ./tools/gen_tracing_cpp_headers_from_protos.py
+ */
+
+#include "perfetto/tracing/core/test_config.h"
+
+#include "perfetto/config/test_config.pb.h"
+
+namespace perfetto {
+
+TestConfig::TestConfig() = default;
+TestConfig::~TestConfig() = default;
+TestConfig::TestConfig(const TestConfig&) = default;
+TestConfig& TestConfig::operator=(const TestConfig&) = default;
+TestConfig::TestConfig(TestConfig&&) noexcept = default;
+TestConfig& TestConfig::operator=(TestConfig&&) = default;
+
+void TestConfig::FromProto(const perfetto::protos::TestConfig& proto) {
+  static_assert(sizeof(message_count_) == sizeof(proto.message_count()),
+                "size mismatch");
+  message_count_ = static_cast<decltype(message_count_)>(proto.message_count());
+
+  static_assert(sizeof(seed_) == sizeof(proto.seed()), "size mismatch");
+  seed_ = static_cast<decltype(seed_)>(proto.seed());
+  unknown_fields_ = proto.unknown_fields();
+}
+
+void TestConfig::ToProto(perfetto::protos::TestConfig* proto) const {
+  proto->Clear();
+
+  static_assert(sizeof(message_count_) == sizeof(proto->message_count()),
+                "size mismatch");
+  proto->set_message_count(
+      static_cast<decltype(proto->message_count())>(message_count_));
+
+  static_assert(sizeof(seed_) == sizeof(proto->seed()), "size mismatch");
+  proto->set_seed(static_cast<decltype(proto->seed())>(seed_));
+  *(proto->mutable_unknown_fields()) = unknown_fields_;
+}
+
+}  // namespace perfetto