Added proto for ChromeTraceEvents, and a config string to the DataSourceConfig for Chrome tracing as well
Change-Id: Ida4b690887769319323de722114aef9297653a72
diff --git a/Android.bp b/Android.bp
index 28e67f8..4165748 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,6 +20,8 @@
srcs: [
":perfetto_protos_perfetto_config_config_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
+ ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_zero_gen",
":perfetto_protos_perfetto_trace_filesystem_lite_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
":perfetto_protos_perfetto_trace_ftrace_lite_gen",
@@ -58,6 +60,7 @@
"src/traced/probes/probes.cc",
"src/traced/probes/probes_producer.cc",
"src/traced/service/service.cc",
+ "src/tracing/core/chrome_config.cc",
"src/tracing/core/commit_data_request.cc",
"src/tracing/core/data_source_config.cc",
"src/tracing/core/data_source_descriptor.cc",
@@ -84,6 +87,8 @@
generated_headers: [
"perfetto_protos_perfetto_config_config_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
@@ -109,6 +114,8 @@
srcs: [
":perfetto_protos_perfetto_config_config_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
+ ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_zero_gen",
":perfetto_protos_perfetto_trace_filesystem_lite_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
":perfetto_protos_perfetto_trace_ftrace_lite_gen",
@@ -135,6 +142,7 @@
"src/protozero/message_handle.cc",
"src/protozero/proto_utils.cc",
"src/protozero/scattered_stream_writer.cc",
+ "src/tracing/core/chrome_config.cc",
"src/tracing/core/commit_data_request.cc",
"src/tracing/core/data_source_config.cc",
"src/tracing/core/data_source_descriptor.cc",
@@ -166,6 +174,8 @@
generated_headers: [
"perfetto_protos_perfetto_config_config_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
@@ -212,6 +222,8 @@
srcs: [
":perfetto_protos_perfetto_config_config_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
+ ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_zero_gen",
":perfetto_protos_perfetto_trace_filesystem_lite_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
":perfetto_protos_perfetto_trace_ftrace_lite_gen",
@@ -256,6 +268,7 @@
"src/protozero/proto_utils.cc",
"src/protozero/scattered_stream_writer.cc",
"src/traced/probes/probes_producer.cc",
+ "src/tracing/core/chrome_config.cc",
"src/tracing/core/commit_data_request.cc",
"src/tracing/core/data_source_config.cc",
"src/tracing/core/data_source_descriptor.cc",
@@ -288,6 +301,8 @@
generated_headers: [
"perfetto_protos_perfetto_config_config_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
@@ -317,6 +332,7 @@
genrule {
name: "perfetto_protos_perfetto_config_config_gen",
srcs: [
+ "protos/perfetto/config/chrome/chrome_config.proto",
"protos/perfetto/config/data_source_config.proto",
"protos/perfetto/config/data_source_descriptor.proto",
"protos/perfetto/config/ftrace/ftrace_config.proto",
@@ -327,6 +343,7 @@
],
cmd: "mkdir -p $(genDir)/external/perfetto/protos && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto/protos --proto_path=external/perfetto/protos $(in)",
out: [
+ "external/perfetto/protos/perfetto/config/chrome/chrome_config.pb.cc",
"external/perfetto/protos/perfetto/config/data_source_config.pb.cc",
"external/perfetto/protos/perfetto/config/data_source_descriptor.pb.cc",
"external/perfetto/protos/perfetto/config/ftrace/ftrace_config.pb.cc",
@@ -338,6 +355,7 @@
genrule {
name: "perfetto_protos_perfetto_config_config_gen_headers",
srcs: [
+ "protos/perfetto/config/chrome/chrome_config.proto",
"protos/perfetto/config/data_source_config.proto",
"protos/perfetto/config/data_source_descriptor.proto",
"protos/perfetto/config/ftrace/ftrace_config.proto",
@@ -348,6 +366,7 @@
],
cmd: "mkdir -p $(genDir)/external/perfetto/protos && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto/protos --proto_path=external/perfetto/protos $(in)",
out: [
+ "external/perfetto/protos/perfetto/config/chrome/chrome_config.pb.h",
"external/perfetto/protos/perfetto/config/data_source_config.pb.h",
"external/perfetto/protos/perfetto/config/data_source_descriptor.pb.h",
"external/perfetto/protos/perfetto/config/ftrace/ftrace_config.pb.h",
@@ -407,6 +426,74 @@
],
}
+// GN target: //protos/perfetto/trace/chrome:lite_gen
+genrule {
+ name: "perfetto_protos_perfetto_trace_chrome_lite_gen",
+ srcs: [
+ "protos/perfetto/trace/chrome/chrome_trace_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/protos && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto/protos --proto_path=external/perfetto/protos $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_trace_event.pb.cc",
+ ],
+}
+
+// GN target: //protos/perfetto/trace/chrome:lite_gen
+genrule {
+ name: "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/chrome/chrome_trace_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/protos && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto/protos --proto_path=external/perfetto/protos $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_trace_event.pb.h",
+ ],
+ export_include_dirs: [
+ "protos",
+ ],
+}
+
+// GN target: //protos/perfetto/trace/chrome:zero_gen
+genrule {
+ name: "perfetto_protos_perfetto_trace_chrome_zero_gen",
+ srcs: [
+ "protos/perfetto/trace/chrome/chrome_trace_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/protos && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto/protos --proto_path=external/perfetto/protos --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto/protos $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_trace_event.pbzero.cc",
+ ],
+}
+
+// GN target: //protos/perfetto/trace/chrome:zero_gen
+genrule {
+ name: "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/chrome/chrome_trace_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/protos && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto/protos --proto_path=external/perfetto/protos --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto/protos $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_trace_event.pbzero.h",
+ ],
+ export_include_dirs: [
+ "protos",
+ ],
+}
+
// GN target: //protos/perfetto/trace/filesystem:lite_gen
genrule {
name: "perfetto_protos_perfetto_trace_filesystem_lite_gen",
@@ -2837,6 +2924,8 @@
srcs: [
":perfetto_protos_perfetto_config_config_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
+ ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_zero_gen",
":perfetto_protos_perfetto_trace_filesystem_lite_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
":perfetto_protos_perfetto_trace_ftrace_lite_gen",
@@ -2860,6 +2949,7 @@
"src/protozero/message_handle.cc",
"src/protozero/proto_utils.cc",
"src/protozero/scattered_stream_writer.cc",
+ "src/tracing/core/chrome_config.cc",
"src/tracing/core/commit_data_request.cc",
"src/tracing/core/data_source_config.cc",
"src/tracing/core/data_source_descriptor.cc",
@@ -2894,6 +2984,8 @@
generated_headers: [
"perfetto_protos_perfetto_config_config_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
@@ -2907,6 +2999,8 @@
export_generated_headers: [
"perfetto_protos_perfetto_config_config_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
@@ -2932,6 +3026,8 @@
srcs: [
":perfetto_protos_perfetto_config_config_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
+ ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_zero_gen",
":perfetto_protos_perfetto_trace_filesystem_lite_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
":perfetto_protos_perfetto_trace_ftrace_lite_gen",
@@ -3003,6 +3099,7 @@
"src/protozero/scattered_stream_writer_unittest.cc",
"src/protozero/test/fake_scattered_buffer.cc",
"src/protozero/test/protozero_conformance_unittest.cc",
+ "src/tracing/core/chrome_config.cc",
"src/tracing/core/commit_data_request.cc",
"src/tracing/core/data_source_config.cc",
"src/tracing/core/data_source_descriptor.cc",
@@ -3049,6 +3146,8 @@
generated_headers: [
"perfetto_protos_perfetto_config_config_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
diff --git a/include/perfetto/tracing/core/chrome_config.h b/include/perfetto/tracing/core/chrome_config.h
new file mode 100644
index 0000000..7bd825d
--- /dev/null
+++ b/include/perfetto/tracing/core/chrome_config.h
@@ -0,0 +1,70 @@
+/*
+ * 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/chrome/chrome_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
+ */
+
+#ifndef INCLUDE_PERFETTO_TRACING_CORE_CHROME_CONFIG_H_
+#define INCLUDE_PERFETTO_TRACING_CORE_CHROME_CONFIG_H_
+
+#include <stdint.h>
+#include <string>
+#include <type_traits>
+#include <vector>
+
+// Forward declarations for protobuf types.
+namespace perfetto {
+namespace protos {
+class ChromeConfig;
+}
+} // namespace perfetto
+
+namespace perfetto {
+
+class ChromeConfig {
+ public:
+ ChromeConfig();
+ ~ChromeConfig();
+ ChromeConfig(ChromeConfig&&) noexcept;
+ ChromeConfig& operator=(ChromeConfig&&);
+ ChromeConfig(const ChromeConfig&);
+ ChromeConfig& operator=(const ChromeConfig&);
+
+ // Conversion methods from/to the corresponding protobuf types.
+ void FromProto(const perfetto::protos::ChromeConfig&);
+ void ToProto(perfetto::protos::ChromeConfig*) const;
+
+ const std::string& trace_config() const { return trace_config_; }
+ void set_trace_config(const std::string& value) { trace_config_ = value; }
+
+ private:
+ std::string trace_config_ = {};
+
+ // Allows to preserve unknown protobuf fields for compatibility
+ // with future versions of .proto files.
+ std::string unknown_fields_;
+};
+
+} // namespace perfetto
+#endif // INCLUDE_PERFETTO_TRACING_CORE_CHROME_CONFIG_H_
diff --git a/include/perfetto/tracing/core/data_source_config.h b/include/perfetto/tracing/core/data_source_config.h
index 4f1c712..c474761 100644
--- a/include/perfetto/tracing/core/data_source_config.h
+++ b/include/perfetto/tracing/core/data_source_config.h
@@ -33,6 +33,7 @@
#include <type_traits>
#include <vector>
+#include "perfetto/tracing/core/chrome_config.h"
#include "perfetto/tracing/core/ftrace_config.h"
// Forward declarations for protobuf types.
@@ -40,6 +41,7 @@
namespace protos {
class DataSourceConfig;
class FtraceConfig;
+class ChromeConfig;
} // namespace protos
} // namespace perfetto
@@ -70,11 +72,15 @@
const FtraceConfig& ftrace_config() const { return ftrace_config_; }
FtraceConfig* mutable_ftrace_config() { return &ftrace_config_; }
+ const ChromeConfig& chrome_config() const { return chrome_config_; }
+ ChromeConfig* mutable_chrome_config() { return &chrome_config_; }
+
private:
std::string name_ = {};
uint32_t target_buffer_ = {};
uint32_t trace_duration_ms_ = {};
FtraceConfig ftrace_config_ = {};
+ ChromeConfig chrome_config_ = {};
// Allows to preserve unknown protobuf fields for compatibility
// with future versions of .proto files.
diff --git a/include/perfetto/tracing/core/trace_config.h b/include/perfetto/tracing/core/trace_config.h
index bac3218..b1ed165 100644
--- a/include/perfetto/tracing/core/trace_config.h
+++ b/include/perfetto/tracing/core/trace_config.h
@@ -43,6 +43,7 @@
class TraceConfig_DataSource;
class DataSourceConfig;
class FtraceConfig;
+class ChromeConfig;
} // namespace protos
} // namespace perfetto
diff --git a/protos/perfetto/config/BUILD.gn b/protos/perfetto/config/BUILD.gn
index abe1d69..2632f9a 100644
--- a/protos/perfetto/config/BUILD.gn
+++ b/protos/perfetto/config/BUILD.gn
@@ -20,6 +20,7 @@
proto_in_dir = "$perfetto_root_path/protos"
proto_out_dir = "$perfetto_root_path/protos"
sources = [
+ "chrome/chrome_config.proto",
"data_source_config.proto",
"data_source_descriptor.proto",
"ftrace/ftrace_config.proto",
diff --git a/protos/perfetto/config/chrome/chrome_config.proto b/protos/perfetto/config/chrome/chrome_config.proto
new file mode 100644
index 0000000..11634fc
--- /dev/null
+++ b/protos/perfetto/config/chrome/chrome_config.proto
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+syntax = "proto2";
+option optimize_for = LITE_RUNTIME;
+
+package perfetto.protos;
+
+// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
+// to reflect changes in the corresponding C++ headers.
+
+message ChromeConfig {
+ optional string trace_config = 1;
+}
diff --git a/protos/perfetto/config/data_source_config.proto b/protos/perfetto/config/data_source_config.proto
index a46d6fe..ee4f44b 100644
--- a/protos/perfetto/config/data_source_config.proto
+++ b/protos/perfetto/config/data_source_config.proto
@@ -19,6 +19,7 @@
package perfetto.protos;
+import "perfetto/config/chrome/chrome_config.proto";
import "perfetto/config/ftrace/ftrace_config.proto";
// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
@@ -47,4 +48,5 @@
// data-sources and needs to be processed by the traced daemon.
optional FtraceConfig ftrace_config = 100;
+ optional ChromeConfig chrome_config = 101;
}
diff --git a/protos/perfetto/config/perfetto_config.proto b/protos/perfetto/config/perfetto_config.proto
index bf659ba..21da1e0 100644
--- a/protos/perfetto/config/perfetto_config.proto
+++ b/protos/perfetto/config/perfetto_config.proto
@@ -11,8 +11,20 @@
package perfetto.protos;
+// Begin of protos/perfetto/config/chrome/chrome_config.proto
+
+// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
+// to reflect changes in the corresponding C++ headers.
+
+message ChromeConfig {
+ optional string trace_config = 1;
+}
+
+// End of protos/perfetto/config/chrome/chrome_config.proto
+
// Begin of protos/perfetto/config/data_source_config.proto
+
// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
// to reflect changes in the corresponding C++ headers.
@@ -39,6 +51,7 @@
// data-sources and needs to be processed by the traced daemon.
optional FtraceConfig ftrace_config = 100;
+ optional ChromeConfig chrome_config = 101;
}
// End of protos/perfetto/config/data_source_config.proto
diff --git a/protos/perfetto/trace/BUILD.gn b/protos/perfetto/trace/BUILD.gn
index d13c15a..214b67d 100644
--- a/protos/perfetto/trace/BUILD.gn
+++ b/protos/perfetto/trace/BUILD.gn
@@ -26,6 +26,7 @@
# Protozero generated stubs, for writers.
protozero_library("zero") {
deps = [
+ "chrome:zero",
"filesystem:zero",
"ftrace:zero",
"ps:zero",
@@ -41,6 +42,7 @@
generate_python = false
deps = [
"../ipc",
+ "chrome:lite",
"filesystem:lite",
"ftrace:lite",
"ps:lite",
diff --git a/protos/perfetto/trace/chrome/BUILD.gn b/protos/perfetto/trace/chrome/BUILD.gn
new file mode 100644
index 0000000..6cf9a2f
--- /dev/null
+++ b/protos/perfetto/trace/chrome/BUILD.gn
@@ -0,0 +1,32 @@
+# Copyright (C) 2018 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.
+
+import("../../../../gn/perfetto.gni")
+import("../../../../src/protozero/protozero_library.gni")
+
+chrome_proto_names = [ "chrome_trace_event.proto" ]
+
+proto_library("lite") {
+ generate_python = false
+ sources = chrome_proto_names
+ proto_in_dir = "$perfetto_root_path/protos"
+ proto_out_dir = "$perfetto_root_path/protos"
+}
+
+protozero_library("zero") {
+ sources = chrome_proto_names
+ proto_in_dir = "$perfetto_root_path/protos"
+ proto_out_dir = "$perfetto_root_path/protos"
+ generator_plugin_options = "wrapper_namespace=pbzero"
+}
diff --git a/protos/perfetto/trace/chrome/chrome_trace_event.proto b/protos/perfetto/trace/chrome/chrome_trace_event.proto
new file mode 100644
index 0000000..b817a69
--- /dev/null
+++ b/protos/perfetto/trace/chrome/chrome_trace_event.proto
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+syntax = "proto2";
+option optimize_for = LITE_RUNTIME;
+package perfetto.protos;
+
+// TODO(oysteine) : Separate out commonly repeated values into a separate
+// message (primarily |name| and |category_group_name|).
+message ChromeTraceEvent {
+ optional string name = 1;
+ optional int64 timestamp = 2;
+ optional int32 phase = 3;
+ optional int32 thread_id = 4;
+ optional int64 duration = 5;
+ optional int64 thread_duration = 6;
+ optional string scope = 7;
+ optional uint64 id = 8;
+ optional uint32 flags = 9;
+ optional string category_group_name = 10;
+ optional int32 process_id = 11;
+ optional int64 thread_timestamp = 12;
+ optional uint32 bind_id = 13;
+}
+
+message ChromeEventBundle {
+ repeated ChromeTraceEvent trace_events = 1;
+}
diff --git a/protos/perfetto/trace/trace_packet.proto b/protos/perfetto/trace/trace_packet.proto
index 4f29b61..a487c10 100644
--- a/protos/perfetto/trace/trace_packet.proto
+++ b/protos/perfetto/trace/trace_packet.proto
@@ -17,6 +17,7 @@
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
+import "perfetto/trace/chrome/chrome_trace_event.proto";
import "perfetto/trace/ftrace/ftrace_event_bundle.proto";
import "perfetto/trace/ps/process_tree.proto";
import "perfetto/trace/filesystem/inode_file_map.proto";
@@ -31,6 +32,7 @@
FtraceEventBundle ftrace_events = 1;
ProcessTree process_tree = 2;
InodeFileMap inode_file_map = 4;
+ ChromeEventBundle chrome_events = 5;
// This field is only used for testing.
TestEvent for_testing = 536870911; // 2^29 - 1, max field id for protos.
diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn
index 486fb20..62f26d7 100644
--- a/src/tracing/BUILD.gn
+++ b/src/tracing/BUILD.gn
@@ -29,6 +29,7 @@
"../base",
]
sources = [
+ "core/chrome_config.cc",
"core/commit_data_request.cc",
"core/data_source_config.cc",
"core/data_source_descriptor.cc",
diff --git a/src/tracing/core/chrome_config.cc b/src/tracing/core/chrome_config.cc
new file mode 100644
index 0000000..44c3287
--- /dev/null
+++ b/src/tracing/core/chrome_config.cc
@@ -0,0 +1,58 @@
+/*
+ * 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/chrome/chrome_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/chrome_config.h"
+
+#include "perfetto/config/chrome/chrome_config.pb.h"
+
+namespace perfetto {
+
+ChromeConfig::ChromeConfig() = default;
+ChromeConfig::~ChromeConfig() = default;
+ChromeConfig::ChromeConfig(const ChromeConfig&) = default;
+ChromeConfig& ChromeConfig::operator=(const ChromeConfig&) = default;
+ChromeConfig::ChromeConfig(ChromeConfig&&) noexcept = default;
+ChromeConfig& ChromeConfig::operator=(ChromeConfig&&) = default;
+
+void ChromeConfig::FromProto(const perfetto::protos::ChromeConfig& proto) {
+ static_assert(sizeof(trace_config_) == sizeof(proto.trace_config()),
+ "size mismatch");
+ trace_config_ = static_cast<decltype(trace_config_)>(proto.trace_config());
+ unknown_fields_ = proto.unknown_fields();
+}
+
+void ChromeConfig::ToProto(perfetto::protos::ChromeConfig* proto) const {
+ proto->Clear();
+
+ static_assert(sizeof(trace_config_) == sizeof(proto->trace_config()),
+ "size mismatch");
+ proto->set_trace_config(
+ static_cast<decltype(proto->trace_config())>(trace_config_));
+ *(proto->mutable_unknown_fields()) = unknown_fields_;
+}
+
+} // namespace perfetto
diff --git a/src/tracing/core/data_source_config.cc b/src/tracing/core/data_source_config.cc
index 2c86ac9..069443c 100644
--- a/src/tracing/core/data_source_config.cc
+++ b/src/tracing/core/data_source_config.cc
@@ -27,6 +27,7 @@
#include "perfetto/tracing/core/data_source_config.h"
+#include "perfetto/config/chrome/chrome_config.pb.h"
#include "perfetto/config/data_source_config.pb.h"
#include "perfetto/config/ftrace/ftrace_config.pb.h"
@@ -55,6 +56,8 @@
static_cast<decltype(trace_duration_ms_)>(proto.trace_duration_ms());
ftrace_config_.FromProto(proto.ftrace_config());
+
+ chrome_config_.FromProto(proto.chrome_config());
unknown_fields_ = proto.unknown_fields();
}
@@ -77,6 +80,8 @@
static_cast<decltype(proto->trace_duration_ms())>(trace_duration_ms_));
ftrace_config_.ToProto(proto->mutable_ftrace_config());
+
+ chrome_config_.ToProto(proto->mutable_chrome_config());
*(proto->mutable_unknown_fields()) = unknown_fields_;
}
diff --git a/tools/gen_merged_trace_config b/tools/gen_merged_trace_config
index 18ce3bd..dc5d8e5 100755
--- a/tools/gen_merged_trace_config
+++ b/tools/gen_merged_trace_config
@@ -19,6 +19,7 @@
import sys
PROTOS = (
+ 'protos/perfetto/config/chrome/chrome_config.proto',
'protos/perfetto/config/data_source_config.proto',
'protos/perfetto/config/ftrace/ftrace_config.proto',
'protos/perfetto/config/trace_config.proto',
@@ -55,7 +56,7 @@
content = content[len(header):]
if merged_content == '':
merged_content += REPLACEMENT_HEADER.lstrip() % __file__
- content = re.sub(r'\nimport.*?\n', '', content)
+ content = re.sub(r'^import.*?\n', '', content, flags=re.MULTILINE)
content = re.sub(r'TODO\([^)]*\):', 'TODO:', content)
merged_content += '\n// Begin of %s\n' % proto
merged_content += content
diff --git a/tools/gen_tracing_cpp_headers_from_protos.py b/tools/gen_tracing_cpp_headers_from_protos.py
index c12057f..fc250ac 100755
--- a/tools/gen_tracing_cpp_headers_from_protos.py
+++ b/tools/gen_tracing_cpp_headers_from_protos.py
@@ -18,6 +18,7 @@
import sys
PROTOS = (
+ 'perfetto/config/chrome/chrome_config.proto',
'perfetto/config/data_source_config.proto',
'perfetto/config/data_source_descriptor.proto',
'perfetto/config/ftrace/ftrace_config.proto',