Remove proto-lite dependencies from test targets
After this CL, all the relevant dependencies on code generated
by libprotobuf (either full or lite) are gone.
The only deps left at this point are the protozero conformance
tests that check that libprotozero is interoperable with the
official libprotobuf.
Bug: 132880619
Change-Id: I257df0a642bbc387eabd9e7e7264b217e802fe62
diff --git a/Android.bp b/Android.bp
index 27da003..383c689 100644
--- a/Android.bp
+++ b/Android.bp
@@ -83,7 +83,6 @@
":perfetto_protos_perfetto_config_process_stats_cpp_gen",
":perfetto_protos_perfetto_config_process_stats_zero_gen",
":perfetto_protos_perfetto_config_profiling_cpp_gen",
- ":perfetto_protos_perfetto_config_profiling_lite_gen",
":perfetto_protos_perfetto_config_profiling_zero_gen",
":perfetto_protos_perfetto_config_sys_stats_cpp_gen",
":perfetto_protos_perfetto_config_sys_stats_zero_gen",
@@ -123,7 +122,6 @@
"libbase",
"liblog",
"libprocinfo",
- "libprotobuf-cpp-lite",
"libunwindstack",
],
init_rc: [
@@ -146,7 +144,6 @@
"perfetto_protos_perfetto_config_process_stats_cpp_gen_headers",
"perfetto_protos_perfetto_config_process_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_profiling_cpp_gen_headers",
- "perfetto_protos_perfetto_config_profiling_lite_gen_headers",
"perfetto_protos_perfetto_config_profiling_zero_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_cpp_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_zero_gen_headers",
@@ -702,65 +699,55 @@
":perfetto_include_perfetto_tracing_core_forward_decls",
":perfetto_include_perfetto_tracing_tracing",
":perfetto_protos_perfetto_common_cpp_gen",
- ":perfetto_protos_perfetto_common_lite_gen",
":perfetto_protos_perfetto_common_zero_gen",
":perfetto_protos_perfetto_config_android_cpp_gen",
- ":perfetto_protos_perfetto_config_android_lite_gen",
":perfetto_protos_perfetto_config_android_zero_gen",
":perfetto_protos_perfetto_config_cpp_gen",
":perfetto_protos_perfetto_config_ftrace_cpp_gen",
- ":perfetto_protos_perfetto_config_ftrace_lite_gen",
":perfetto_protos_perfetto_config_ftrace_zero_gen",
":perfetto_protos_perfetto_config_gpu_cpp_gen",
- ":perfetto_protos_perfetto_config_gpu_lite_gen",
":perfetto_protos_perfetto_config_gpu_zero_gen",
":perfetto_protos_perfetto_config_inode_file_cpp_gen",
- ":perfetto_protos_perfetto_config_inode_file_lite_gen",
":perfetto_protos_perfetto_config_inode_file_zero_gen",
- ":perfetto_protos_perfetto_config_lite_gen",
":perfetto_protos_perfetto_config_power_cpp_gen",
- ":perfetto_protos_perfetto_config_power_lite_gen",
":perfetto_protos_perfetto_config_power_zero_gen",
":perfetto_protos_perfetto_config_process_stats_cpp_gen",
- ":perfetto_protos_perfetto_config_process_stats_lite_gen",
":perfetto_protos_perfetto_config_process_stats_zero_gen",
":perfetto_protos_perfetto_config_profiling_cpp_gen",
- ":perfetto_protos_perfetto_config_profiling_lite_gen",
":perfetto_protos_perfetto_config_profiling_zero_gen",
":perfetto_protos_perfetto_config_sys_stats_cpp_gen",
- ":perfetto_protos_perfetto_config_sys_stats_lite_gen",
":perfetto_protos_perfetto_config_sys_stats_zero_gen",
":perfetto_protos_perfetto_config_zero_gen",
":perfetto_protos_perfetto_ipc_cpp_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
":perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen",
- ":perfetto_protos_perfetto_trace_android_lite_gen",
+ ":perfetto_protos_perfetto_trace_android_cpp_gen",
":perfetto_protos_perfetto_trace_android_zero_gen",
- ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_cpp_gen",
":perfetto_protos_perfetto_trace_chrome_zero_gen",
- ":perfetto_protos_perfetto_trace_filesystem_lite_gen",
+ ":perfetto_protos_perfetto_trace_filesystem_cpp_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
- ":perfetto_protos_perfetto_trace_ftrace_lite_gen",
+ ":perfetto_protos_perfetto_trace_ftrace_cpp_gen",
":perfetto_protos_perfetto_trace_ftrace_zero_gen",
- ":perfetto_protos_perfetto_trace_gpu_lite_gen",
+ ":perfetto_protos_perfetto_trace_gpu_cpp_gen",
":perfetto_protos_perfetto_trace_gpu_zero_gen",
- ":perfetto_protos_perfetto_trace_interned_data_lite_gen",
+ ":perfetto_protos_perfetto_trace_interned_data_cpp_gen",
":perfetto_protos_perfetto_trace_interned_data_zero_gen",
- ":perfetto_protos_perfetto_trace_minimal_lite_gen",
+ ":perfetto_protos_perfetto_trace_minimal_cpp_gen",
":perfetto_protos_perfetto_trace_minimal_zero_gen",
- ":perfetto_protos_perfetto_trace_non_minimal_lite_gen",
+ ":perfetto_protos_perfetto_trace_non_minimal_cpp_gen",
":perfetto_protos_perfetto_trace_non_minimal_zero_gen",
- ":perfetto_protos_perfetto_trace_perfetto_lite_gen",
+ ":perfetto_protos_perfetto_trace_perfetto_cpp_gen",
":perfetto_protos_perfetto_trace_perfetto_zero_gen",
- ":perfetto_protos_perfetto_trace_power_lite_gen",
+ ":perfetto_protos_perfetto_trace_power_cpp_gen",
":perfetto_protos_perfetto_trace_power_zero_gen",
- ":perfetto_protos_perfetto_trace_profiling_lite_gen",
+ ":perfetto_protos_perfetto_trace_profiling_cpp_gen",
":perfetto_protos_perfetto_trace_profiling_zero_gen",
- ":perfetto_protos_perfetto_trace_ps_lite_gen",
+ ":perfetto_protos_perfetto_trace_ps_cpp_gen",
":perfetto_protos_perfetto_trace_ps_zero_gen",
- ":perfetto_protos_perfetto_trace_sys_stats_lite_gen",
+ ":perfetto_protos_perfetto_trace_sys_stats_cpp_gen",
":perfetto_protos_perfetto_trace_sys_stats_zero_gen",
- ":perfetto_protos_perfetto_trace_track_event_lite_gen",
+ ":perfetto_protos_perfetto_trace_track_event_cpp_gen",
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_android_internal_headers",
":perfetto_src_android_internal_lazy_library_loader",
@@ -793,9 +780,6 @@
"test/cts/heapprofd_test_cts.cc",
"test/cts/utils.cc",
],
- shared_libs: [
- "libprotobuf-cpp-lite",
- ],
static_libs: [
"libgmock",
"libgtest",
@@ -807,128 +791,108 @@
],
generated_headers: [
"perfetto_protos_perfetto_common_cpp_gen_headers",
- "perfetto_protos_perfetto_common_lite_gen_headers",
"perfetto_protos_perfetto_common_zero_gen_headers",
"perfetto_protos_perfetto_config_android_cpp_gen_headers",
- "perfetto_protos_perfetto_config_android_lite_gen_headers",
"perfetto_protos_perfetto_config_android_zero_gen_headers",
"perfetto_protos_perfetto_config_cpp_gen_headers",
"perfetto_protos_perfetto_config_ftrace_cpp_gen_headers",
- "perfetto_protos_perfetto_config_ftrace_lite_gen_headers",
"perfetto_protos_perfetto_config_ftrace_zero_gen_headers",
"perfetto_protos_perfetto_config_gpu_cpp_gen_headers",
- "perfetto_protos_perfetto_config_gpu_lite_gen_headers",
"perfetto_protos_perfetto_config_gpu_zero_gen_headers",
"perfetto_protos_perfetto_config_inode_file_cpp_gen_headers",
- "perfetto_protos_perfetto_config_inode_file_lite_gen_headers",
"perfetto_protos_perfetto_config_inode_file_zero_gen_headers",
- "perfetto_protos_perfetto_config_lite_gen_headers",
"perfetto_protos_perfetto_config_power_cpp_gen_headers",
- "perfetto_protos_perfetto_config_power_lite_gen_headers",
"perfetto_protos_perfetto_config_power_zero_gen_headers",
"perfetto_protos_perfetto_config_process_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_process_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_process_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_profiling_cpp_gen_headers",
- "perfetto_protos_perfetto_config_profiling_lite_gen_headers",
"perfetto_protos_perfetto_config_profiling_zero_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_sys_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_zero_gen_headers",
"perfetto_protos_perfetto_ipc_cpp_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
"perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen_headers",
- "perfetto_protos_perfetto_trace_android_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_android_cpp_gen_headers",
"perfetto_protos_perfetto_trace_android_zero_gen_headers",
- "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_cpp_gen_headers",
"perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
- "perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_filesystem_cpp_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ftrace_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_zero_gen_headers",
- "perfetto_protos_perfetto_trace_gpu_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_gpu_cpp_gen_headers",
"perfetto_protos_perfetto_trace_gpu_zero_gen_headers",
- "perfetto_protos_perfetto_trace_interned_data_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_interned_data_cpp_gen_headers",
"perfetto_protos_perfetto_trace_interned_data_zero_gen_headers",
- "perfetto_protos_perfetto_trace_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_non_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_non_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_non_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_perfetto_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_perfetto_cpp_gen_headers",
"perfetto_protos_perfetto_trace_perfetto_zero_gen_headers",
- "perfetto_protos_perfetto_trace_power_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_power_cpp_gen_headers",
"perfetto_protos_perfetto_trace_power_zero_gen_headers",
- "perfetto_protos_perfetto_trace_profiling_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
"perfetto_protos_perfetto_trace_profiling_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ps_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ps_zero_gen_headers",
- "perfetto_protos_perfetto_trace_sys_stats_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_sys_stats_cpp_gen_headers",
"perfetto_protos_perfetto_trace_sys_stats_zero_gen_headers",
- "perfetto_protos_perfetto_trace_track_event_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
"perfetto_protos_perfetto_trace_track_event_zero_gen_headers",
],
export_generated_headers: [
"perfetto_protos_perfetto_common_cpp_gen_headers",
- "perfetto_protos_perfetto_common_lite_gen_headers",
"perfetto_protos_perfetto_common_zero_gen_headers",
"perfetto_protos_perfetto_config_android_cpp_gen_headers",
- "perfetto_protos_perfetto_config_android_lite_gen_headers",
"perfetto_protos_perfetto_config_android_zero_gen_headers",
"perfetto_protos_perfetto_config_cpp_gen_headers",
"perfetto_protos_perfetto_config_ftrace_cpp_gen_headers",
- "perfetto_protos_perfetto_config_ftrace_lite_gen_headers",
"perfetto_protos_perfetto_config_ftrace_zero_gen_headers",
"perfetto_protos_perfetto_config_gpu_cpp_gen_headers",
- "perfetto_protos_perfetto_config_gpu_lite_gen_headers",
"perfetto_protos_perfetto_config_gpu_zero_gen_headers",
"perfetto_protos_perfetto_config_inode_file_cpp_gen_headers",
- "perfetto_protos_perfetto_config_inode_file_lite_gen_headers",
"perfetto_protos_perfetto_config_inode_file_zero_gen_headers",
- "perfetto_protos_perfetto_config_lite_gen_headers",
"perfetto_protos_perfetto_config_power_cpp_gen_headers",
- "perfetto_protos_perfetto_config_power_lite_gen_headers",
"perfetto_protos_perfetto_config_power_zero_gen_headers",
"perfetto_protos_perfetto_config_process_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_process_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_process_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_profiling_cpp_gen_headers",
- "perfetto_protos_perfetto_config_profiling_lite_gen_headers",
"perfetto_protos_perfetto_config_profiling_zero_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_sys_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_zero_gen_headers",
"perfetto_protos_perfetto_ipc_cpp_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
"perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen_headers",
- "perfetto_protos_perfetto_trace_android_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_android_cpp_gen_headers",
"perfetto_protos_perfetto_trace_android_zero_gen_headers",
- "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_cpp_gen_headers",
"perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
- "perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_filesystem_cpp_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ftrace_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_zero_gen_headers",
- "perfetto_protos_perfetto_trace_gpu_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_gpu_cpp_gen_headers",
"perfetto_protos_perfetto_trace_gpu_zero_gen_headers",
- "perfetto_protos_perfetto_trace_interned_data_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_interned_data_cpp_gen_headers",
"perfetto_protos_perfetto_trace_interned_data_zero_gen_headers",
- "perfetto_protos_perfetto_trace_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_non_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_non_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_non_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_perfetto_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_perfetto_cpp_gen_headers",
"perfetto_protos_perfetto_trace_perfetto_zero_gen_headers",
- "perfetto_protos_perfetto_trace_power_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_power_cpp_gen_headers",
"perfetto_protos_perfetto_trace_power_zero_gen_headers",
- "perfetto_protos_perfetto_trace_profiling_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
"perfetto_protos_perfetto_trace_profiling_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ps_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ps_zero_gen_headers",
- "perfetto_protos_perfetto_trace_sys_stats_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_sys_stats_cpp_gen_headers",
"perfetto_protos_perfetto_trace_sys_stats_zero_gen_headers",
- "perfetto_protos_perfetto_trace_track_event_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
"perfetto_protos_perfetto_trace_track_event_zero_gen_headers",
],
defaults: [
@@ -1077,65 +1041,55 @@
":perfetto_include_perfetto_tracing_core_forward_decls",
":perfetto_include_perfetto_tracing_tracing",
":perfetto_protos_perfetto_common_cpp_gen",
- ":perfetto_protos_perfetto_common_lite_gen",
":perfetto_protos_perfetto_common_zero_gen",
":perfetto_protos_perfetto_config_android_cpp_gen",
- ":perfetto_protos_perfetto_config_android_lite_gen",
":perfetto_protos_perfetto_config_android_zero_gen",
":perfetto_protos_perfetto_config_cpp_gen",
":perfetto_protos_perfetto_config_ftrace_cpp_gen",
- ":perfetto_protos_perfetto_config_ftrace_lite_gen",
":perfetto_protos_perfetto_config_ftrace_zero_gen",
":perfetto_protos_perfetto_config_gpu_cpp_gen",
- ":perfetto_protos_perfetto_config_gpu_lite_gen",
":perfetto_protos_perfetto_config_gpu_zero_gen",
":perfetto_protos_perfetto_config_inode_file_cpp_gen",
- ":perfetto_protos_perfetto_config_inode_file_lite_gen",
":perfetto_protos_perfetto_config_inode_file_zero_gen",
- ":perfetto_protos_perfetto_config_lite_gen",
":perfetto_protos_perfetto_config_power_cpp_gen",
- ":perfetto_protos_perfetto_config_power_lite_gen",
":perfetto_protos_perfetto_config_power_zero_gen",
":perfetto_protos_perfetto_config_process_stats_cpp_gen",
- ":perfetto_protos_perfetto_config_process_stats_lite_gen",
":perfetto_protos_perfetto_config_process_stats_zero_gen",
":perfetto_protos_perfetto_config_profiling_cpp_gen",
- ":perfetto_protos_perfetto_config_profiling_lite_gen",
":perfetto_protos_perfetto_config_profiling_zero_gen",
":perfetto_protos_perfetto_config_sys_stats_cpp_gen",
- ":perfetto_protos_perfetto_config_sys_stats_lite_gen",
":perfetto_protos_perfetto_config_sys_stats_zero_gen",
":perfetto_protos_perfetto_config_zero_gen",
":perfetto_protos_perfetto_ipc_cpp_gen",
":perfetto_protos_perfetto_ipc_ipc_gen",
":perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen",
- ":perfetto_protos_perfetto_trace_android_lite_gen",
+ ":perfetto_protos_perfetto_trace_android_cpp_gen",
":perfetto_protos_perfetto_trace_android_zero_gen",
- ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_cpp_gen",
":perfetto_protos_perfetto_trace_chrome_zero_gen",
- ":perfetto_protos_perfetto_trace_filesystem_lite_gen",
+ ":perfetto_protos_perfetto_trace_filesystem_cpp_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
- ":perfetto_protos_perfetto_trace_ftrace_lite_gen",
+ ":perfetto_protos_perfetto_trace_ftrace_cpp_gen",
":perfetto_protos_perfetto_trace_ftrace_zero_gen",
- ":perfetto_protos_perfetto_trace_gpu_lite_gen",
+ ":perfetto_protos_perfetto_trace_gpu_cpp_gen",
":perfetto_protos_perfetto_trace_gpu_zero_gen",
- ":perfetto_protos_perfetto_trace_interned_data_lite_gen",
+ ":perfetto_protos_perfetto_trace_interned_data_cpp_gen",
":perfetto_protos_perfetto_trace_interned_data_zero_gen",
- ":perfetto_protos_perfetto_trace_minimal_lite_gen",
+ ":perfetto_protos_perfetto_trace_minimal_cpp_gen",
":perfetto_protos_perfetto_trace_minimal_zero_gen",
- ":perfetto_protos_perfetto_trace_non_minimal_lite_gen",
+ ":perfetto_protos_perfetto_trace_non_minimal_cpp_gen",
":perfetto_protos_perfetto_trace_non_minimal_zero_gen",
- ":perfetto_protos_perfetto_trace_perfetto_lite_gen",
+ ":perfetto_protos_perfetto_trace_perfetto_cpp_gen",
":perfetto_protos_perfetto_trace_perfetto_zero_gen",
- ":perfetto_protos_perfetto_trace_power_lite_gen",
+ ":perfetto_protos_perfetto_trace_power_cpp_gen",
":perfetto_protos_perfetto_trace_power_zero_gen",
- ":perfetto_protos_perfetto_trace_profiling_lite_gen",
+ ":perfetto_protos_perfetto_trace_profiling_cpp_gen",
":perfetto_protos_perfetto_trace_profiling_zero_gen",
- ":perfetto_protos_perfetto_trace_ps_lite_gen",
+ ":perfetto_protos_perfetto_trace_ps_cpp_gen",
":perfetto_protos_perfetto_trace_ps_zero_gen",
- ":perfetto_protos_perfetto_trace_sys_stats_lite_gen",
+ ":perfetto_protos_perfetto_trace_sys_stats_cpp_gen",
":perfetto_protos_perfetto_trace_sys_stats_zero_gen",
- ":perfetto_protos_perfetto_trace_track_event_lite_gen",
+ ":perfetto_protos_perfetto_trace_track_event_cpp_gen",
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_android_internal_headers",
":perfetto_src_android_internal_lazy_library_loader",
@@ -1181,7 +1135,6 @@
"libbase",
"liblog",
"libprocinfo",
- "libprotobuf-cpp-lite",
"libunwindstack",
],
static_libs: [
@@ -1191,65 +1144,55 @@
],
generated_headers: [
"perfetto_protos_perfetto_common_cpp_gen_headers",
- "perfetto_protos_perfetto_common_lite_gen_headers",
"perfetto_protos_perfetto_common_zero_gen_headers",
"perfetto_protos_perfetto_config_android_cpp_gen_headers",
- "perfetto_protos_perfetto_config_android_lite_gen_headers",
"perfetto_protos_perfetto_config_android_zero_gen_headers",
"perfetto_protos_perfetto_config_cpp_gen_headers",
"perfetto_protos_perfetto_config_ftrace_cpp_gen_headers",
- "perfetto_protos_perfetto_config_ftrace_lite_gen_headers",
"perfetto_protos_perfetto_config_ftrace_zero_gen_headers",
"perfetto_protos_perfetto_config_gpu_cpp_gen_headers",
- "perfetto_protos_perfetto_config_gpu_lite_gen_headers",
"perfetto_protos_perfetto_config_gpu_zero_gen_headers",
"perfetto_protos_perfetto_config_inode_file_cpp_gen_headers",
- "perfetto_protos_perfetto_config_inode_file_lite_gen_headers",
"perfetto_protos_perfetto_config_inode_file_zero_gen_headers",
- "perfetto_protos_perfetto_config_lite_gen_headers",
"perfetto_protos_perfetto_config_power_cpp_gen_headers",
- "perfetto_protos_perfetto_config_power_lite_gen_headers",
"perfetto_protos_perfetto_config_power_zero_gen_headers",
"perfetto_protos_perfetto_config_process_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_process_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_process_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_profiling_cpp_gen_headers",
- "perfetto_protos_perfetto_config_profiling_lite_gen_headers",
"perfetto_protos_perfetto_config_profiling_zero_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_sys_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_zero_gen_headers",
"perfetto_protos_perfetto_ipc_cpp_gen_headers",
"perfetto_protos_perfetto_ipc_ipc_gen_headers",
"perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen_headers",
- "perfetto_protos_perfetto_trace_android_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_android_cpp_gen_headers",
"perfetto_protos_perfetto_trace_android_zero_gen_headers",
- "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_cpp_gen_headers",
"perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
- "perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_filesystem_cpp_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ftrace_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_zero_gen_headers",
- "perfetto_protos_perfetto_trace_gpu_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_gpu_cpp_gen_headers",
"perfetto_protos_perfetto_trace_gpu_zero_gen_headers",
- "perfetto_protos_perfetto_trace_interned_data_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_interned_data_cpp_gen_headers",
"perfetto_protos_perfetto_trace_interned_data_zero_gen_headers",
- "perfetto_protos_perfetto_trace_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_non_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_non_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_non_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_perfetto_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_perfetto_cpp_gen_headers",
"perfetto_protos_perfetto_trace_perfetto_zero_gen_headers",
- "perfetto_protos_perfetto_trace_power_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_power_cpp_gen_headers",
"perfetto_protos_perfetto_trace_power_zero_gen_headers",
- "perfetto_protos_perfetto_trace_profiling_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
"perfetto_protos_perfetto_trace_profiling_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ps_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ps_zero_gen_headers",
- "perfetto_protos_perfetto_trace_sys_stats_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_sys_stats_cpp_gen_headers",
"perfetto_protos_perfetto_trace_sys_stats_zero_gen_headers",
- "perfetto_protos_perfetto_trace_track_event_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
"perfetto_protos_perfetto_trace_track_event_zero_gen_headers",
],
defaults: [
@@ -2753,6 +2696,50 @@
],
}
+// GN: //protos/perfetto/trace/android:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_android_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/android/android_log.proto",
+ "protos/perfetto/trace/android/graphics_frame_event.proto",
+ "protos/perfetto/trace/android/packages_list.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/android/android_log.gen.cc",
+ "external/perfetto/protos/perfetto/trace/android/graphics_frame_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/android/packages_list.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/android:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_android_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/android/android_log.proto",
+ "protos/perfetto/trace/android/graphics_frame_event.proto",
+ "protos/perfetto/trace/android/packages_list.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/android/android_log.gen.h",
+ "external/perfetto/protos/perfetto/trace/android/graphics_frame_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/android/packages_list.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/android:lite
genrule {
name: "perfetto_protos_perfetto_trace_android_lite_gen",
@@ -2839,6 +2826,50 @@
],
}
+// GN: //protos/perfetto/trace/chrome:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_chrome_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/chrome/chrome_benchmark_metadata.proto",
+ "protos/perfetto/trace/chrome/chrome_metadata.proto",
+ "protos/perfetto/trace/chrome/chrome_trace_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_benchmark_metadata.gen.cc",
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_metadata.gen.cc",
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_trace_event.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/chrome:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_chrome_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/chrome/chrome_benchmark_metadata.proto",
+ "protos/perfetto/trace/chrome/chrome_metadata.proto",
+ "protos/perfetto/trace/chrome/chrome_trace_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_benchmark_metadata.gen.h",
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_metadata.gen.h",
+ "external/perfetto/protos/perfetto/trace/chrome/chrome_trace_event.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/chrome:lite
genrule {
name: "perfetto_protos_perfetto_trace_chrome_lite_gen",
@@ -2925,6 +2956,42 @@
],
}
+// GN: //protos/perfetto/trace/filesystem:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_filesystem_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/filesystem/inode_file_map.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/filesystem/inode_file_map.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/filesystem:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_filesystem_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/filesystem/inode_file_map.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/filesystem/inode_file_map.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/filesystem:lite
genrule {
name: "perfetto_protos_perfetto_trace_filesystem_lite_gen",
@@ -2995,6 +3062,174 @@
],
}
+// GN: //protos/perfetto/trace/ftrace:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_ftrace_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/ftrace/binder.proto",
+ "protos/perfetto/trace/ftrace/block.proto",
+ "protos/perfetto/trace/ftrace/cgroup.proto",
+ "protos/perfetto/trace/ftrace/clk.proto",
+ "protos/perfetto/trace/ftrace/compaction.proto",
+ "protos/perfetto/trace/ftrace/ext4.proto",
+ "protos/perfetto/trace/ftrace/f2fs.proto",
+ "protos/perfetto/trace/ftrace/fence.proto",
+ "protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/ftrace.proto",
+ "protos/perfetto/trace/ftrace/ftrace_event.proto",
+ "protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
+ "protos/perfetto/trace/ftrace/ftrace_stats.proto",
+ "protos/perfetto/trace/ftrace/generic.proto",
+ "protos/perfetto/trace/ftrace/i2c.proto",
+ "protos/perfetto/trace/ftrace/ipi.proto",
+ "protos/perfetto/trace/ftrace/irq.proto",
+ "protos/perfetto/trace/ftrace/kmem.proto",
+ "protos/perfetto/trace/ftrace/lowmemorykiller.proto",
+ "protos/perfetto/trace/ftrace/mdss.proto",
+ "protos/perfetto/trace/ftrace/mm_event.proto",
+ "protos/perfetto/trace/ftrace/oom.proto",
+ "protos/perfetto/trace/ftrace/power.proto",
+ "protos/perfetto/trace/ftrace/raw_syscalls.proto",
+ "protos/perfetto/trace/ftrace/regulator.proto",
+ "protos/perfetto/trace/ftrace/sched.proto",
+ "protos/perfetto/trace/ftrace/sde.proto",
+ "protos/perfetto/trace/ftrace/signal.proto",
+ "protos/perfetto/trace/ftrace/sync.proto",
+ "protos/perfetto/trace/ftrace/systrace.proto",
+ "protos/perfetto/trace/ftrace/task.proto",
+ "protos/perfetto/trace/ftrace/test_bundle_wrapper.proto",
+ "protos/perfetto/trace/ftrace/vmscan.proto",
+ "protos/perfetto/trace/ftrace/workqueue.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/ftrace/binder.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/block.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/cgroup.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/clk.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/compaction.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/ext4.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/f2fs.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/fence.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/filemap.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace_stats.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/generic.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/i2c.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/ipi.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/irq.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/kmem.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/lowmemorykiller.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/mdss.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/mm_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/oom.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/power.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/raw_syscalls.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/regulator.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/sched.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/sde.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/signal.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/sync.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/systrace.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/task.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/test_bundle_wrapper.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/vmscan.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/workqueue.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/ftrace:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_ftrace_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/ftrace/binder.proto",
+ "protos/perfetto/trace/ftrace/block.proto",
+ "protos/perfetto/trace/ftrace/cgroup.proto",
+ "protos/perfetto/trace/ftrace/clk.proto",
+ "protos/perfetto/trace/ftrace/compaction.proto",
+ "protos/perfetto/trace/ftrace/ext4.proto",
+ "protos/perfetto/trace/ftrace/f2fs.proto",
+ "protos/perfetto/trace/ftrace/fence.proto",
+ "protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/ftrace.proto",
+ "protos/perfetto/trace/ftrace/ftrace_event.proto",
+ "protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
+ "protos/perfetto/trace/ftrace/ftrace_stats.proto",
+ "protos/perfetto/trace/ftrace/generic.proto",
+ "protos/perfetto/trace/ftrace/i2c.proto",
+ "protos/perfetto/trace/ftrace/ipi.proto",
+ "protos/perfetto/trace/ftrace/irq.proto",
+ "protos/perfetto/trace/ftrace/kmem.proto",
+ "protos/perfetto/trace/ftrace/lowmemorykiller.proto",
+ "protos/perfetto/trace/ftrace/mdss.proto",
+ "protos/perfetto/trace/ftrace/mm_event.proto",
+ "protos/perfetto/trace/ftrace/oom.proto",
+ "protos/perfetto/trace/ftrace/power.proto",
+ "protos/perfetto/trace/ftrace/raw_syscalls.proto",
+ "protos/perfetto/trace/ftrace/regulator.proto",
+ "protos/perfetto/trace/ftrace/sched.proto",
+ "protos/perfetto/trace/ftrace/sde.proto",
+ "protos/perfetto/trace/ftrace/signal.proto",
+ "protos/perfetto/trace/ftrace/sync.proto",
+ "protos/perfetto/trace/ftrace/systrace.proto",
+ "protos/perfetto/trace/ftrace/task.proto",
+ "protos/perfetto/trace/ftrace/test_bundle_wrapper.proto",
+ "protos/perfetto/trace/ftrace/vmscan.proto",
+ "protos/perfetto/trace/ftrace/workqueue.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/ftrace/binder.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/block.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/cgroup.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/clk.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/compaction.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/ext4.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/f2fs.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/fence.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/filemap.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/ftrace_stats.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/generic.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/i2c.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/ipi.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/irq.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/kmem.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/lowmemorykiller.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/mdss.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/mm_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/oom.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/power.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/raw_syscalls.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/regulator.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/sched.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/sde.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/signal.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/sync.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/systrace.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/task.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/test_bundle_wrapper.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/vmscan.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/workqueue.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/ftrace:lite
genrule {
name: "perfetto_protos_perfetto_trace_ftrace_lite_gen",
@@ -3329,6 +3564,58 @@
],
}
+// GN: //protos/perfetto/trace/gpu:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_gpu_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/gpu/gpu_counter_event.proto",
+ "protos/perfetto/trace/gpu/gpu_log.proto",
+ "protos/perfetto/trace/gpu/gpu_render_stage_event.proto",
+ "protos/perfetto/trace/gpu/vulkan_api_event.proto",
+ "protos/perfetto/trace/gpu/vulkan_memory_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/gpu/gpu_counter_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/gpu/gpu_log.gen.cc",
+ "external/perfetto/protos/perfetto/trace/gpu/gpu_render_stage_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/gpu/vulkan_api_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/gpu/vulkan_memory_event.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/gpu:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_gpu_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/gpu/gpu_counter_event.proto",
+ "protos/perfetto/trace/gpu/gpu_log.proto",
+ "protos/perfetto/trace/gpu/gpu_render_stage_event.proto",
+ "protos/perfetto/trace/gpu/vulkan_api_event.proto",
+ "protos/perfetto/trace/gpu/vulkan_memory_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/gpu/gpu_counter_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/gpu/gpu_log.gen.h",
+ "external/perfetto/protos/perfetto/trace/gpu/gpu_render_stage_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/gpu/vulkan_api_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/gpu/vulkan_memory_event.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/gpu:lite
genrule {
name: "perfetto_protos_perfetto_trace_gpu_lite_gen",
@@ -3431,6 +3718,42 @@
],
}
+// GN: //protos/perfetto/trace/interned_data:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_interned_data_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/interned_data/interned_data.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/interned_data/interned_data.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/interned_data:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_interned_data_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/interned_data/interned_data.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/interned_data/interned_data.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/interned_data:lite
genrule {
name: "perfetto_protos_perfetto_trace_interned_data_lite_gen",
@@ -3501,6 +3824,50 @@
],
}
+// GN: //protos/perfetto/trace:minimal_cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_minimal_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/clock_snapshot.proto",
+ "protos/perfetto/trace/system_info.proto",
+ "protos/perfetto/trace/trigger.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/clock_snapshot.gen.cc",
+ "external/perfetto/protos/perfetto/trace/system_info.gen.cc",
+ "external/perfetto/protos/perfetto/trace/trigger.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace:minimal_cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_minimal_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/clock_snapshot.proto",
+ "protos/perfetto/trace/system_info.proto",
+ "protos/perfetto/trace/trigger.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/clock_snapshot.gen.h",
+ "external/perfetto/protos/perfetto/trace/system_info.gen.h",
+ "external/perfetto/protos/perfetto/trace/trigger.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace:minimal_lite
genrule {
name: "perfetto_protos_perfetto_trace_minimal_lite_gen",
@@ -3587,6 +3954,54 @@
],
}
+// GN: //protos/perfetto/trace:non_minimal_cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_non_minimal_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/test_event.proto",
+ "protos/perfetto/trace/trace.proto",
+ "protos/perfetto/trace/trace_packet.proto",
+ "protos/perfetto/trace/trace_packet_defaults.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/test_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/trace.gen.cc",
+ "external/perfetto/protos/perfetto/trace/trace_packet.gen.cc",
+ "external/perfetto/protos/perfetto/trace/trace_packet_defaults.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace:non_minimal_cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_non_minimal_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/test_event.proto",
+ "protos/perfetto/trace/trace.proto",
+ "protos/perfetto/trace/trace_packet.proto",
+ "protos/perfetto/trace/trace_packet_defaults.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/test_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/trace.gen.h",
+ "external/perfetto/protos/perfetto/trace/trace_packet.gen.h",
+ "external/perfetto/protos/perfetto/trace/trace_packet_defaults.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace:non_minimal_lite
genrule {
name: "perfetto_protos_perfetto_trace_non_minimal_lite_gen",
@@ -3681,6 +4096,42 @@
],
}
+// GN: //protos/perfetto/trace/perfetto:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_perfetto_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/perfetto/perfetto_metatrace.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/perfetto/perfetto_metatrace.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/perfetto:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_perfetto_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/perfetto/perfetto_metatrace.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/perfetto/perfetto_metatrace.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/perfetto:lite
genrule {
name: "perfetto_protos_perfetto_trace_perfetto_lite_gen",
@@ -3751,6 +4202,46 @@
],
}
+// GN: //protos/perfetto/trace/power:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_power_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/power/battery_counters.proto",
+ "protos/perfetto/trace/power/power_rails.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/power/battery_counters.gen.cc",
+ "external/perfetto/protos/perfetto/trace/power/power_rails.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/power:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_power_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/power/battery_counters.proto",
+ "protos/perfetto/trace/power/power_rails.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/power/battery_counters.gen.h",
+ "external/perfetto/protos/perfetto/trace/power/power_rails.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/power:lite
genrule {
name: "perfetto_protos_perfetto_trace_power_lite_gen",
@@ -3865,6 +4356,50 @@
],
}
+// GN: //protos/perfetto/trace/profiling:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_profiling_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/profiling/heap_graph.proto",
+ "protos/perfetto/trace/profiling/profile_common.proto",
+ "protos/perfetto/trace/profiling/profile_packet.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/profiling/heap_graph.gen.cc",
+ "external/perfetto/protos/perfetto/trace/profiling/profile_common.gen.cc",
+ "external/perfetto/protos/perfetto/trace/profiling/profile_packet.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/profiling:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/profiling/heap_graph.proto",
+ "protos/perfetto/trace/profiling/profile_common.proto",
+ "protos/perfetto/trace/profiling/profile_packet.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/profiling/heap_graph.gen.h",
+ "external/perfetto/protos/perfetto/trace/profiling/profile_common.gen.h",
+ "external/perfetto/protos/perfetto/trace/profiling/profile_packet.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/profiling:lite
genrule {
name: "perfetto_protos_perfetto_trace_profiling_lite_gen",
@@ -3951,6 +4486,46 @@
],
}
+// GN: //protos/perfetto/trace/ps:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_ps_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/ps/process_stats.proto",
+ "protos/perfetto/trace/ps/process_tree.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/ps/process_stats.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ps/process_tree.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/ps:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/ps/process_stats.proto",
+ "protos/perfetto/trace/ps/process_tree.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/ps/process_stats.gen.h",
+ "external/perfetto/protos/perfetto/trace/ps/process_tree.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/ps:lite
genrule {
name: "perfetto_protos_perfetto_trace_ps_lite_gen",
@@ -4029,6 +4604,42 @@
],
}
+// GN: //protos/perfetto/trace/sys_stats:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_sys_stats_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/sys_stats/sys_stats.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/sys_stats/sys_stats.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/sys_stats:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_sys_stats_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/sys_stats/sys_stats.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/sys_stats/sys_stats.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/sys_stats:lite
genrule {
name: "perfetto_protos_perfetto_trace_sys_stats_lite_gen",
@@ -4099,6 +4710,90 @@
],
}
+// GN: //protos/perfetto/trace/track_event:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_track_event_cpp_gen",
+ srcs: [
+ "protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.proto",
+ "protos/perfetto/trace/track_event/chrome_histogram_sample.proto",
+ "protos/perfetto/trace/track_event/chrome_keyed_service.proto",
+ "protos/perfetto/trace/track_event/chrome_legacy_ipc.proto",
+ "protos/perfetto/trace/track_event/chrome_user_event.proto",
+ "protos/perfetto/trace/track_event/debug_annotation.proto",
+ "protos/perfetto/trace/track_event/log_message.proto",
+ "protos/perfetto/trace/track_event/process_descriptor.proto",
+ "protos/perfetto/trace/track_event/source_location.proto",
+ "protos/perfetto/trace/track_event/task_execution.proto",
+ "protos/perfetto/trace/track_event/thread_descriptor.proto",
+ "protos/perfetto/trace/track_event/track_descriptor.proto",
+ "protos/perfetto/trace/track_event/track_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_histogram_sample.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_keyed_service.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_legacy_ipc.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_user_event.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/debug_annotation.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/log_message.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/process_descriptor.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/source_location.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/task_execution.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/thread_descriptor.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/track_descriptor.gen.cc",
+ "external/perfetto/protos/perfetto/trace/track_event/track_event.gen.cc",
+ ],
+}
+
+// GN: //protos/perfetto/trace/track_event:cpp
+genrule {
+ name: "perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
+ srcs: [
+ "protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.proto",
+ "protos/perfetto/trace/track_event/chrome_histogram_sample.proto",
+ "protos/perfetto/trace/track_event/chrome_keyed_service.proto",
+ "protos/perfetto/trace/track_event/chrome_legacy_ipc.proto",
+ "protos/perfetto/trace/track_event/chrome_user_event.proto",
+ "protos/perfetto/trace/track_event/debug_annotation.proto",
+ "protos/perfetto/trace/track_event/log_message.proto",
+ "protos/perfetto/trace/track_event/process_descriptor.proto",
+ "protos/perfetto/trace/track_event/source_location.proto",
+ "protos/perfetto/trace/track_event/task_execution.proto",
+ "protos/perfetto/trace/track_event/thread_descriptor.proto",
+ "protos/perfetto/trace/track_event/track_descriptor.proto",
+ "protos/perfetto/trace/track_event/track_event.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_histogram_sample.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_keyed_service.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_legacy_ipc.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/chrome_user_event.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/debug_annotation.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/log_message.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/process_descriptor.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/source_location.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/task_execution.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/thread_descriptor.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/track_descriptor.gen.h",
+ "external/perfetto/protos/perfetto/trace/track_event/track_event.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //protos/perfetto/trace/track_event:lite
genrule {
name: "perfetto_protos_perfetto_trace_track_event_lite_gen",
@@ -5218,6 +5913,42 @@
],
}
+// GN: //src/traced/probes/ftrace:test_messages_cpp
+genrule {
+ name: "perfetto_src_traced_probes_ftrace_test_messages_cpp_gen",
+ srcs: [
+ "src/traced/probes/ftrace/test/test_messages.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/src/traced/probes/ftrace/test/test_messages.gen.cc",
+ ],
+}
+
+// GN: //src/traced/probes/ftrace:test_messages_cpp
+genrule {
+ name: "perfetto_src_traced_probes_ftrace_test_messages_cpp_gen_headers",
+ srcs: [
+ "src/traced/probes/ftrace/test/test_messages.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_cppgen_plugin",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(in)",
+ out: [
+ "external/perfetto/src/traced/probes/ftrace/test/test_messages.gen.h",
+ ],
+ export_include_dirs: [
+ ".",
+ "protos",
+ ],
+}
+
// GN: //src/traced/probes/ftrace:test_messages_lite
genrule {
name: "perfetto_src_traced_probes_ftrace_test_messages_lite_gen",
@@ -5764,33 +6495,23 @@
":perfetto_include_perfetto_tracing_core_forward_decls",
":perfetto_include_perfetto_tracing_tracing",
":perfetto_protos_perfetto_common_cpp_gen",
- ":perfetto_protos_perfetto_common_lite_gen",
":perfetto_protos_perfetto_common_zero_gen",
":perfetto_protos_perfetto_config_android_cpp_gen",
- ":perfetto_protos_perfetto_config_android_lite_gen",
":perfetto_protos_perfetto_config_android_zero_gen",
":perfetto_protos_perfetto_config_cpp_gen",
":perfetto_protos_perfetto_config_ftrace_cpp_gen",
- ":perfetto_protos_perfetto_config_ftrace_lite_gen",
":perfetto_protos_perfetto_config_ftrace_zero_gen",
":perfetto_protos_perfetto_config_gpu_cpp_gen",
- ":perfetto_protos_perfetto_config_gpu_lite_gen",
":perfetto_protos_perfetto_config_gpu_zero_gen",
":perfetto_protos_perfetto_config_inode_file_cpp_gen",
- ":perfetto_protos_perfetto_config_inode_file_lite_gen",
":perfetto_protos_perfetto_config_inode_file_zero_gen",
- ":perfetto_protos_perfetto_config_lite_gen",
":perfetto_protos_perfetto_config_power_cpp_gen",
- ":perfetto_protos_perfetto_config_power_lite_gen",
":perfetto_protos_perfetto_config_power_zero_gen",
":perfetto_protos_perfetto_config_process_stats_cpp_gen",
- ":perfetto_protos_perfetto_config_process_stats_lite_gen",
":perfetto_protos_perfetto_config_process_stats_zero_gen",
":perfetto_protos_perfetto_config_profiling_cpp_gen",
- ":perfetto_protos_perfetto_config_profiling_lite_gen",
":perfetto_protos_perfetto_config_profiling_zero_gen",
":perfetto_protos_perfetto_config_sys_stats_cpp_gen",
- ":perfetto_protos_perfetto_config_sys_stats_lite_gen",
":perfetto_protos_perfetto_config_sys_stats_zero_gen",
":perfetto_protos_perfetto_config_zero_gen",
":perfetto_protos_perfetto_ipc_cpp_gen",
@@ -5798,34 +6519,34 @@
":perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen",
":perfetto_protos_perfetto_metrics_android_zero_gen",
":perfetto_protos_perfetto_metrics_zero_gen",
- ":perfetto_protos_perfetto_trace_android_lite_gen",
+ ":perfetto_protos_perfetto_trace_android_cpp_gen",
":perfetto_protos_perfetto_trace_android_zero_gen",
- ":perfetto_protos_perfetto_trace_chrome_lite_gen",
+ ":perfetto_protos_perfetto_trace_chrome_cpp_gen",
":perfetto_protos_perfetto_trace_chrome_zero_gen",
- ":perfetto_protos_perfetto_trace_filesystem_lite_gen",
+ ":perfetto_protos_perfetto_trace_filesystem_cpp_gen",
":perfetto_protos_perfetto_trace_filesystem_zero_gen",
- ":perfetto_protos_perfetto_trace_ftrace_lite_gen",
+ ":perfetto_protos_perfetto_trace_ftrace_cpp_gen",
":perfetto_protos_perfetto_trace_ftrace_zero_gen",
- ":perfetto_protos_perfetto_trace_gpu_lite_gen",
+ ":perfetto_protos_perfetto_trace_gpu_cpp_gen",
":perfetto_protos_perfetto_trace_gpu_zero_gen",
- ":perfetto_protos_perfetto_trace_interned_data_lite_gen",
+ ":perfetto_protos_perfetto_trace_interned_data_cpp_gen",
":perfetto_protos_perfetto_trace_interned_data_zero_gen",
- ":perfetto_protos_perfetto_trace_minimal_lite_gen",
+ ":perfetto_protos_perfetto_trace_minimal_cpp_gen",
":perfetto_protos_perfetto_trace_minimal_zero_gen",
- ":perfetto_protos_perfetto_trace_non_minimal_lite_gen",
+ ":perfetto_protos_perfetto_trace_non_minimal_cpp_gen",
":perfetto_protos_perfetto_trace_non_minimal_zero_gen",
- ":perfetto_protos_perfetto_trace_perfetto_lite_gen",
+ ":perfetto_protos_perfetto_trace_perfetto_cpp_gen",
":perfetto_protos_perfetto_trace_perfetto_zero_gen",
- ":perfetto_protos_perfetto_trace_power_lite_gen",
+ ":perfetto_protos_perfetto_trace_power_cpp_gen",
":perfetto_protos_perfetto_trace_power_zero_gen",
":perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen",
- ":perfetto_protos_perfetto_trace_profiling_lite_gen",
+ ":perfetto_protos_perfetto_trace_profiling_cpp_gen",
":perfetto_protos_perfetto_trace_profiling_zero_gen",
- ":perfetto_protos_perfetto_trace_ps_lite_gen",
+ ":perfetto_protos_perfetto_trace_ps_cpp_gen",
":perfetto_protos_perfetto_trace_ps_zero_gen",
- ":perfetto_protos_perfetto_trace_sys_stats_lite_gen",
+ ":perfetto_protos_perfetto_trace_sys_stats_cpp_gen",
":perfetto_protos_perfetto_trace_sys_stats_zero_gen",
- ":perfetto_protos_perfetto_trace_track_event_lite_gen",
+ ":perfetto_protos_perfetto_trace_track_event_cpp_gen",
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_android_internal_headers",
":perfetto_src_android_internal_lazy_library_loader",
@@ -5879,6 +6600,7 @@
":perfetto_src_traced_probes_filesystem_unittests",
":perfetto_src_traced_probes_ftrace_format_parser",
":perfetto_src_traced_probes_ftrace_ftrace",
+ ":perfetto_src_traced_probes_ftrace_test_messages_cpp_gen",
":perfetto_src_traced_probes_ftrace_test_messages_lite_gen",
":perfetto_src_traced_probes_ftrace_test_messages_zero_gen",
":perfetto_src_traced_probes_ftrace_test_support",
@@ -5918,33 +6640,23 @@
generated_headers: [
"gen_merged_sql_metrics",
"perfetto_protos_perfetto_common_cpp_gen_headers",
- "perfetto_protos_perfetto_common_lite_gen_headers",
"perfetto_protos_perfetto_common_zero_gen_headers",
"perfetto_protos_perfetto_config_android_cpp_gen_headers",
- "perfetto_protos_perfetto_config_android_lite_gen_headers",
"perfetto_protos_perfetto_config_android_zero_gen_headers",
"perfetto_protos_perfetto_config_cpp_gen_headers",
"perfetto_protos_perfetto_config_ftrace_cpp_gen_headers",
- "perfetto_protos_perfetto_config_ftrace_lite_gen_headers",
"perfetto_protos_perfetto_config_ftrace_zero_gen_headers",
"perfetto_protos_perfetto_config_gpu_cpp_gen_headers",
- "perfetto_protos_perfetto_config_gpu_lite_gen_headers",
"perfetto_protos_perfetto_config_gpu_zero_gen_headers",
"perfetto_protos_perfetto_config_inode_file_cpp_gen_headers",
- "perfetto_protos_perfetto_config_inode_file_lite_gen_headers",
"perfetto_protos_perfetto_config_inode_file_zero_gen_headers",
- "perfetto_protos_perfetto_config_lite_gen_headers",
"perfetto_protos_perfetto_config_power_cpp_gen_headers",
- "perfetto_protos_perfetto_config_power_lite_gen_headers",
"perfetto_protos_perfetto_config_power_zero_gen_headers",
"perfetto_protos_perfetto_config_process_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_process_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_process_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_profiling_cpp_gen_headers",
- "perfetto_protos_perfetto_config_profiling_lite_gen_headers",
"perfetto_protos_perfetto_config_profiling_zero_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_cpp_gen_headers",
- "perfetto_protos_perfetto_config_sys_stats_lite_gen_headers",
"perfetto_protos_perfetto_config_sys_stats_zero_gen_headers",
"perfetto_protos_perfetto_config_zero_gen_headers",
"perfetto_protos_perfetto_ipc_cpp_gen_headers",
@@ -5952,34 +6664,34 @@
"perfetto_protos_perfetto_ipc_wire_protocol_cpp_gen_headers",
"perfetto_protos_perfetto_metrics_android_zero_gen_headers",
"perfetto_protos_perfetto_metrics_zero_gen_headers",
- "perfetto_protos_perfetto_trace_android_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_android_cpp_gen_headers",
"perfetto_protos_perfetto_trace_android_zero_gen_headers",
- "perfetto_protos_perfetto_trace_chrome_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_chrome_cpp_gen_headers",
"perfetto_protos_perfetto_trace_chrome_zero_gen_headers",
- "perfetto_protos_perfetto_trace_filesystem_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_filesystem_cpp_gen_headers",
"perfetto_protos_perfetto_trace_filesystem_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ftrace_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ftrace_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ftrace_zero_gen_headers",
- "perfetto_protos_perfetto_trace_gpu_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_gpu_cpp_gen_headers",
"perfetto_protos_perfetto_trace_gpu_zero_gen_headers",
- "perfetto_protos_perfetto_trace_interned_data_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_interned_data_cpp_gen_headers",
"perfetto_protos_perfetto_trace_interned_data_zero_gen_headers",
- "perfetto_protos_perfetto_trace_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_non_minimal_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_non_minimal_cpp_gen_headers",
"perfetto_protos_perfetto_trace_non_minimal_zero_gen_headers",
- "perfetto_protos_perfetto_trace_perfetto_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_perfetto_cpp_gen_headers",
"perfetto_protos_perfetto_trace_perfetto_zero_gen_headers",
- "perfetto_protos_perfetto_trace_power_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_power_cpp_gen_headers",
"perfetto_protos_perfetto_trace_power_zero_gen_headers",
"perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen_headers",
- "perfetto_protos_perfetto_trace_profiling_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
"perfetto_protos_perfetto_trace_profiling_zero_gen_headers",
- "perfetto_protos_perfetto_trace_ps_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
"perfetto_protos_perfetto_trace_ps_zero_gen_headers",
- "perfetto_protos_perfetto_trace_sys_stats_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_sys_stats_cpp_gen_headers",
"perfetto_protos_perfetto_trace_sys_stats_zero_gen_headers",
- "perfetto_protos_perfetto_trace_track_event_lite_gen_headers",
+ "perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
"perfetto_protos_perfetto_trace_track_event_zero_gen_headers",
"perfetto_src_ipc_test_messages_cpp_gen_headers",
"perfetto_src_ipc_test_messages_ipc_gen_headers",
@@ -5987,6 +6699,7 @@
"perfetto_src_protozero_testing_messages_cpp_gen_headers",
"perfetto_src_protozero_testing_messages_lite_gen_headers",
"perfetto_src_protozero_testing_messages_zero_gen_headers",
+ "perfetto_src_traced_probes_ftrace_test_messages_cpp_gen_headers",
"perfetto_src_traced_probes_ftrace_test_messages_lite_gen_headers",
"perfetto_src_traced_probes_ftrace_test_messages_zero_gen_headers",
],
diff --git a/protos/perfetto/trace/BUILD.gn b/protos/perfetto/trace/BUILD.gn
index 850c133..ebcdfde 100644
--- a/protos/perfetto/trace/BUILD.gn
+++ b/protos/perfetto/trace/BUILD.gn
@@ -58,8 +58,18 @@
]
}
+# This is only for tests because bloats binary size.
+group("cpp") {
+ testonly = true
+ public_deps = [
+ ":minimal_cpp",
+ ":non_minimal_cpp",
+ ]
+}
+
perfetto_proto_library("non_minimal_@TYPE@") {
proto_generators = [
+ "cpp",
"lite",
"zero",
]
diff --git a/protos/perfetto/trace/ftrace/BUILD.gn b/protos/perfetto/trace/ftrace/BUILD.gn
index bda3817..3fa8cc0 100644
--- a/protos/perfetto/trace/ftrace/BUILD.gn
+++ b/protos/perfetto/trace/ftrace/BUILD.gn
@@ -18,6 +18,7 @@
perfetto_proto_library("@TYPE@") {
proto_generators = [
+ "cpp",
"zero",
"lite",
]
diff --git a/src/perfetto_cmd/BUILD.gn b/src/perfetto_cmd/BUILD.gn
index 534cdd9..969b732 100644
--- a/src/perfetto_cmd/BUILD.gn
+++ b/src/perfetto_cmd/BUILD.gn
@@ -136,8 +136,7 @@
"../../include/perfetto/ext/base",
"../../protos/perfetto/config:cpp",
"../../protos/perfetto/config/ftrace:cpp",
- "../../protos/perfetto/trace:lite",
- "../protozero",
+ "../../protos/perfetto/trace:cpp",
"../tracing",
]
sources = [
diff --git a/src/perfetto_cmd/packet_writer_unittest.cc b/src/perfetto_cmd/packet_writer_unittest.cc
index 5736099..c1fab21 100644
--- a/src/perfetto_cmd/packet_writer_unittest.cc
+++ b/src/perfetto_cmd/packet_writer_unittest.cc
@@ -27,23 +27,22 @@
#include "perfetto/ext/base/scoped_file.h"
#include "perfetto/ext/base/temp_file.h"
#include "perfetto/ext/tracing/core/trace_packet.h"
-#include "perfetto/protozero/scattered_heap_buffer.h"
-#include "protos/perfetto/trace/test_event.pbzero.h"
-#include "protos/perfetto/trace/trace.pb.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
-#include "protos/perfetto/trace/trace_packet.pbzero.h"
#include "src/perfetto_cmd/packet_writer.h"
#include "test/gtest_and_gmock.h"
+#include "protos/perfetto/trace/test_event.gen.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
+
namespace perfetto {
namespace {
-using TracePacketZero = protos::pbzero::TracePacket;
+using TracePacketProto = protos::gen::TracePacket;
template <typename F>
TracePacket CreateTracePacket(F fill_function) {
- protozero::HeapBuffered<TracePacketZero> msg;
- fill_function(msg.get());
+ TracePacketProto msg;
+ fill_function(&msg);
std::vector<uint8_t> buf = msg.SerializeAsArray();
Slice slice = Slice::Allocate(buf.size());
memcpy(slice.own_data(), buf.data(), buf.size());
@@ -78,7 +77,7 @@
return s;
}
-TEST(PacketWriter, FilePacketWriter) {
+TEST(PacketWriterTest, FilePacketWriter) {
base::TempFile tmp = base::TempFile::Create();
base::ScopedResource<FILE*, fclose, nullptr> f(
fdopen(tmp.ReleaseFD().release(), "wb"));
@@ -88,8 +87,8 @@
std::vector<perfetto::TracePacket> packets;
- packets.push_back(CreateTracePacket([](TracePacketZero* msg) {
- auto* for_testing = msg->set_for_testing();
+ packets.push_back(CreateTracePacket([](TracePacketProto* msg) {
+ auto* for_testing = msg->mutable_for_testing();
for_testing->set_str("abc");
}));
@@ -101,12 +100,12 @@
EXPECT_TRUE(base::ReadFileStream(*f, &s));
EXPECT_GT(s.size(), 0u);
- protos::Trace trace;
+ protos::gen::Trace trace;
EXPECT_TRUE(trace.ParseFromString(s));
- EXPECT_EQ(trace.packet().Get(0).for_testing().str(), "abc");
+ EXPECT_EQ(trace.packet()[0].for_testing().str(), "abc");
}
-TEST(PacketWriter, ZipPacketWriter) {
+TEST(PacketWriterTest, ZipPacketWriter) {
base::TempFile tmp = base::TempFile::Create();
base::ScopedResource<FILE*, fclose, nullptr> f(
fdopen(tmp.ReleaseFD().release(), "wb"));
@@ -117,8 +116,8 @@
std::vector<perfetto::TracePacket> packets;
- packets.push_back(CreateTracePacket([](TracePacketZero* msg) {
- auto* for_testing = msg->set_for_testing();
+ packets.push_back(CreateTracePacket([](TracePacketProto* msg) {
+ auto* for_testing = msg->mutable_for_testing();
for_testing->set_str("abc");
}));
@@ -130,18 +129,18 @@
EXPECT_TRUE(base::ReadFileStream(*f, &s));
EXPECT_GT(s.size(), 0u);
- protos::Trace trace;
+ protos::gen::Trace trace;
EXPECT_TRUE(trace.ParseFromString(s));
- const std::string& data = trace.packet().Get(0).compressed_packets();
+ const std::string& data = trace.packet()[0].compressed_packets();
EXPECT_GT(data.size(), 0u);
- protos::Trace subtrace;
+ protos::gen::Trace subtrace;
EXPECT_TRUE(subtrace.ParseFromString(Decompress(data)));
- EXPECT_EQ(subtrace.packet().Get(0).for_testing().str(), "abc");
+ EXPECT_EQ(subtrace.packet()[0].for_testing().str(), "abc");
}
-TEST(PacketWriter, ZipPacketWriter_Empty) {
+TEST(PacketWriterTest, ZipPacketWriter_Empty) {
base::TempFile tmp = base::TempFile::Create();
base::ScopedResource<FILE*, fclose, nullptr> f(
fdopen(tmp.ReleaseFD().release(), "wb"));
@@ -154,7 +153,7 @@
EXPECT_EQ(fseek(*f, 0, SEEK_END), 0);
}
-TEST(PacketWriter, ZipPacketWriter_EmptyWithEmptyWrite) {
+TEST(PacketWriterTest, ZipPacketWriter_EmptyWithEmptyWrite) {
base::TempFile tmp = base::TempFile::Create();
base::ScopedResource<FILE*, fclose, nullptr> f(
fdopen(tmp.ReleaseFD().release(), "wb"));
@@ -170,7 +169,7 @@
EXPECT_EQ(fseek(*f, 0, SEEK_END), 0);
}
-TEST(PacketWriter, ZipPacketWriter_ShouldCompress) {
+TEST(PacketWriterTest, ZipPacketWriter_ShouldCompress) {
base::TempFile tmp = base::TempFile::Create();
base::ScopedResource<FILE*, fclose, nullptr> f(
fdopen(tmp.ReleaseFD().release(), "wb"));
@@ -183,13 +182,13 @@
for (size_t i = 0; i < 200; i++) {
std::vector<perfetto::TracePacket> packets;
- packets.push_back(CreateTracePacket([](TracePacketZero* msg) {
- auto* for_testing = msg->set_for_testing();
+ packets.push_back(CreateTracePacket([](TracePacketProto* msg) {
+ auto* for_testing = msg->mutable_for_testing();
for_testing->set_str("abcdefghijklmn");
}));
- packets.push_back(CreateTracePacket([](TracePacketZero* msg) {
- auto* for_testing = msg->set_for_testing();
+ packets.push_back(CreateTracePacket([](TracePacketProto* msg) {
+ auto* for_testing = msg->mutable_for_testing();
for_testing->set_str("abcdefghijklmn");
}));
@@ -206,7 +205,7 @@
EXPECT_TRUE(base::ReadFileStream(*f, &s));
EXPECT_GT(s.size(), 0u);
- protos::Trace trace;
+ protos::gen::Trace trace;
EXPECT_TRUE(trace.ParseFromString(s));
size_t packet_count = 0;
@@ -214,7 +213,7 @@
const std::string& data = packet.compressed_packets();
EXPECT_GT(data.size(), 0u);
EXPECT_LT(data.size(), 500 * 1024u);
- protos::Trace subtrace;
+ protos::gen::Trace subtrace;
EXPECT_TRUE(subtrace.ParseFromString(Decompress(data)));
for (const auto& subpacket : subtrace.packet()) {
packet_count++;
@@ -225,7 +224,7 @@
EXPECT_EQ(packet_count, 200 * 2u);
}
-TEST(PacketWriter, ZipPacketWriter_ShouldSplitPackets) {
+TEST(PacketWriterTest, ZipPacketWriter_ShouldSplitPackets) {
base::TempFile tmp = base::TempFile::Create();
base::ScopedResource<FILE*, fclose, nullptr> f(
fdopen(tmp.ReleaseFD().release(), "wb"));
@@ -249,10 +248,10 @@
std::string s = randomString();
- packets.push_back(CreateTracePacket([i, &s](TracePacketZero* msg) {
- auto* for_testing = msg->set_for_testing();
+ packets.push_back(CreateTracePacket([i, &s](TracePacketProto* msg) {
+ auto* for_testing = msg->mutable_for_testing();
for_testing->set_seq_value(i);
- for_testing->set_str(s.data(), s.size());
+ for_testing->set_str(s);
}));
EXPECT_TRUE(writer->WritePackets(std::move(packets)));
@@ -264,7 +263,7 @@
EXPECT_TRUE(base::ReadFileStream(*f, &s));
EXPECT_GT(s.size(), 0u);
- protos::Trace trace;
+ protos::gen::Trace trace;
EXPECT_TRUE(trace.ParseFromString(s));
size_t packet_count = 0;
@@ -272,7 +271,7 @@
const std::string& data = packet.compressed_packets();
EXPECT_GT(data.size(), 0u);
EXPECT_LT(data.size(), 500 * 1024u);
- protos::Trace subtrace;
+ protos::gen::Trace subtrace;
EXPECT_TRUE(subtrace.ParseFromString(Decompress(data)));
for (const auto& subpacket : subtrace.packet()) {
EXPECT_EQ(subpacket.for_testing().seq_value(), packet_count++);
diff --git a/src/profiling/memory/BUILD.gn b/src/profiling/memory/BUILD.gn
index 9ef32c2..1862fb4 100644
--- a/src/profiling/memory/BUILD.gn
+++ b/src/profiling/memory/BUILD.gn
@@ -145,7 +145,7 @@
":scoped_spinlock",
":wire_protocol",
"../../../gn:default_deps",
- "../../../protos/perfetto/config/profiling:lite",
+ "../../../protos/perfetto/config/profiling:cpp",
"../../base",
"../../base:unix_socket",
"../../tracing",
@@ -238,8 +238,8 @@
"../../../gn:default_deps",
"../../../gn:gtest_and_gmock",
"../../../gn:libunwindstack",
- "../../../include/perfetto/protozero",
- "../../../protos/perfetto/config/profiling:zero",
+ "../../../protos/perfetto/config/profiling:cpp",
+ "../../../protos/perfetto/trace/profiling:cpp",
"../../../test:test_helper",
"../../base",
"../../base:test_support",
diff --git a/src/profiling/memory/heapprofd_end_to_end_test.cc b/src/profiling/memory/heapprofd_end_to_end_test.cc
index 42e666f..d698650 100644
--- a/src/profiling/memory/heapprofd_end_to_end_test.cc
+++ b/src/profiling/memory/heapprofd_end_to_end_test.cc
@@ -21,17 +21,19 @@
#include "perfetto/base/build_config.h"
#include "perfetto/ext/base/pipe.h"
#include "perfetto/ext/tracing/ipc/default_socket.h"
-#include "perfetto/protozero/scattered_heap_buffer.h"
#include "src/base/test/test_task_runner.h"
#include "src/profiling/memory/heapprofd_producer.h"
#include "test/gtest_and_gmock.h"
#include "test/test_helper.h"
-#include "protos/perfetto/config/profiling/heapprofd_config.pbzero.h"
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
#include <sys/system_properties.h>
#endif
+#include "protos/perfetto/config/profiling/heapprofd_config.gen.h"
+#include "protos/perfetto/trace/profiling/profile_common.gen.h"
+#include "protos/perfetto/trace/profiling/profile_packet.gen.h"
+
namespace perfetto {
namespace profiling {
namespace {
@@ -166,7 +168,7 @@
return helper;
}
-std::string FormatHistogram(const protos::ProfilePacket_Histogram& hist) {
+std::string FormatHistogram(const protos::gen::ProfilePacket_Histogram& hist) {
std::string out;
std::string prev_upper_limit = "-inf";
for (const auto& bucket : hist.buckets()) {
@@ -183,7 +185,7 @@
return out + "\n";
}
-std::string FormatStats(const protos::ProfilePacket_ProcessStats& stats) {
+std::string FormatStats(const protos::gen::ProfilePacket_ProcessStats& stats) {
return std::string("unwinding_errors: ") +
std::to_string(stats.unwinding_errors()) + "\n" +
"heap_samples: " + std::to_string(stats.heap_samples()) + "\n" +
@@ -231,7 +233,7 @@
void PrintStats(TestHelper* helper) {
const auto& packets = helper->trace();
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
for (const auto& dump : packet.profile_packet().process_dumps()) {
// protobuf uint64 does not like the PRIu64 formatter.
PERFETTO_LOG("Stats for %s: %s", std::to_string(dump.pid()).c_str(),
@@ -244,7 +246,7 @@
uint64_t pid,
uint64_t alloc_size) {
const auto& packets = helper->trace();
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
for (const auto& dump : packet.profile_packet().process_dumps()) {
if (dump.pid() != pid)
continue;
@@ -262,7 +264,7 @@
uint64_t pid,
bool from_startup) {
const auto& packets = helper->trace();
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
for (const auto& dump : packet.profile_packet().process_dumps()) {
if (dump.pid() != pid)
continue;
@@ -275,7 +277,7 @@
uint64_t pid,
bool rejected_concurrent) {
const auto& packets = helper->trace();
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
for (const auto& dump : packet.profile_packet().process_dumps()) {
if (dump.pid() != pid)
continue;
@@ -291,7 +293,7 @@
size_t samples = 0;
uint64_t last_allocated = 0;
uint64_t last_freed = 0;
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
for (const auto& dump : packet.profile_packet().process_dumps()) {
if (dump.pid() != pid)
continue;
@@ -312,7 +314,7 @@
void ValidateOnlyPID(TestHelper* helper, uint64_t pid) {
size_t dumps = 0;
const auto& packets = helper->trace();
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
for (const auto& dump : packet.profile_packet().process_dumps()) {
EXPECT_EQ(dump.pid(), pid);
dumps++;
@@ -336,11 +338,11 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_pid(static_cast<uint64_t>(pid));
- heapprofd_config->set_all(false);
- auto* cont_config = heapprofd_config->set_continuous_dump_config();
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid));
+ heapprofd_config.set_all(false);
+ auto* cont_config = heapprofd_config.mutable_continuous_dump_config();
cont_config->set_dump_phase_ms(0);
cont_config->set_dump_interval_ms(100);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
@@ -371,11 +373,11 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_pid(static_cast<uint64_t>(pid));
- heapprofd_config->add_pid(static_cast<uint64_t>(pid2));
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid));
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid2));
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
auto helper = Trace(trace_config);
@@ -405,10 +407,10 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_pid(static_cast<uint64_t>(pid));
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid));
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
auto helper = Trace(trace_config);
@@ -432,10 +434,10 @@
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.heapprofd");
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_process_cmdline("heapprofd_continuous_malloc");
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_process_cmdline("heapprofd_continuous_malloc");
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
helper->StartTracing(trace_config);
@@ -481,12 +483,12 @@
size_t samples = 0;
uint64_t total_allocated = 0;
uint64_t total_freed = 0;
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
if (packet.has_profile_packet() &&
packet.profile_packet().process_dumps().size() > 0) {
const auto& dumps = packet.profile_packet().process_dumps();
- ASSERT_EQ(dumps.size(), 1);
- const protos::ProfilePacket_ProcessHeapSamples& dump = dumps.Get(0);
+ ASSERT_EQ(dumps.size(), 1u);
+ const protos::gen::ProfilePacket_ProcessHeapSamples& dump = dumps[0];
EXPECT_EQ(static_cast<pid_t>(dump.pid()), pid);
profile_packets++;
for (const auto& sample : dump.samples()) {
@@ -513,10 +515,10 @@
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.heapprofd");
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_process_cmdline("heapprofd_continuous_malloc@1.2.3");
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_process_cmdline("heapprofd_continuous_malloc@1.2.3");
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
helper->StartTracing(trace_config);
@@ -562,12 +564,12 @@
size_t samples = 0;
uint64_t total_allocated = 0;
uint64_t total_freed = 0;
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
if (packet.has_profile_packet() &&
packet.profile_packet().process_dumps().size() > 0) {
const auto& dumps = packet.profile_packet().process_dumps();
- ASSERT_EQ(dumps.size(), 1);
- const protos::ProfilePacket_ProcessHeapSamples& dump = dumps.Get(0);
+ ASSERT_EQ(dumps.size(), 1u);
+ const protos::gen::ProfilePacket_ProcessHeapSamples& dump = dumps[0];
EXPECT_EQ(static_cast<pid_t>(dump.pid()), pid);
profile_packets++;
for (const auto& sample : dump.samples()) {
@@ -594,10 +596,10 @@
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.heapprofd");
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_process_cmdline("heapprofd_continuous_malloc");
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_process_cmdline("heapprofd_continuous_malloc");
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
// Make sure the forked process does not get reparented to init.
@@ -639,12 +641,12 @@
size_t samples = 0;
uint64_t total_allocated = 0;
uint64_t total_freed = 0;
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
if (packet.has_profile_packet() &&
packet.profile_packet().process_dumps().size() > 0) {
const auto& dumps = packet.profile_packet().process_dumps();
- ASSERT_EQ(dumps.size(), 1);
- const protos::ProfilePacket_ProcessHeapSamples& dump = dumps.Get(0);
+ ASSERT_EQ(dumps.size(), 1u);
+ const protos::gen::ProfilePacket_ProcessHeapSamples& dump = dumps[0];
EXPECT_EQ(static_cast<pid_t>(dump.pid()), pid);
profile_packets++;
for (const auto& sample : dump.samples()) {
@@ -671,10 +673,10 @@
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.heapprofd");
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_process_cmdline("heapprofd_continuous_malloc@1.2.3");
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_process_cmdline("heapprofd_continuous_malloc@1.2.3");
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
// Make sure the forked process does not get reparented to init.
@@ -716,12 +718,12 @@
size_t samples = 0;
uint64_t total_allocated = 0;
uint64_t total_freed = 0;
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
if (packet.has_profile_packet() &&
packet.profile_packet().process_dumps().size() > 0) {
const auto& dumps = packet.profile_packet().process_dumps();
- ASSERT_EQ(dumps.size(), 1);
- const protos::ProfilePacket_ProcessHeapSamples& dump = dumps.Get(0);
+ ASSERT_EQ(dumps.size(), 1u);
+ const protos::gen::ProfilePacket_ProcessHeapSamples& dump = dumps[0];
EXPECT_EQ(static_cast<pid_t>(dump.pid()), pid);
profile_packets++;
for (const auto& sample : dump.samples()) {
@@ -785,10 +787,10 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_pid(static_cast<uint64_t>(pid));
- heapprofd_config->set_all(false);
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid));
+ heapprofd_config.set_all(false);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
auto helper = Trace(trace_config);
@@ -833,11 +835,11 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_pid(static_cast<uint64_t>(pid));
- heapprofd_config->set_all(false);
- auto* cont_config = heapprofd_config->set_continuous_dump_config();
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid));
+ heapprofd_config.set_all(false);
+ auto* cont_config = heapprofd_config.mutable_continuous_dump_config();
cont_config->set_dump_phase_ms(0);
cont_config->set_dump_interval_ms(100);
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
@@ -906,9 +908,9 @@
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.heapprofd");
- protozero::HeapBuffered<protos::pbzero::HeapprofdConfig> heapprofd_config;
- heapprofd_config->set_sampling_interval_bytes(1);
- heapprofd_config->add_pid(static_cast<uint64_t>(pid));
+ protos::gen::HeapprofdConfig heapprofd_config;
+ heapprofd_config.set_sampling_interval_bytes(1);
+ heapprofd_config.add_pid(static_cast<uint64_t>(pid));
ds_config->set_heapprofd_config_raw(heapprofd_config.SerializeAsString());
// Wait for child to have been scheduled at least once.
@@ -940,12 +942,12 @@
size_t profile_packets = 0;
size_t samples = 0;
uint64_t total_allocated = 0;
- for (const protos::TracePacket& packet : packets) {
+ for (const protos::gen::TracePacket& packet : packets) {
if (packet.has_profile_packet() &&
packet.profile_packet().process_dumps().size() > 0) {
const auto& dumps = packet.profile_packet().process_dumps();
- ASSERT_EQ(dumps.size(), 1);
- const protos::ProfilePacket_ProcessHeapSamples& dump = dumps.Get(0);
+ ASSERT_EQ(dumps.size(), 1u);
+ const protos::gen::ProfilePacket_ProcessHeapSamples& dump = dumps[0];
EXPECT_EQ(static_cast<pid_t>(dump.pid()), pid);
profile_packets++;
for (const auto& sample : dump.samples()) {
diff --git a/src/protozero/protoc_plugin/cppgen_plugin.cc b/src/protozero/protoc_plugin/cppgen_plugin.cc
index 060903f..cc499ab 100644
--- a/src/protozero/protoc_plugin/cppgen_plugin.cc
+++ b/src/protozero/protoc_plugin/cppgen_plugin.cc
@@ -217,6 +217,9 @@
local_enums.push_back(enum_desc);
};
+ for (int i = 0; i < file->enum_type_count(); i++)
+ add_enum(file->enum_type(i));
+
std::stack<const Descriptor*> recursion_stack;
for (int i = 0; i < file->message_type_count(); i++)
recursion_stack.push(file->message_type(i));
@@ -558,17 +561,6 @@
p->Print("std::vector<uint8_t> SerializeAsArray() const override;\n");
p->Print("void Serialize(::protozero::Message*) const;\n");
- p->Print("// (DEPRECATED) Conversion methods from/to libprotobuf types.\n");
- p->Print("// These two will go away soon, see go/perfetto-libprotobuf.\n");
- p->Print(
- "template <typename T /*$p$*/> void FromProto(const T& pb_obj) { "
- "ParseFromString(pb_obj.SerializeAsString()); }\n",
- "p", proto_type);
- p->Print(
- "template <typename T /*$p$*/> void ToProto(T* pb_obj) const { "
- "pb_obj->Clear(); pb_obj->ParseFromString(SerializeAsString()); }\n",
- "p", proto_type);
-
// Generate accessors.
for (int i = 0; i < msg->field_count(); i++) {
const FieldDescriptor* field = msg->field(i);
diff --git a/src/trace_processor/BUILD.gn b/src/trace_processor/BUILD.gn
index 1051a81..e3eb750 100644
--- a/src/trace_processor/BUILD.gn
+++ b/src/trace_processor/BUILD.gn
@@ -144,6 +144,12 @@
":descriptors",
"../../gn:default_deps",
"../../gn:zlib",
+ "../base",
+ "../protozero",
+ "tables",
+ ]
+ public_deps = [
+ "../../include/perfetto/trace_processor:storage",
"../../protos/perfetto/common:zero",
"../../protos/perfetto/config:zero",
"../../protos/perfetto/trace:zero",
@@ -158,12 +164,6 @@
"../../protos/perfetto/trace/ps:zero",
"../../protos/perfetto/trace/sys_stats:zero",
"../../protos/perfetto/trace/track_event:zero",
- "../base",
- "../protozero",
- "tables",
- ]
- public_deps = [
- "../../include/perfetto/trace_processor:storage",
]
if (enable_perfetto_trace_processor_json_import) {
sources += [
@@ -485,7 +485,6 @@
":storage",
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
- "../../protos/perfetto/trace:lite",
"../base",
"../base:test_support",
"sqlite",
diff --git a/src/traced/probes/android_log/BUILD.gn b/src/traced/probes/android_log/BUILD.gn
index eac5fd3..cc25cd4 100644
--- a/src/traced/probes/android_log/BUILD.gn
+++ b/src/traced/probes/android_log/BUILD.gn
@@ -39,8 +39,9 @@
":android_log",
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
- "../../../../protos/perfetto/common:zero",
- "../../../../protos/perfetto/config/android:zero",
+ "../../../../protos/perfetto/common:cpp",
+ "../../../../protos/perfetto/config/android:cpp",
+ "../../../../protos/perfetto/trace/android:cpp",
"../../../../src/base:test_support",
"../../../../src/tracing:test_support",
]
diff --git a/src/traced/probes/android_log/android_log_data_source_unittest.cc b/src/traced/probes/android_log/android_log_data_source_unittest.cc
index 1c90204..c7753f1 100644
--- a/src/traced/probes/android_log/android_log_data_source_unittest.cc
+++ b/src/traced/probes/android_log/android_log_data_source_unittest.cc
@@ -16,16 +16,17 @@
#include "src/traced/probes/android_log/android_log_data_source.h"
-#include "perfetto/protozero/scattered_heap_buffer.h"
#include "perfetto/tracing/core/data_source_config.h"
-#include "protos/perfetto/common/android_log_constants.pbzero.h"
-#include "protos/perfetto/config/android/android_log_config.pbzero.h"
#include "src/base/test/test_task_runner.h"
#include "src/tracing/core/trace_writer_for_testing.h"
#include "test/gtest_and_gmock.h"
-using ::perfetto::protos::pbzero::AndroidLogConfig;
-using ::perfetto::protos::pbzero::AndroidLogId;
+#include "protos/perfetto/common/android_log_constants.gen.h"
+#include "protos/perfetto/config/android/android_log_config.gen.h"
+#include "protos/perfetto/trace/android/android_log.gen.h"
+
+using ::perfetto::protos::gen::AndroidLogConfig;
+using ::perfetto::protos::gen::AndroidLogId;
using ::testing::Invoke;
using ::testing::Return;
@@ -221,44 +222,43 @@
EXPECT_EQ(event_packet.android_log().events_size(), 3);
const auto& decoded = event_packet.android_log().events();
- EXPECT_EQ(decoded.Get(0).log_id(), protos::AndroidLogId::LID_SYSTEM);
- EXPECT_EQ(decoded.Get(0).pid(), 7546);
- EXPECT_EQ(decoded.Get(0).tid(), 8991);
- EXPECT_EQ(decoded.Get(0).uid(), 1000);
- EXPECT_EQ(decoded.Get(0).prio(), protos::AndroidLogPriority::PRIO_INFO);
- EXPECT_EQ(decoded.Get(0).timestamp(), 1546125239679172326ULL);
- EXPECT_EQ(decoded.Get(0).tag(), "ActivityManager");
+ EXPECT_EQ(decoded[0].log_id(), protos::gen::AndroidLogId::LID_SYSTEM);
+ EXPECT_EQ(decoded[0].pid(), 7546);
+ EXPECT_EQ(decoded[0].tid(), 8991);
+ EXPECT_EQ(decoded[0].uid(), 1000);
+ EXPECT_EQ(decoded[0].prio(), protos::gen::AndroidLogPriority::PRIO_INFO);
+ EXPECT_EQ(decoded[0].timestamp(), 1546125239679172326ULL);
+ EXPECT_EQ(decoded[0].tag(), "ActivityManager");
EXPECT_EQ(
- decoded.Get(0).message(),
+ decoded[0].message(),
"Killing 11660:com.google.android.videos/u0a168 (adj 985): empty #17");
- EXPECT_EQ(decoded.Get(1).log_id(), protos::AndroidLogId::LID_DEFAULT);
- EXPECT_EQ(decoded.Get(1).pid(), 7546);
- EXPECT_EQ(decoded.Get(1).tid(), 7570);
- EXPECT_EQ(decoded.Get(1).uid(), 1000);
- EXPECT_EQ(decoded.Get(1).prio(), protos::AndroidLogPriority::PRIO_WARN);
- EXPECT_EQ(decoded.Get(1).timestamp(), 1546125239683537170ULL);
- EXPECT_EQ(decoded.Get(1).tag(), "libprocessgroup");
- EXPECT_EQ(decoded.Get(1).message(),
- "kill(-11660, 9) failed: No such process");
+ EXPECT_EQ(decoded[1].log_id(), protos::gen::AndroidLogId::LID_DEFAULT);
+ EXPECT_EQ(decoded[1].pid(), 7546);
+ EXPECT_EQ(decoded[1].tid(), 7570);
+ EXPECT_EQ(decoded[1].uid(), 1000);
+ EXPECT_EQ(decoded[1].prio(), protos::gen::AndroidLogPriority::PRIO_WARN);
+ EXPECT_EQ(decoded[1].timestamp(), 1546125239683537170ULL);
+ EXPECT_EQ(decoded[1].tag(), "libprocessgroup");
+ EXPECT_EQ(decoded[1].message(), "kill(-11660, 9) failed: No such process");
- EXPECT_EQ(decoded.Get(2).log_id(), protos::AndroidLogId::LID_DEFAULT);
- EXPECT_EQ(decoded.Get(2).pid(), 7415);
- EXPECT_EQ(decoded.Get(2).tid(), 7415);
- EXPECT_EQ(decoded.Get(2).uid(), 0);
- EXPECT_EQ(decoded.Get(2).prio(), protos::AndroidLogPriority::PRIO_INFO);
- EXPECT_EQ(decoded.Get(2).timestamp(), 1546125239719458684ULL);
- EXPECT_EQ(decoded.Get(2).tag(), "Zygote");
- EXPECT_EQ(decoded.Get(2).message(), "Process 11660 exited due to signal (9)");
+ EXPECT_EQ(decoded[2].log_id(), protos::gen::AndroidLogId::LID_DEFAULT);
+ EXPECT_EQ(decoded[2].pid(), 7415);
+ EXPECT_EQ(decoded[2].tid(), 7415);
+ EXPECT_EQ(decoded[2].uid(), 0);
+ EXPECT_EQ(decoded[2].prio(), protos::gen::AndroidLogPriority::PRIO_INFO);
+ EXPECT_EQ(decoded[2].timestamp(), 1546125239719458684ULL);
+ EXPECT_EQ(decoded[2].tag(), "Zygote");
+ EXPECT_EQ(decoded[2].message(), "Process 11660 exited due to signal (9)");
}
TEST_F(AndroidLogDataSourceTest, TextEventsWithTagFiltering) {
DataSourceConfig cfg;
- protozero::HeapBuffered<AndroidLogConfig> acfg;
- acfg->add_filter_tags("Zygote");
- acfg->add_filter_tags("ActivityManager");
- acfg->add_filter_tags("Unmatched");
- acfg->add_filter_tags("libprocessgroupZZ");
+ AndroidLogConfig acfg;
+ acfg.add_filter_tags("Zygote");
+ acfg.add_filter_tags("ActivityManager");
+ acfg.add_filter_tags("Unmatched");
+ acfg.add_filter_tags("libprocessgroupZZ");
cfg.set_android_log_config_raw(acfg.SerializeAsString());
CreateInstance(cfg);
@@ -273,14 +273,14 @@
EXPECT_EQ(event_packet.android_log().events_size(), 2);
const auto& decoded = event_packet.android_log().events();
- EXPECT_EQ(decoded.Get(0).tag(), "ActivityManager");
- EXPECT_EQ(decoded.Get(1).tag(), "Zygote");
+ EXPECT_EQ(decoded[0].tag(), "ActivityManager");
+ EXPECT_EQ(decoded[1].tag(), "Zygote");
}
TEST_F(AndroidLogDataSourceTest, TextEventsWithPrioFiltering) {
DataSourceConfig cfg;
- protozero::HeapBuffered<AndroidLogConfig> acfg;
- acfg->set_min_prio(protos::pbzero::AndroidLogPriority::PRIO_WARN);
+ AndroidLogConfig acfg;
+ acfg.set_min_prio(protos::gen::AndroidLogPriority::PRIO_WARN);
cfg.set_android_log_config_raw(acfg.SerializeAsString());
CreateInstance(cfg);
@@ -295,7 +295,7 @@
EXPECT_EQ(event_packet.android_log().events_size(), 1);
const auto& decoded = event_packet.android_log().events();
- EXPECT_EQ(decoded.Get(0).tag(), "libprocessgroup");
+ EXPECT_EQ(decoded[0].tag(), "libprocessgroup");
}
TEST_F(AndroidLogDataSourceTest, BinaryEvents) {
@@ -320,69 +320,69 @@
EXPECT_EQ(event_packet.android_log().events_size(), 3);
const auto& decoded = event_packet.android_log().events();
- EXPECT_EQ(decoded.Get(0).log_id(), protos::AndroidLogId::LID_EVENTS);
- EXPECT_EQ(decoded.Get(0).pid(), 29981);
- EXPECT_EQ(decoded.Get(0).tid(), 30962);
- EXPECT_EQ(decoded.Get(0).uid(), 1000);
- EXPECT_EQ(decoded.Get(0).timestamp(), 1546165328914257883ULL);
- EXPECT_EQ(decoded.Get(0).tag(), "am_kill");
- ASSERT_EQ(decoded.Get(0).args_size(), 5);
- EXPECT_EQ(decoded.Get(0).args(0).name(), "User");
- EXPECT_EQ(decoded.Get(0).args(0).int_value(), 0);
- EXPECT_EQ(decoded.Get(0).args(1).name(), "PID");
- EXPECT_EQ(decoded.Get(0).args(1).int_value(), 31730);
- EXPECT_EQ(decoded.Get(0).args(2).name(), "Process Name");
- EXPECT_EQ(decoded.Get(0).args(2).string_value(), "android.process.acore");
- EXPECT_EQ(decoded.Get(0).args(3).name(), "OomAdj");
- EXPECT_EQ(decoded.Get(0).args(3).int_value(), 985);
- EXPECT_EQ(decoded.Get(0).args(4).name(), "Reason");
- EXPECT_EQ(decoded.Get(0).args(4).string_value(), "empty #17");
+ EXPECT_EQ(decoded[0].log_id(), protos::gen::AndroidLogId::LID_EVENTS);
+ EXPECT_EQ(decoded[0].pid(), 29981);
+ EXPECT_EQ(decoded[0].tid(), 30962);
+ EXPECT_EQ(decoded[0].uid(), 1000);
+ EXPECT_EQ(decoded[0].timestamp(), 1546165328914257883ULL);
+ EXPECT_EQ(decoded[0].tag(), "am_kill");
+ ASSERT_EQ(decoded[0].args_size(), 5);
+ EXPECT_EQ(decoded[0].args()[0].name(), "User");
+ EXPECT_EQ(decoded[0].args()[0].int_value(), 0);
+ EXPECT_EQ(decoded[0].args()[1].name(), "PID");
+ EXPECT_EQ(decoded[0].args()[1].int_value(), 31730);
+ EXPECT_EQ(decoded[0].args()[2].name(), "Process Name");
+ EXPECT_EQ(decoded[0].args()[2].string_value(), "android.process.acore");
+ EXPECT_EQ(decoded[0].args()[3].name(), "OomAdj");
+ EXPECT_EQ(decoded[0].args()[3].int_value(), 985);
+ EXPECT_EQ(decoded[0].args()[4].name(), "Reason");
+ EXPECT_EQ(decoded[0].args()[4].string_value(), "empty #17");
- EXPECT_EQ(decoded.Get(1).log_id(), protos::AndroidLogId::LID_EVENTS);
- EXPECT_EQ(decoded.Get(1).pid(), 29981);
- EXPECT_EQ(decoded.Get(1).tid(), 30962);
- EXPECT_EQ(decoded.Get(1).uid(), 1000);
- EXPECT_EQ(decoded.Get(1).timestamp(), 1546165328946231844ULL);
- EXPECT_EQ(decoded.Get(1).tag(), "am_uid_stopped");
- ASSERT_EQ(decoded.Get(1).args_size(), 1);
- EXPECT_EQ(decoded.Get(1).args(0).name(), "UID");
- EXPECT_EQ(decoded.Get(1).args(0).int_value(), 10018);
+ EXPECT_EQ(decoded[1].log_id(), protos::gen::AndroidLogId::LID_EVENTS);
+ EXPECT_EQ(decoded[1].pid(), 29981);
+ EXPECT_EQ(decoded[1].tid(), 30962);
+ EXPECT_EQ(decoded[1].uid(), 1000);
+ EXPECT_EQ(decoded[1].timestamp(), 1546165328946231844ULL);
+ EXPECT_EQ(decoded[1].tag(), "am_uid_stopped");
+ ASSERT_EQ(decoded[1].args_size(), 1);
+ EXPECT_EQ(decoded[1].args()[0].name(), "UID");
+ EXPECT_EQ(decoded[1].args()[0].int_value(), 10018);
- EXPECT_EQ(decoded.Get(2).log_id(), protos::AndroidLogId::LID_EVENTS);
- EXPECT_EQ(decoded.Get(2).pid(), 29981);
- EXPECT_EQ(decoded.Get(2).tid(), 29998);
- EXPECT_EQ(decoded.Get(2).uid(), 1000);
- EXPECT_EQ(decoded.Get(2).timestamp(), 1546165328960813044ULL);
- EXPECT_EQ(decoded.Get(2).tag(), "am_pss");
- ASSERT_EQ(decoded.Get(2).args_size(), 10);
- EXPECT_EQ(decoded.Get(2).args(0).name(), "Pid");
- EXPECT_EQ(decoded.Get(2).args(0).int_value(), 1417);
- EXPECT_EQ(decoded.Get(2).args(1).name(), "UID");
- EXPECT_EQ(decoded.Get(2).args(1).int_value(), 10098);
- EXPECT_EQ(decoded.Get(2).args(2).name(), "Process Name");
- EXPECT_EQ(decoded.Get(2).args(2).string_value(),
+ EXPECT_EQ(decoded[2].log_id(), protos::gen::AndroidLogId::LID_EVENTS);
+ EXPECT_EQ(decoded[2].pid(), 29981);
+ EXPECT_EQ(decoded[2].tid(), 29998);
+ EXPECT_EQ(decoded[2].uid(), 1000);
+ EXPECT_EQ(decoded[2].timestamp(), 1546165328960813044ULL);
+ EXPECT_EQ(decoded[2].tag(), "am_pss");
+ ASSERT_EQ(decoded[2].args_size(), 10);
+ EXPECT_EQ(decoded[2].args()[0].name(), "Pid");
+ EXPECT_EQ(decoded[2].args()[0].int_value(), 1417);
+ EXPECT_EQ(decoded[2].args()[1].name(), "UID");
+ EXPECT_EQ(decoded[2].args()[1].int_value(), 10098);
+ EXPECT_EQ(decoded[2].args()[2].name(), "Process Name");
+ EXPECT_EQ(decoded[2].args()[2].string_value(),
"com.google.android.connectivitymonitor");
- EXPECT_EQ(decoded.Get(2).args(3).name(), "Pss");
- EXPECT_EQ(decoded.Get(2).args(3).int_value(), 4831232);
- EXPECT_EQ(decoded.Get(2).args(4).name(), "Uss");
- EXPECT_EQ(decoded.Get(2).args(4).int_value(), 3723264);
- EXPECT_EQ(decoded.Get(2).args(5).name(), "SwapPss");
- EXPECT_EQ(decoded.Get(2).args(5).int_value(), 0);
- EXPECT_EQ(decoded.Get(2).args(6).name(), "Rss");
- EXPECT_EQ(decoded.Get(2).args(6).int_value(), 56053760);
- EXPECT_EQ(decoded.Get(2).args(7).name(), "StatType");
- EXPECT_EQ(decoded.Get(2).args(7).int_value(), 0);
- EXPECT_EQ(decoded.Get(2).args(8).name(), "ProcState");
- EXPECT_EQ(decoded.Get(2).args(8).int_value(), 9);
- EXPECT_EQ(decoded.Get(2).args(9).name(), "TimeToCollect");
- EXPECT_EQ(decoded.Get(2).args(9).int_value(), 39);
+ EXPECT_EQ(decoded[2].args()[3].name(), "Pss");
+ EXPECT_EQ(decoded[2].args()[3].int_value(), 4831232);
+ EXPECT_EQ(decoded[2].args()[4].name(), "Uss");
+ EXPECT_EQ(decoded[2].args()[4].int_value(), 3723264);
+ EXPECT_EQ(decoded[2].args()[5].name(), "SwapPss");
+ EXPECT_EQ(decoded[2].args()[5].int_value(), 0);
+ EXPECT_EQ(decoded[2].args()[6].name(), "Rss");
+ EXPECT_EQ(decoded[2].args()[6].int_value(), 56053760);
+ EXPECT_EQ(decoded[2].args()[7].name(), "StatType");
+ EXPECT_EQ(decoded[2].args()[7].int_value(), 0);
+ EXPECT_EQ(decoded[2].args()[8].name(), "ProcState");
+ EXPECT_EQ(decoded[2].args()[8].int_value(), 9);
+ EXPECT_EQ(decoded[2].args()[9].name(), "TimeToCollect");
+ EXPECT_EQ(decoded[2].args()[9].int_value(), 39);
}
TEST_F(AndroidLogDataSourceTest, BinaryEventsWithTagFiltering) {
DataSourceConfig cfg;
- protozero::HeapBuffered<AndroidLogConfig> acfg;
- acfg->add_filter_tags("not mached");
- acfg->add_filter_tags("am_uid_stopped");
+ AndroidLogConfig acfg;
+ acfg.add_filter_tags("not mached");
+ acfg.add_filter_tags("am_uid_stopped");
cfg.set_android_log_config_raw(acfg.SerializeAsString());
CreateInstance(cfg);
static const char kDefs[] = R"(
@@ -403,8 +403,8 @@
EXPECT_EQ(event_packet.android_log().events_size(), 1);
const auto& decoded = event_packet.android_log().events();
- EXPECT_EQ(decoded.Get(0).timestamp(), 1546165328946231844ULL);
- EXPECT_EQ(decoded.Get(0).tag(), "am_uid_stopped");
+ EXPECT_EQ(decoded[0].timestamp(), 1546165328946231844ULL);
+ EXPECT_EQ(decoded[0].tag(), "am_uid_stopped");
}
} // namespace
diff --git a/src/traced/probes/ftrace/BUILD.gn b/src/traced/probes/ftrace/BUILD.gn
index e53e7b6..02ef384 100644
--- a/src/traced/probes/ftrace/BUILD.gn
+++ b/src/traced/probes/ftrace/BUILD.gn
@@ -47,12 +47,15 @@
deps = [
":format_parser",
":ftrace",
+ ":test_messages_cpp",
":test_messages_lite",
":test_messages_zero",
":test_support",
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
- "../../../../protos/perfetto/trace/ftrace:lite",
+ "../../../../protos/perfetto/trace:cpp",
+ "../../../../protos/perfetto/trace/ftrace:cpp",
+ "../../../../protos/perfetto/trace/ftrace:zero",
"../../../base:test_support",
"../../../tracing:test_support",
]
@@ -71,6 +74,7 @@
perfetto_proto_library("test_messages_@TYPE@") {
proto_generators = [
+ "cpp",
"lite",
"zero",
]
@@ -89,7 +93,6 @@
":test_support",
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
- "../../../../protos/perfetto/trace/ftrace:lite",
"../../../base",
"../../../tracing",
]
diff --git a/src/traced/probes/ftrace/cpu_reader_unittest.cc b/src/traced/probes/ftrace/cpu_reader_unittest.cc
index f8b58cf..61cdc23 100644
--- a/src/traced/probes/ftrace/cpu_reader_unittest.cc
+++ b/src/traced/probes/ftrace/cpu_reader_unittest.cc
@@ -24,20 +24,24 @@
#include "perfetto/protozero/proto_utils.h"
#include "perfetto/protozero/scattered_heap_buffer.h"
#include "perfetto/protozero/scattered_stream_writer.h"
-#include "protos/perfetto/trace/ftrace/ftrace_event.pb.h"
-#include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
-#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.pb.h"
-#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.pbzero.h"
#include "src/traced/probes/ftrace/event_info.h"
#include "src/traced/probes/ftrace/ftrace_config_muxer.h"
#include "src/traced/probes/ftrace/ftrace_procfs.h"
#include "src/traced/probes/ftrace/proto_translation_table.h"
#include "src/traced/probes/ftrace/test/cpu_reader_support.h"
-#include "src/traced/probes/ftrace/test/test_messages.pb.h"
-#include "src/traced/probes/ftrace/test/test_messages.pbzero.h"
#include "src/tracing/core/trace_writer_for_testing.h"
#include "test/gtest_and_gmock.h"
+#include "protos/perfetto/trace/ftrace/ftrace.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.pbzero.h"
+#include "protos/perfetto/trace/ftrace/sched.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
+#include "src/traced/probes/ftrace/test/test_messages.gen.h"
+#include "src/traced/probes/ftrace/test/test_messages.pbzero.h"
+
using protozero::proto_utils::ProtoSchemaType;
using testing::_;
using testing::AnyNumber;
@@ -118,8 +122,7 @@
std::unique_ptr<ProtoT> ParseProto() {
auto bundle = std::unique_ptr<ProtoT>(new ProtoT());
std::vector<uint8_t> buffer = delegate_.StitchSlices();
- if (!bundle->ParseFromArray(buffer.data(),
- static_cast<int>(buffer.size()))) {
+ if (!bundle->ParseFromArray(buffer.data(), buffer.size())) {
return nullptr;
}
return bundle;
@@ -135,8 +138,8 @@
ZeroT writer_;
};
-using BundleProvider =
- ProtoProvider<protos::pbzero::FtraceEventBundle, protos::FtraceEventBundle>;
+using BundleProvider = ProtoProvider<protos::pbzero::FtraceEventBundle,
+ protos::gen::FtraceEventBundle>;
class BinaryWriter {
public:
@@ -401,8 +404,8 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- ASSERT_EQ(bundle->event().size(), 1);
- const protos::FtraceEvent& event = bundle->event().Get(0);
+ ASSERT_EQ(bundle->event().size(), 1u);
+ const protos::gen::FtraceEvent& event = bundle->event()[0];
EXPECT_EQ(event.pid(), 28712ul);
EXPECT_TRUE(WithinOneMicrosecond(event.timestamp(), 608934, 535199));
EXPECT_EQ(event.print().buf(), "Hello, world!\n");
@@ -527,10 +530,10 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- const protos::FtraceEvent& long_print = bundle->event().Get(0);
+ const protos::gen::FtraceEvent& long_print = bundle->event()[0];
EXPECT_THAT(long_print.print().buf(), StartsWith("qwerty"));
EXPECT_THAT(long_print.print().buf(), EndsWith("ppp\n"));
- const protos::FtraceEvent& newline = bundle->event().Get(1);
+ const protos::gen::FtraceEvent& newline = bundle->event()[1];
EXPECT_EQ(newline.print().buf(), "\n");
}
@@ -579,10 +582,10 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- ASSERT_EQ(bundle->event().size(), 1);
+ ASSERT_EQ(bundle->event().size(), 1u);
// Although one field is malformed we still see data for the rest
// since we write the fields as we parse them for speed.
- const protos::FtraceEvent& event = bundle->event().Get(0);
+ const protos::gen::FtraceEvent& event = bundle->event()[0];
EXPECT_EQ(event.pid(), 28712ul);
EXPECT_TRUE(WithinOneMicrosecond(event.timestamp(), 608934, 535199));
EXPECT_EQ(event.print().buf(), "");
@@ -615,7 +618,7 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- ASSERT_EQ(bundle->event().size(), 0);
+ ASSERT_EQ(bundle->event().size(), 0u);
}
// clang-format off
@@ -684,24 +687,24 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- ASSERT_EQ(bundle->event().size(), 3);
+ ASSERT_EQ(bundle->event().size(), 3u);
{
- const protos::FtraceEvent& event = bundle->event().Get(0);
+ const protos::gen::FtraceEvent& event = bundle->event()[0];
EXPECT_EQ(event.pid(), 30693ul);
EXPECT_TRUE(WithinOneMicrosecond(event.timestamp(), 615436, 216806));
EXPECT_EQ(event.print().buf(), "Hello, world!\n");
}
{
- const protos::FtraceEvent& event = bundle->event().Get(1);
+ const protos::gen::FtraceEvent& event = bundle->event()[1];
EXPECT_EQ(event.pid(), 30693ul);
EXPECT_TRUE(WithinOneMicrosecond(event.timestamp(), 615486, 377232));
EXPECT_EQ(event.print().buf(), "Good afternoon, world!\n");
}
{
- const protos::FtraceEvent& event = bundle->event().Get(2);
+ const protos::gen::FtraceEvent& event = bundle->event()[2];
EXPECT_EQ(event.pid(), 30693ul);
EXPECT_TRUE(WithinOneMicrosecond(event.timestamp(), 615495, 632679));
EXPECT_EQ(event.print().buf(), "Goodbye, world!\n");
@@ -794,10 +797,10 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- ASSERT_EQ(bundle->event().size(), 6);
+ ASSERT_EQ(bundle->event().size(), 6u);
{
- const protos::FtraceEvent& event = bundle->event().Get(1);
+ const protos::gen::FtraceEvent& event = bundle->event()[1];
EXPECT_EQ(event.pid(), 3733ul);
EXPECT_TRUE(WithinOneMicrosecond(event.timestamp(), 1045157, 725035));
EXPECT_EQ(event.sched_switch().prev_comm(), "sleep");
@@ -842,7 +845,7 @@
// Nothing written into the proto yet:
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- EXPECT_EQ(0, bundle->event().size());
+ EXPECT_EQ(0u, bundle->event().size());
EXPECT_FALSE(bundle->has_compact_sched());
// Instead, sched switch fields were buffered:
@@ -857,28 +860,28 @@
const auto& compact_sched = bundle->compact_sched();
- EXPECT_EQ(6, compact_sched.switch_timestamp().size());
- EXPECT_EQ(6, compact_sched.switch_prev_state().size());
- EXPECT_EQ(6, compact_sched.switch_next_pid().size());
- EXPECT_EQ(6, compact_sched.switch_next_prio().size());
+ EXPECT_EQ(6u, compact_sched.switch_timestamp().size());
+ EXPECT_EQ(6u, compact_sched.switch_prev_state().size());
+ EXPECT_EQ(6u, compact_sched.switch_next_pid().size());
+ EXPECT_EQ(6u, compact_sched.switch_next_prio().size());
// 4 unique interned next_comm strings:
- EXPECT_EQ(4, compact_sched.intern_table().size());
- EXPECT_EQ(6, compact_sched.switch_next_comm_index().size());
+ EXPECT_EQ(4u, compact_sched.intern_table().size());
+ EXPECT_EQ(6u, compact_sched.switch_next_comm_index().size());
// First event exactly as expected (absolute timestamp):
- EXPECT_TRUE(
- WithinOneMicrosecond(compact_sched.switch_timestamp(0), 1045157, 722134));
- EXPECT_EQ(1, compact_sched.switch_prev_state(0));
- EXPECT_EQ(3733, compact_sched.switch_next_pid(0));
- EXPECT_EQ(120, compact_sched.switch_next_prio(0));
- std::string next_comm = compact_sched.intern_table(
- static_cast<int>(compact_sched.switch_next_comm_index(0)));
+ EXPECT_TRUE(WithinOneMicrosecond(compact_sched.switch_timestamp()[0], 1045157,
+ 722134));
+ EXPECT_EQ(1, compact_sched.switch_prev_state()[0]);
+ EXPECT_EQ(3733, compact_sched.switch_next_pid()[0]);
+ EXPECT_EQ(120, compact_sched.switch_next_prio()[0]);
+ auto comm_intern_idx = compact_sched.switch_next_comm_index()[0];
+ std::string next_comm = compact_sched.intern_table()[comm_intern_idx];
EXPECT_EQ("sleep", next_comm);
}
TEST_F(CpuReaderTableTest, ParseAllFields) {
using FakeEventProvider =
- ProtoProvider<pbzero::FakeFtraceEvent, FakeFtraceEvent>;
+ ProtoProvider<pbzero::FakeFtraceEvent, gen::FakeFtraceEvent>;
uint16_t ftrace_event_id = 102;
@@ -1067,7 +1070,7 @@
ASSERT_TRUE(event);
EXPECT_EQ(event->common_field(), 1001ul);
EXPECT_EQ(event->common_pid(), 9999ul);
- EXPECT_EQ(event->event_case(), FakeFtraceEvent::kAllFields);
+ EXPECT_TRUE(event->has_all_fields());
EXPECT_EQ(event->all_fields().field_uint32(), 1003u);
EXPECT_EQ(event->all_fields().field_pid(), 97);
EXPECT_EQ(event->all_fields().field_dev_32(),
@@ -1170,17 +1173,17 @@
// without data loss.
// So we should get three packets (each page has 1 event):
// [3 events] [1 event] [4 events].
- std::vector<protos::TracePacket> packets = trace_writer.GetAllTracePackets();
+ auto packets = trace_writer.GetAllTracePackets();
ASSERT_EQ(3u, packets.size());
EXPECT_FALSE(packets[0].ftrace_events().lost_events());
- EXPECT_EQ(3, packets[0].ftrace_events().event().size());
+ EXPECT_EQ(3u, packets[0].ftrace_events().event().size());
EXPECT_TRUE(packets[1].ftrace_events().lost_events());
- EXPECT_EQ(1, packets[1].ftrace_events().event().size());
+ EXPECT_EQ(1u, packets[1].ftrace_events().event().size());
EXPECT_TRUE(packets[2].ftrace_events().lost_events());
- EXPECT_EQ(4, packets[2].ftrace_events().event().size());
+ EXPECT_EQ(4u, packets[2].ftrace_events().event().size());
}
TEST(CpuReaderTest, TranslateBlockDeviceIDToUserspace) {
@@ -1640,7 +1643,7 @@
auto bundle = bundle_provider.ParseProto();
ASSERT_TRUE(bundle);
- EXPECT_EQ(bundle->event().size(), 59);
+ EXPECT_EQ(bundle->event().size(), 59u);
}
// clang-format off
diff --git a/src/traced/probes/ftrace/ftrace_controller_unittest.cc b/src/traced/probes/ftrace/ftrace_controller_unittest.cc
index fec3c80..1f40c83 100644
--- a/src/traced/probes/ftrace/ftrace_controller_unittest.cc
+++ b/src/traced/probes/ftrace/ftrace_controller_unittest.cc
@@ -30,9 +30,9 @@
#include "src/tracing/core/trace_writer_for_testing.h"
#include "test/gtest_and_gmock.h"
-#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.pbzero.h"
+#include "protos/perfetto/trace/ftrace/ftrace_stats.gen.h"
#include "protos/perfetto/trace/ftrace/ftrace_stats.pbzero.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
using testing::_;
@@ -49,7 +49,6 @@
using testing::UnorderedElementsAre;
using Table = perfetto::ProtoTranslationTable;
-using FtraceEventBundle = perfetto::protos::pbzero::FtraceEventBundle;
namespace perfetto {
@@ -535,8 +534,8 @@
stats.Write(out);
}
- protos::TracePacket result_packet = writer->GetOnlyTracePacket();
- auto result = result_packet.ftrace_stats().cpu_stats(0);
+ protos::gen::TracePacket result_packet = writer->GetOnlyTracePacket();
+ auto result = result_packet.ftrace_stats().cpu_stats()[0];
EXPECT_EQ(result.cpu(), 0u);
EXPECT_EQ(result.entries(), 1u);
EXPECT_EQ(result.overrun(), 2u);
diff --git a/src/traced/probes/ftrace/proto_translation_table_unittest.cc b/src/traced/probes/ftrace/proto_translation_table_unittest.cc
index f5dcf29..1ca013a 100644
--- a/src/traced/probes/ftrace/proto_translation_table_unittest.cc
+++ b/src/traced/probes/ftrace/proto_translation_table_unittest.cc
@@ -16,8 +16,6 @@
#include "src/traced/probes/ftrace/proto_translation_table.h"
-#include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
-#include "protos/perfetto/trace/ftrace/generic.pbzero.h"
#include "src/base/test/gtest_test_suite.h"
#include "src/base/test/utils.h"
#include "src/traced/probes/ftrace/compact_sched.h"
@@ -25,6 +23,9 @@
#include "src/traced/probes/ftrace/ftrace_procfs.h"
#include "test/gtest_and_gmock.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
+#include "protos/perfetto/trace/ftrace/generic.pbzero.h"
+
using testing::_;
using testing::Values;
using testing::ValuesIn;
diff --git a/src/traced/probes/packages_list/BUILD.gn b/src/traced/probes/packages_list/BUILD.gn
index b1092d1..eaee21d 100644
--- a/src/traced/probes/packages_list/BUILD.gn
+++ b/src/traced/probes/packages_list/BUILD.gn
@@ -39,7 +39,7 @@
":packages_list",
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
- "../../../../protos/perfetto/trace/android:lite",
+ "../../../../protos/perfetto/trace/android:cpp",
"../../../../protos/perfetto/trace/android:zero",
"../../../../src/base:test_support",
"../../../../src/tracing:test_support",
diff --git a/src/traced/probes/packages_list/packages_list_data_source_unittest.cc b/src/traced/probes/packages_list/packages_list_data_source_unittest.cc
index f2f7675..cb311d2 100644
--- a/src/traced/probes/packages_list/packages_list_data_source_unittest.cc
+++ b/src/traced/probes/packages_list/packages_list_data_source_unittest.cc
@@ -23,7 +23,7 @@
#include "perfetto/ext/base/pipe.h"
#include "perfetto/protozero/scattered_heap_buffer.h"
-#include "protos/perfetto/trace/android/packages_list.pb.h"
+#include "protos/perfetto/trace/android/packages_list.gen.h"
#include "protos/perfetto/trace/android/packages_list.pbzero.h"
#include "test/gtest_and_gmock.h"
@@ -100,19 +100,19 @@
ASSERT_TRUE(ParsePackagesListStream(packages_list.get(), fs, filter));
- protos::PackagesList parsed_list;
+ protos::gen::PackagesList parsed_list;
parsed_list.ParseFromString(packages_list.SerializeAsString());
EXPECT_FALSE(parsed_list.read_error());
EXPECT_FALSE(parsed_list.parse_error());
// all entries
EXPECT_EQ(parsed_list.packages_size(), 3);
- EXPECT_EQ(parsed_list.packages(0).name(), "com.test.one");
- EXPECT_EQ(parsed_list.packages(0).version_code(), 10);
- EXPECT_EQ(parsed_list.packages(1).name(), "com.test.two");
- EXPECT_EQ(parsed_list.packages(1).version_code(), 20);
- EXPECT_EQ(parsed_list.packages(2).name(), "com.test.three");
- EXPECT_EQ(parsed_list.packages(2).version_code(), 30);
+ EXPECT_EQ(parsed_list.packages()[0].name(), "com.test.one");
+ EXPECT_EQ(parsed_list.packages()[0].version_code(), 10);
+ EXPECT_EQ(parsed_list.packages()[1].name(), "com.test.two");
+ EXPECT_EQ(parsed_list.packages()[1].version_code(), 20);
+ EXPECT_EQ(parsed_list.packages()[2].name(), "com.test.three");
+ EXPECT_EQ(parsed_list.packages()[2].version_code(), 30);
}
TEST(PackagesListDataSourceTest, NameFilter) {
@@ -137,17 +137,17 @@
ASSERT_TRUE(ParsePackagesListStream(packages_list.get(), fs, filter));
- protos::PackagesList parsed_list;
+ protos::gen::PackagesList parsed_list;
parsed_list.ParseFromString(packages_list.SerializeAsString());
EXPECT_FALSE(parsed_list.read_error());
EXPECT_FALSE(parsed_list.parse_error());
// two named entries
EXPECT_EQ(parsed_list.packages_size(), 2);
- EXPECT_EQ(parsed_list.packages(0).name(), "com.test.one");
- EXPECT_EQ(parsed_list.packages(0).version_code(), 10);
- EXPECT_EQ(parsed_list.packages(1).name(), "com.test.three");
- EXPECT_EQ(parsed_list.packages(1).version_code(), 30);
+ EXPECT_EQ(parsed_list.packages()[0].name(), "com.test.one");
+ EXPECT_EQ(parsed_list.packages()[0].version_code(), 10);
+ EXPECT_EQ(parsed_list.packages()[1].name(), "com.test.three");
+ EXPECT_EQ(parsed_list.packages()[1].version_code(), 30);
}
} // namespace
diff --git a/src/traced/probes/ps/BUILD.gn b/src/traced/probes/ps/BUILD.gn
index 9918cc3..85c24bc 100644
--- a/src/traced/probes/ps/BUILD.gn
+++ b/src/traced/probes/ps/BUILD.gn
@@ -38,8 +38,8 @@
":ps",
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
- "../../../../protos/perfetto/config/process_stats:zero",
- "../../../../protos/perfetto/trace/ps:zero",
+ "../../../../protos/perfetto/config/process_stats:cpp",
+ "../../../../protos/perfetto/trace/ps:cpp",
"../../../../src/base:test_support",
"../../../../src/tracing:test_support",
]
diff --git a/src/traced/probes/ps/process_stats_data_source_unittest.cc b/src/traced/probes/ps/process_stats_data_source_unittest.cc
index c7cbd28..532a27e 100644
--- a/src/traced/probes/ps/process_stats_data_source_unittest.cc
+++ b/src/traced/probes/ps/process_stats_data_source_unittest.cc
@@ -25,10 +25,11 @@
#include "src/tracing/core/trace_writer_for_testing.h"
#include "test/gtest_and_gmock.h"
-#include "protos/perfetto/config/process_stats/process_stats_config.pbzero.h"
-#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "protos/perfetto/config/process_stats/process_stats_config.gen.h"
+#include "protos/perfetto/trace/ps/process_stats.gen.h"
+#include "protos/perfetto/trace/ps/process_tree.gen.h"
-using ::perfetto::protos::pbzero::ProcessStatsConfig;
+using ::perfetto::protos::gen::ProcessStatsConfig;
using ::testing::_;
using ::testing::ElementsAreArray;
using ::testing::Invoke;
@@ -79,11 +80,11 @@
data_source->OnPids({42});
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ auto trace = writer_raw_->GetAllTracePackets();
ASSERT_EQ(trace.size(), 1u);
auto ps_tree = trace[0].process_tree();
ASSERT_EQ(ps_tree.processes_size(), 1);
- auto first_process = ps_tree.processes(0);
+ auto first_process = ps_tree.processes()[0];
ASSERT_EQ(first_process.pid(), 42);
ASSERT_EQ(first_process.ppid(), 17);
ASSERT_EQ(first_process.uid(), 43);
@@ -93,21 +94,21 @@
TEST_F(ProcessStatsDataSourceTest, DontRescanCachedPIDsAndTIDs) {
// assertion helpers
auto expected_process = [](int pid) {
- return [pid](protos::ProcessTree::Process process) {
+ return [pid](protos::gen::ProcessTree::Process process) {
return process.pid() == pid && process.cmdline_size() > 0 &&
- process.cmdline(0) == "proc_" + std::to_string(pid);
+ process.cmdline()[0] == "proc_" + std::to_string(pid);
};
};
auto expected_thread = [](int tid) {
- return [tid](protos::ProcessTree::Thread thread) {
+ return [tid](protos::gen::ProcessTree::Thread thread) {
return thread.tid() == tid && thread.tgid() == tid / 10 * 10 &&
thread.name() == "thread_" + std::to_string(tid);
};
};
DataSourceConfig ds_config;
- protozero::HeapBuffered<ProcessStatsConfig> cfg;
- cfg->set_record_thread_names(true);
+ ProcessStatsConfig cfg;
+ cfg.set_record_thread_names(true);
ds_config.set_process_stats_config_raw(cfg.SerializeAsString());
auto data_source = GetProcessStatsDataSource(ds_config);
for (int p : {10, 11, 12, 20, 21, 22, 30, 31, 32}) {
@@ -131,7 +132,7 @@
data_source->OnPids({10, 30, 10, 31, 32});
// check written contents
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ auto trace = writer_raw_->GetAllTracePackets();
EXPECT_EQ(trace.size(), 3u);
// first packet - two unique processes, four threads
@@ -168,7 +169,7 @@
data_source->OnPids({42});
{
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ auto trace = writer_raw_->GetAllTracePackets();
ASSERT_EQ(trace.size(), 1u);
auto packet = trace[0];
// First packet in the trace has no previous state, so the clear marker is
@@ -177,9 +178,9 @@
auto ps_tree = packet.process_tree();
ASSERT_EQ(ps_tree.processes_size(), 1);
- ASSERT_EQ(ps_tree.processes(0).pid(), 42);
- ASSERT_EQ(ps_tree.processes(0).ppid(), 17);
- ASSERT_THAT(ps_tree.processes(0).cmdline(),
+ ASSERT_EQ(ps_tree.processes()[0].pid(), 42);
+ ASSERT_EQ(ps_tree.processes()[0].ppid(), 17);
+ ASSERT_THAT(ps_tree.processes()[0].cmdline(),
ElementsAreArray({"first_cmdline"}));
}
@@ -191,7 +192,7 @@
data_source->OnPids({42});
{
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ auto trace = writer_raw_->GetAllTracePackets();
ASSERT_EQ(trace.size(), 1u);
}
@@ -208,16 +209,16 @@
{
// Second packet with new proc information.
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ auto trace = writer_raw_->GetAllTracePackets();
ASSERT_EQ(trace.size(), 2u);
auto packet = trace[1];
ASSERT_TRUE(packet.incremental_state_cleared());
auto ps_tree = packet.process_tree();
ASSERT_EQ(ps_tree.processes_size(), 1);
- ASSERT_EQ(ps_tree.processes(0).pid(), 42);
- ASSERT_EQ(ps_tree.processes(0).ppid(), 18);
- ASSERT_THAT(ps_tree.processes(0).cmdline(),
+ ASSERT_EQ(ps_tree.processes()[0].pid(), 42);
+ ASSERT_EQ(ps_tree.processes()[0].ppid(), 18);
+ ASSERT_THAT(ps_tree.processes()[0].cmdline(),
ElementsAreArray({"second_cmdline"}));
}
}
@@ -225,15 +226,15 @@
TEST_F(ProcessStatsDataSourceTest, RenamePids) {
// assertion helpers
auto expected_old_process = [](int pid) {
- return [pid](protos::ProcessTree::Process process) {
+ return [pid](protos::gen::ProcessTree::Process process) {
return process.pid() == pid && process.cmdline_size() > 0 &&
- process.cmdline(0) == "proc_" + std::to_string(pid);
+ process.cmdline()[0] == "proc_" + std::to_string(pid);
};
};
auto expected_new_process = [](int pid) {
- return [pid](protos::ProcessTree::Process process) {
+ return [pid](protos::gen::ProcessTree::Process process) {
return process.pid() == pid && process.cmdline_size() > 0 &&
- process.cmdline(0) == "new_" + std::to_string(pid);
+ process.cmdline()[0] == "new_" + std::to_string(pid);
};
};
@@ -264,7 +265,7 @@
data_source->OnPids({10, 20});
// check written contents
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ auto trace = writer_raw_->GetAllTracePackets();
EXPECT_EQ(trace.size(), 3u);
// first packet - two unique processes
@@ -289,9 +290,9 @@
TEST_F(ProcessStatsDataSourceTest, ProcessStats) {
DataSourceConfig ds_config;
- protozero::HeapBuffered<ProcessStatsConfig> cfg;
- cfg->set_proc_stats_poll_ms(1);
- cfg->add_quirks(ProcessStatsConfig::DISABLE_ON_DEMAND);
+ ProcessStatsConfig cfg;
+ cfg.set_proc_stats_poll_ms(1);
+ cfg.add_quirks(ProcessStatsConfig::DISABLE_ON_DEMAND);
ds_config.set_process_stats_config_raw(cfg.SerializeAsString());
auto data_source = GetProcessStatsDataSource(ds_config);
@@ -340,8 +341,8 @@
task_runner_.RunUntilCheckpoint("all_done");
data_source->Flush(1 /* FlushRequestId */, []() {});
- std::vector<protos::ProcessStats::Process> processes;
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ std::vector<protos::gen::ProcessStats::Process> processes;
+ auto trace = writer_raw_->GetAllTracePackets();
for (const auto& packet : trace) {
for (const auto& process : packet.process_stats().processes()) {
processes.push_back(process);
@@ -368,10 +369,10 @@
TEST_F(ProcessStatsDataSourceTest, CacheProcessStats) {
DataSourceConfig ds_config;
- protozero::HeapBuffered<ProcessStatsConfig> cfg;
- cfg->set_proc_stats_poll_ms(105);
- cfg->set_proc_stats_cache_ttl_ms(220);
- cfg->add_quirks(ProcessStatsConfig::DISABLE_ON_DEMAND);
+ ProcessStatsConfig cfg;
+ cfg.set_proc_stats_poll_ms(105);
+ cfg.set_proc_stats_cache_ttl_ms(220);
+ cfg.add_quirks(ProcessStatsConfig::DISABLE_ON_DEMAND);
ds_config.set_process_stats_config_raw(cfg.SerializeAsString());
auto data_source = GetProcessStatsDataSource(ds_config);
@@ -411,8 +412,8 @@
task_runner_.RunUntilCheckpoint("all_done");
data_source->Flush(1 /* FlushRequestId */, []() {});
- std::vector<protos::ProcessStats::Process> processes;
- std::vector<protos::TracePacket> trace = writer_raw_->GetAllTracePackets();
+ std::vector<protos::gen::ProcessStats::Process> processes;
+ auto trace = writer_raw_->GetAllTracePackets();
for (const auto& packet : trace) {
for (const auto& process : packet.process_stats().processes()) {
processes.push_back(process);
diff --git a/src/traced/probes/sys_stats/BUILD.gn b/src/traced/probes/sys_stats/BUILD.gn
index c7fa58b..efea7a9 100644
--- a/src/traced/probes/sys_stats/BUILD.gn
+++ b/src/traced/probes/sys_stats/BUILD.gn
@@ -40,10 +40,8 @@
":sys_stats",
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
- "../../../../protos/perfetto/common:zero",
- "../../../../protos/perfetto/config:zero",
- "../../../../protos/perfetto/config/sys_stats:zero",
- "../../../../protos/perfetto/trace/sys_stats:zero",
+ "../../../../protos/perfetto/config/sys_stats:cpp",
+ "../../../../protos/perfetto/trace/sys_stats:cpp",
"../../../../src/base:test_support",
"../../../../src/tracing:test_support",
]
diff --git a/src/traced/probes/sys_stats/sys_stats_data_source_unittest.cc b/src/traced/probes/sys_stats/sys_stats_data_source_unittest.cc
index c760f41..49af8a4 100644
--- a/src/traced/probes/sys_stats/sys_stats_data_source_unittest.cc
+++ b/src/traced/probes/sys_stats/sys_stats_data_source_unittest.cc
@@ -17,16 +17,15 @@
#include <unistd.h>
#include "perfetto/ext/base/temp_file.h"
-#include "perfetto/protozero/scattered_heap_buffer.h"
#include "src/base/test/test_task_runner.h"
#include "src/traced/probes/sys_stats/sys_stats_data_source.h"
#include "src/tracing/core/trace_writer_for_testing.h"
#include "test/gtest_and_gmock.h"
-#include "protos/perfetto/common/sys_stats_counters.pbzero.h"
-#include "protos/perfetto/config/data_source_config.pbzero.h"
-#include "protos/perfetto/config/sys_stats/sys_stats_config.pbzero.h"
-#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "protos/perfetto/common/sys_stats_counters.gen.h"
+#include "protos/perfetto/config/data_source_config.gen.h"
+#include "protos/perfetto/config/sys_stats/sys_stats_config.gen.h"
+#include "protos/perfetto/trace/sys_stats/sys_stats.gen.h"
using ::testing::_;
using ::testing::Invoke;
@@ -233,21 +232,21 @@
};
TEST_F(SysStatsDataSourceTest, Meminfo) {
- using C = protos::pbzero::MeminfoCounters;
+ using C = protos::gen::MeminfoCounters;
DataSourceConfig config;
- protozero::HeapBuffered<protos::pbzero::SysStatsConfig> sys_cfg;
- sys_cfg->set_meminfo_period_ms(10);
- sys_cfg->add_meminfo_counters(C::MEMINFO_MEM_TOTAL);
- sys_cfg->add_meminfo_counters(C::MEMINFO_MEM_FREE);
- sys_cfg->add_meminfo_counters(C::MEMINFO_ACTIVE_ANON);
- sys_cfg->add_meminfo_counters(C::MEMINFO_INACTIVE_FILE);
- sys_cfg->add_meminfo_counters(C::MEMINFO_CMA_FREE);
+ protos::gen::SysStatsConfig sys_cfg;
+ sys_cfg.set_meminfo_period_ms(10);
+ sys_cfg.add_meminfo_counters(C::MEMINFO_MEM_TOTAL);
+ sys_cfg.add_meminfo_counters(C::MEMINFO_MEM_FREE);
+ sys_cfg.add_meminfo_counters(C::MEMINFO_ACTIVE_ANON);
+ sys_cfg.add_meminfo_counters(C::MEMINFO_INACTIVE_FILE);
+ sys_cfg.add_meminfo_counters(C::MEMINFO_CMA_FREE);
config.set_sys_stats_config_raw(sys_cfg.SerializeAsString());
auto data_source = GetSysStatsDataSource(config);
WaitTick(data_source.get());
- protos::TracePacket packet = writer_raw_->GetOnlyTracePacket();
+ protos::gen::TracePacket packet = writer_raw_->GetOnlyTracePacket();
ASSERT_TRUE(packet.has_sys_stats());
const auto& sys_stats = packet.sys_stats();
EXPECT_EQ(sys_stats.vmstat_size(), 0);
@@ -268,14 +267,14 @@
TEST_F(SysStatsDataSourceTest, MeminfoAll) {
DataSourceConfig config;
- protozero::HeapBuffered<protos::pbzero::SysStatsConfig> sys_cfg;
- sys_cfg->set_meminfo_period_ms(10);
+ protos::gen::SysStatsConfig sys_cfg;
+ sys_cfg.set_meminfo_period_ms(10);
config.set_sys_stats_config_raw(sys_cfg.SerializeAsString());
auto data_source = GetSysStatsDataSource(config);
WaitTick(data_source.get());
- protos::TracePacket packet = writer_raw_->GetOnlyTracePacket();
+ protos::gen::TracePacket packet = writer_raw_->GetOnlyTracePacket();
ASSERT_TRUE(packet.has_sys_stats());
const auto& sys_stats = packet.sys_stats();
EXPECT_EQ(sys_stats.vmstat_size(), 0);
@@ -284,19 +283,19 @@
}
TEST_F(SysStatsDataSourceTest, Vmstat) {
- using C = protos::pbzero::VmstatCounters;
+ using C = protos::gen::VmstatCounters;
DataSourceConfig config;
- protozero::HeapBuffered<protos::pbzero::SysStatsConfig> sys_cfg;
- sys_cfg->set_vmstat_period_ms(10);
- sys_cfg->add_vmstat_counters(C::VMSTAT_NR_FREE_PAGES);
- sys_cfg->add_vmstat_counters(C::VMSTAT_PGACTIVATE);
- sys_cfg->add_vmstat_counters(C::VMSTAT_PGMIGRATE_FAIL);
+ protos::gen::SysStatsConfig sys_cfg;
+ sys_cfg.set_vmstat_period_ms(10);
+ sys_cfg.add_vmstat_counters(C::VMSTAT_NR_FREE_PAGES);
+ sys_cfg.add_vmstat_counters(C::VMSTAT_PGACTIVATE);
+ sys_cfg.add_vmstat_counters(C::VMSTAT_PGMIGRATE_FAIL);
config.set_sys_stats_config_raw(sys_cfg.SerializeAsString());
auto data_source = GetSysStatsDataSource(config);
WaitTick(data_source.get());
- protos::TracePacket packet = writer_raw_->GetOnlyTracePacket();
+ protos::gen::TracePacket packet = writer_raw_->GetOnlyTracePacket();
ASSERT_TRUE(packet.has_sys_stats());
const auto& sys_stats = packet.sys_stats();
EXPECT_EQ(sys_stats.meminfo_size(), 0);
@@ -314,14 +313,14 @@
TEST_F(SysStatsDataSourceTest, VmstatAll) {
DataSourceConfig config;
- protozero::HeapBuffered<protos::pbzero::SysStatsConfig> sys_cfg;
- sys_cfg->set_vmstat_period_ms(10);
+ protos::gen::SysStatsConfig sys_cfg;
+ sys_cfg.set_vmstat_period_ms(10);
config.set_sys_stats_config_raw(sys_cfg.SerializeAsString());
auto data_source = GetSysStatsDataSource(config);
WaitTick(data_source.get());
- protos::TracePacket packet = writer_raw_->GetOnlyTracePacket();
+ protos::gen::TracePacket packet = writer_raw_->GetOnlyTracePacket();
ASSERT_TRUE(packet.has_sys_stats());
const auto& sys_stats = packet.sys_stats();
EXPECT_EQ(sys_stats.meminfo_size(), 0);
@@ -331,57 +330,56 @@
TEST_F(SysStatsDataSourceTest, StatAll) {
DataSourceConfig config;
- protozero::HeapBuffered<protos::pbzero::SysStatsConfig> sys_cfg;
- sys_cfg->set_stat_period_ms(10);
+ protos::gen::SysStatsConfig sys_cfg;
+ sys_cfg.set_stat_period_ms(10);
config.set_sys_stats_config_raw(sys_cfg.SerializeAsString());
auto data_source = GetSysStatsDataSource(config);
WaitTick(data_source.get());
- protos::TracePacket packet = writer_raw_->GetOnlyTracePacket();
+ protos::gen::TracePacket packet = writer_raw_->GetOnlyTracePacket();
ASSERT_TRUE(packet.has_sys_stats());
const auto& sys_stats = packet.sys_stats();
EXPECT_EQ(sys_stats.meminfo_size(), 0);
EXPECT_EQ(sys_stats.vmstat_size(), 0);
ASSERT_EQ(sys_stats.cpu_stat_size(), 8);
- EXPECT_EQ(sys_stats.cpu_stat(0).user_ns(), 762178 * 10000000ull);
- EXPECT_EQ(sys_stats.cpu_stat(0).system_mode_ns(), 902284 * 10000000ull);
- EXPECT_EQ(sys_stats.cpu_stat(0).softirq_ns(), 68262 * 10000000ull);
- EXPECT_EQ(sys_stats.cpu_stat(7).user_ns(), 180484 * 10000000ull);
- EXPECT_EQ(sys_stats.cpu_stat(7).system_mode_ns(), 139874 * 10000000ull);
- EXPECT_EQ(sys_stats.cpu_stat(7).softirq_ns(), 13407 * 10000000ull);
+ EXPECT_EQ(sys_stats.cpu_stat()[0].user_ns(), 762178 * 10000000ull);
+ EXPECT_EQ(sys_stats.cpu_stat()[0].system_mode_ns(), 902284 * 10000000ull);
+ EXPECT_EQ(sys_stats.cpu_stat()[0].softirq_ns(), 68262 * 10000000ull);
+ EXPECT_EQ(sys_stats.cpu_stat()[7].user_ns(), 180484 * 10000000ull);
+ EXPECT_EQ(sys_stats.cpu_stat()[7].system_mode_ns(), 139874 * 10000000ull);
+ EXPECT_EQ(sys_stats.cpu_stat()[7].softirq_ns(), 13407 * 10000000ull);
EXPECT_EQ(sys_stats.num_forks(), 243320u);
EXPECT_EQ(sys_stats.num_irq_total(), 238128517u);
ASSERT_EQ(sys_stats.num_irq_size(), 102);
- EXPECT_EQ(sys_stats.num_irq(0).count(), 63500984u);
- EXPECT_EQ(sys_stats.num_irq(0).irq(), 3);
- EXPECT_EQ(sys_stats.num_irq(1).count(), 6253792u);
- EXPECT_EQ(sys_stats.num_irq(1).irq(), 5);
- EXPECT_EQ(sys_stats.num_irq(101).count(), 680u);
+ EXPECT_EQ(sys_stats.num_irq()[0].count(), 63500984u);
+ EXPECT_EQ(sys_stats.num_irq()[0].irq(), 3);
+ EXPECT_EQ(sys_stats.num_irq()[1].count(), 6253792u);
+ EXPECT_EQ(sys_stats.num_irq()[1].irq(), 5);
+ EXPECT_EQ(sys_stats.num_irq()[101].count(), 680u);
EXPECT_EQ(sys_stats.num_softirq_total(), 84611084u);
ASSERT_EQ(sys_stats.num_softirq_size(), 10);
- EXPECT_EQ(sys_stats.num_softirq(0).count(), 10220177u);
- EXPECT_EQ(sys_stats.num_softirq(9).count(), 16443195u);
+ EXPECT_EQ(sys_stats.num_softirq()[0].count(), 10220177u);
+ EXPECT_EQ(sys_stats.num_softirq()[9].count(), 16443195u);
EXPECT_EQ(sys_stats.num_softirq_total(), 84611084u);
}
TEST_F(SysStatsDataSourceTest, StatForksOnly) {
- using C = protos::SysStatsConfig;
- protos::DataSourceConfig config;
- config.mutable_sys_stats_config()->set_stat_period_ms(10);
- config.mutable_sys_stats_config()->add_stat_counters(C::STAT_FORK_COUNT);
+ protos::gen::SysStatsConfig cfg;
+ cfg.set_stat_period_ms(10);
+ cfg.add_stat_counters(protos::gen::SysStatsConfig::STAT_FORK_COUNT);
DataSourceConfig config_obj;
- config_obj.FromProto(config);
+ config_obj.set_sys_stats_config_raw(cfg.SerializeAsString());
auto data_source = GetSysStatsDataSource(config_obj);
WaitTick(data_source.get());
- protos::TracePacket packet = writer_raw_->GetOnlyTracePacket();
+ protos::gen::TracePacket packet = writer_raw_->GetOnlyTracePacket();
ASSERT_TRUE(packet.has_sys_stats());
const auto& sys_stats = packet.sys_stats();
EXPECT_EQ(sys_stats.meminfo_size(), 0);
diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn
index 0df9483..8e3f06a 100644
--- a/src/tracing/BUILD.gn
+++ b/src/tracing/BUILD.gn
@@ -69,7 +69,6 @@
public_deps = [
"../../include/perfetto/base",
"../../include/perfetto/ext/tracing/core",
- "../../protos/perfetto/common:lite",
]
deps = [
":tracing",
@@ -89,9 +88,9 @@
":tracing",
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
- "../../protos/perfetto/config:lite",
- "../../protos/perfetto/trace:lite",
+ "../../protos/perfetto/trace:cpp",
"../../protos/perfetto/trace:zero",
+ "../../protos/perfetto/trace/ftrace:cpp",
"../base",
"../base:test_support",
]
@@ -141,7 +140,7 @@
testonly = true
public_deps = [
"../../include/perfetto/ext/tracing/core",
- "../../protos/perfetto/trace:lite",
+ "../../protos/perfetto/trace:cpp",
"../../protos/perfetto/trace:zero",
"../protozero",
]
@@ -153,12 +152,15 @@
if (perfetto_build_standalone || perfetto_build_with_android) {
executable("consumer_api_test") {
+ testonly = true
deps = [
":consumer_api_deprecated",
"../../gn:default_deps",
"../../include/perfetto/public",
- "../../protos/perfetto/config:lite",
- "../../protos/perfetto/trace:lite",
+ "../../protos/perfetto/config:cpp",
+ "../../protos/perfetto/config/ftrace:cpp",
+ "../../protos/perfetto/trace:cpp",
+ "../../protos/perfetto/trace/ftrace:cpp",
"../base",
]
sources = [
@@ -292,9 +294,12 @@
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
"../../include/perfetto/tracing/core",
- "../../protos/perfetto/trace:lite",
+ "../../protos/perfetto/trace:cpp",
"../../protos/perfetto/trace:zero",
+ "../../protos/perfetto/trace/interned_data:cpp",
"../../protos/perfetto/trace/interned_data:zero",
+ "../../protos/perfetto/trace/profiling:cpp",
+ "../../protos/perfetto/trace/track_event:cpp",
"../base",
"test:api_test_support",
]
diff --git a/src/tracing/api_impl/consumer_api_test.cc b/src/tracing/api_impl/consumer_api_test.cc
index 220d72d..ebc885a 100644
--- a/src/tracing/api_impl/consumer_api_test.cc
+++ b/src/tracing/api_impl/consumer_api_test.cc
@@ -24,8 +24,13 @@
#include "perfetto/base/logging.h"
#include "perfetto/public/consumer_api.h"
-#include "protos/perfetto/config/trace_config.pb.h"
-#include "protos/perfetto/trace/trace.pb.h"
+#include "protos/perfetto/config/data_source_config.gen.h"
+#include "protos/perfetto/config/ftrace/ftrace_config.gen.h"
+#include "protos/perfetto/config/trace_config.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
using namespace perfetto::consumer;
@@ -34,24 +39,25 @@
int g_pointer = 0;
std::string GetConfig(uint32_t duration_ms) {
- perfetto::protos::TraceConfig trace_config;
+ perfetto::protos::gen::TraceConfig trace_config;
trace_config.set_duration_ms(duration_ms);
trace_config.add_buffers()->set_size_kb(4096);
trace_config.set_deferred_start(true);
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("linux.ftrace");
- ds_config->mutable_ftrace_config()->add_ftrace_events("sched_switch");
- ds_config->mutable_ftrace_config()->add_ftrace_events(
- "mm_filemap_add_to_page_cache");
- ds_config->mutable_ftrace_config()->add_ftrace_events(
- "mm_filemap_delete_from_page_cache");
+
+ perfetto::protos::gen::FtraceConfig ftrace_config;
+ ftrace_config.add_ftrace_events("sched_switch");
+ ftrace_config.add_ftrace_events("mm_filemap_add_to_page_cache");
+ ftrace_config.add_ftrace_events("mm_filemap_delete_from_page_cache");
+ ds_config->set_ftrace_config_raw(ftrace_config.SerializeAsString());
ds_config->set_target_buffer(0);
return trace_config.SerializeAsString();
}
void DumpTrace(TraceBuffer buf) {
- perfetto::protos::Trace trace;
- bool parsed = trace.ParseFromArray(buf.begin, static_cast<int>(buf.size));
+ perfetto::protos::gen::Trace trace;
+ bool parsed = trace.ParseFromArray(buf.begin, buf.size);
if (!parsed) {
PERFETTO_ELOG("Failed to parse the trace");
return;
diff --git a/src/tracing/api_integrationtest.cc b/src/tracing/api_integrationtest.cc
index 7840a53..afb03cc 100644
--- a/src/tracing/api_integrationtest.cc
+++ b/src/tracing/api_integrationtest.cc
@@ -24,14 +24,6 @@
#include <vector>
#include "perfetto/tracing.h"
-#include "protos/perfetto/trace/clock_snapshot.pbzero.h"
-#include "protos/perfetto/trace/interned_data/interned_data.pbzero.h"
-#include "protos/perfetto/trace/test_event.pbzero.h"
-#include "protos/perfetto/trace/trace.pb.h"
-#include "protos/perfetto/trace/trace_packet.pbzero.h"
-#include "protos/perfetto/trace/track_event/debug_annotation.pbzero.h"
-#include "protos/perfetto/trace/track_event/log_message.pbzero.h"
-#include "protos/perfetto/trace/track_event/source_location.pbzero.h"
#include "test/gtest_and_gmock.h"
// Deliberately not pulling any non-public perfetto header to spot accidental
@@ -45,6 +37,29 @@
#include "perfetto/tracing/core/data_source_descriptor.h"
#include "perfetto/tracing/core/trace_config.h"
+// xxx.pbzero.h includes are for the writing path (the code that pretends to be
+// production code).
+// yyy.gen.h includes are for the test readback path (the code in the test that
+// checks that the results are valid).
+#include "protos/perfetto/trace/clock_snapshot.pbzero.h"
+#include "protos/perfetto/trace/interned_data/interned_data.gen.h"
+#include "protos/perfetto/trace/interned_data/interned_data.pbzero.h"
+#include "protos/perfetto/trace/profiling/profile_common.gen.h"
+#include "protos/perfetto/trace/test_event.gen.h"
+#include "protos/perfetto/trace/test_event.pbzero.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
+#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "protos/perfetto/trace/track_event/debug_annotation.gen.h"
+#include "protos/perfetto/trace/track_event/debug_annotation.pbzero.h"
+#include "protos/perfetto/trace/track_event/log_message.gen.h"
+#include "protos/perfetto/trace/track_event/log_message.pbzero.h"
+#include "protos/perfetto/trace/track_event/process_descriptor.gen.h"
+#include "protos/perfetto/trace/track_event/source_location.gen.h"
+#include "protos/perfetto/trace/track_event/source_location.pbzero.h"
+#include "protos/perfetto/trace/track_event/thread_descriptor.gen.h"
+#include "protos/perfetto/trace/track_event/track_event.gen.h"
+
// Trace categories used in the tests.
PERFETTO_DEFINE_CATEGORIES(PERFETTO_CATEGORY(test),
PERFETTO_CATEGORY(foo),
@@ -267,10 +282,10 @@
// Read back the trace, maintaining interning tables as we go.
std::vector<std::string> log_messages;
std::map<uint64_t, std::string> log_message_bodies;
- std::map<uint64_t, perfetto::protos::SourceLocation> source_locations;
- perfetto::protos::Trace parsed_trace;
+ std::map<uint64_t, perfetto::protos::gen::SourceLocation> source_locations;
+ perfetto::protos::gen::Trace parsed_trace;
EXPECT_TRUE(
- parsed_trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ parsed_trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
for (const auto& packet : parsed_trace.packet()) {
if (!packet.has_track_event())
@@ -291,7 +306,8 @@
}
}
const auto& track_event = packet.track_event();
- if (track_event.type() != perfetto::protos::TrackEvent::TYPE_SLICE_BEGIN)
+ if (track_event.type() !=
+ perfetto::protos::gen::TrackEvent::TYPE_SLICE_BEGIN)
continue;
EXPECT_TRUE(track_event.has_log_message());
@@ -322,9 +338,9 @@
std::map<uint64_t, std::string> categories;
std::map<uint64_t, std::string> event_names;
std::map<uint64_t, std::string> debug_annotation_names;
- perfetto::protos::Trace parsed_trace;
+ perfetto::protos::gen::Trace parsed_trace;
EXPECT_TRUE(
- parsed_trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ parsed_trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
bool incremental_state_was_cleared = false;
uint32_t sequence_id = 0;
@@ -366,20 +382,20 @@
const auto& track_event = packet.track_event();
std::string slice;
switch (track_event.type()) {
- case perfetto::protos::TrackEvent::TYPE_SLICE_BEGIN:
+ case perfetto::protos::gen::TrackEvent::TYPE_SLICE_BEGIN:
slice += "B";
break;
- case perfetto::protos::TrackEvent::TYPE_SLICE_END:
+ case perfetto::protos::gen::TrackEvent::TYPE_SLICE_END:
slice += "E";
break;
- case perfetto::protos::TrackEvent::TYPE_INSTANT:
+ case perfetto::protos::gen::TrackEvent::TYPE_INSTANT:
slice += "I";
break;
default:
- case perfetto::protos::TrackEvent::TYPE_UNSPECIFIED:
+ case perfetto::protos::gen::TrackEvent::TYPE_UNSPECIFIED:
EXPECT_FALSE(track_event.type());
}
- slice += ":" + categories[track_event.category_iids().Get(0)] + "." +
+ slice += ":" + categories[track_event.category_iids()[0]] + "." +
event_names[track_event.name_iid()];
if (track_event.debug_annotations_size()) {
@@ -533,10 +549,10 @@
ASSERT_GE(raw_trace.size(), 0u);
// Read back the trace, maintaining interning tables as we go.
- perfetto::protos::Trace trace;
+ perfetto::protos::gen::Trace trace;
std::map<uint64_t, std::string> categories;
std::map<uint64_t, std::string> event_names;
- ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
bool incremental_state_was_cleared = false;
bool begin_found = false;
@@ -601,19 +617,20 @@
perfetto::protos::pbzero::ClockSnapshot::Clock::MONOTONIC;
EXPECT_EQ(packet.timestamp_clock_id(), kClockMonotonic);
#endif
- EXPECT_EQ(track_event.category_iids().size(), 1);
- EXPECT_GE(track_event.category_iids().Get(0), 1u);
+ EXPECT_EQ(track_event.category_iids().size(), 1u);
+ EXPECT_GE(track_event.category_iids()[0], 1u);
- if (track_event.type() == perfetto::protos::TrackEvent::TYPE_SLICE_BEGIN) {
+ if (track_event.type() ==
+ perfetto::protos::gen::TrackEvent::TYPE_SLICE_BEGIN) {
EXPECT_FALSE(begin_found);
- EXPECT_EQ("test", categories[track_event.category_iids().Get(0)]);
+ EXPECT_EQ("test", categories[track_event.category_iids()[0]]);
EXPECT_EQ("TestEvent", event_names[track_event.name_iid()]);
begin_found = true;
} else if (track_event.type() ==
- perfetto::protos::TrackEvent::TYPE_SLICE_END) {
+ perfetto::protos::gen::TrackEvent::TYPE_SLICE_END) {
EXPECT_FALSE(end_found);
EXPECT_EQ(0u, track_event.name_iid());
- EXPECT_EQ("test", categories[track_event.category_iids().Get(0)]);
+ EXPECT_EQ("test", categories[track_event.category_iids()[0]]);
end_found = true;
}
}
@@ -734,9 +751,8 @@
EXPECT_THAT(trace, HasSubstr("FooEventFromModule2"));
EXPECT_THAT(trace, Not(HasSubstr("DisabledEventFromModule2")));
- perfetto::protos::Trace parsed_trace;
- ASSERT_TRUE(
- parsed_trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ perfetto::protos::gen::Trace parsed_trace;
+ ASSERT_TRUE(parsed_trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
uint32_t sequence_id = 0;
for (const auto& packet : parsed_trace.packet()) {
@@ -841,16 +857,16 @@
std::vector<char> raw_trace = tracing_session->get()->ReadTraceBlocking();
std::string trace(raw_trace.data(), raw_trace.size());
- perfetto::protos::Trace parsed_trace;
- ASSERT_TRUE(
- parsed_trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ perfetto::protos::gen::Trace parsed_trace;
+ ASSERT_TRUE(parsed_trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
bool found_args = false;
for (const auto& packet : parsed_trace.packet()) {
if (!packet.has_track_event())
continue;
const auto& track_event = packet.track_event();
- if (track_event.type() != perfetto::protos::TrackEvent::TYPE_SLICE_BEGIN)
+ if (track_event.type() !=
+ perfetto::protos::gen::TrackEvent::TYPE_SLICE_BEGIN)
continue;
EXPECT_TRUE(track_event.has_log_message());
@@ -858,7 +874,7 @@
EXPECT_EQ(1u, log.source_location_iid());
EXPECT_EQ(2u, log.body_iid());
- const auto& dbg = track_event.debug_annotations().Get(0);
+ const auto& dbg = track_event.debug_annotations()[0];
EXPECT_EQ("random", dbg.name());
EXPECT_EQ(random_value, dbg.int_value());
@@ -1378,8 +1394,8 @@
std::vector<char> raw_trace = tracing_session->get()->ReadTraceBlocking();
ASSERT_GE(raw_trace.size(), 0u);
- perfetto::protos::Trace trace;
- ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ perfetto::protos::gen::Trace trace;
+ ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
bool test_packet_found = false;
for (const auto& packet : trace.packet()) {
if (!packet.has_for_testing())
@@ -1489,8 +1505,8 @@
// Check the contents of the trace.
std::vector<char> raw_trace = tracing_session->get()->ReadTraceBlocking();
ASSERT_GE(raw_trace.size(), 0u);
- perfetto::protos::Trace trace;
- ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ perfetto::protos::gen::Trace trace;
+ ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
int test_packet_found = 0;
for (const auto& packet : trace.packet()) {
if (!packet.has_for_testing())
@@ -1666,8 +1682,8 @@
std::vector<char> raw_trace = tracing_session->get()->ReadTraceBlocking();
ASSERT_GE(raw_trace.size(), 0u);
- perfetto::protos::Trace trace;
- ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), int(raw_trace.size())));
+ perfetto::protos::gen::Trace trace;
+ ASSERT_TRUE(trace.ParseFromArray(raw_trace.data(), raw_trace.size()));
int packets_found = 0;
for (const auto& packet : trace.packet()) {
if (!packet.has_for_testing())
diff --git a/src/tracing/core/packet_stream_validator_unittest.cc b/src/tracing/core/packet_stream_validator_unittest.cc
index bdb8ffd..fab2a60 100644
--- a/src/tracing/core/packet_stream_validator_unittest.cc
+++ b/src/tracing/core/packet_stream_validator_unittest.cc
@@ -18,7 +18,11 @@
#include <string>
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h"
+#include "protos/perfetto/trace/ftrace/sched.gen.h"
+#include "protos/perfetto/trace/test_event.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
#include "test/gtest_and_gmock.h"
namespace perfetto {
@@ -31,7 +35,7 @@
}
TEST(PacketStreamValidatorTest, SimplePacket) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
std::string ser_buf = proto.SerializeAsString();
@@ -41,7 +45,7 @@
}
TEST(PacketStreamValidatorTest, ComplexPacket) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
proto.mutable_ftrace_events()->set_cpu(0);
auto* ft = proto.mutable_ftrace_events()->add_event();
@@ -58,7 +62,7 @@
}
TEST(PacketStreamValidatorTest, SimplePacketWithUid) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.set_trusted_uid(123);
std::string ser_buf = proto.SerializeAsString();
@@ -68,7 +72,7 @@
}
TEST(PacketStreamValidatorTest, SimplePacketWithZeroUid) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.set_trusted_uid(0);
std::string ser_buf = proto.SerializeAsString();
@@ -78,7 +82,7 @@
}
TEST(PacketStreamValidatorTest, SimplePacketWithNegativeOneUid) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.set_trusted_uid(-1);
std::string ser_buf = proto.SerializeAsString();
@@ -88,7 +92,7 @@
}
TEST(PacketStreamValidatorTest, ComplexPacketWithUid) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
proto.mutable_ftrace_events()->set_cpu(0);
auto* ft = proto.mutable_ftrace_events()->add_event();
@@ -106,7 +110,7 @@
}
TEST(PacketStreamValidatorTest, FragmentedPacket) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
proto.mutable_ftrace_events()->set_cpu(0);
auto* ft = proto.mutable_ftrace_events()->add_event();
@@ -126,7 +130,7 @@
}
TEST(PacketStreamValidatorTest, FragmentedPacketWithUid) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
proto.set_trusted_uid(123);
proto.mutable_ftrace_events()->set_cpu(0);
@@ -148,7 +152,7 @@
}
TEST(PacketStreamValidatorTest, TruncatedPacket) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
std::string ser_buf = proto.SerializeAsString();
@@ -160,7 +164,7 @@
}
TEST(PacketStreamValidatorTest, TrailingGarbage) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
std::string ser_buf = proto.SerializeAsString();
ser_buf += "bike is short for bichael";
diff --git a/src/tracing/core/startup_trace_writer_unittest.cc b/src/tracing/core/startup_trace_writer_unittest.cc
index a7cd419..3942124 100644
--- a/src/tracing/core/startup_trace_writer_unittest.cc
+++ b/src/tracing/core/startup_trace_writer_unittest.cc
@@ -28,8 +28,9 @@
#include "src/tracing/test/fake_producer_endpoint.h"
#include "test/gtest_and_gmock.h"
+#include "protos/perfetto/trace/test_event.gen.h"
#include "protos/perfetto/trace/test_event.pbzero.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto {
@@ -146,7 +147,7 @@
EXPECT_EQ(static_cast<uid_t>(1),
sequence_properties.producer_uid_trusted);
- protos::TracePacket parsed_packet;
+ protos::gen::TracePacket parsed_packet;
bool res = parsed_packet.ParseFromString(packet.GetRawBytesForTesting());
EXPECT_TRUE(res);
if (!res)
diff --git a/src/tracing/core/trace_packet_unittest.cc b/src/tracing/core/trace_packet_unittest.cc
index 57d6631..72f4215 100644
--- a/src/tracing/core/trace_packet_unittest.cc
+++ b/src/tracing/core/trace_packet_unittest.cc
@@ -18,15 +18,16 @@
#include <string>
-#include "protos/perfetto/trace/trace.pb.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/test_event.gen.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
#include "test/gtest_and_gmock.h"
namespace perfetto {
namespace {
TEST(TracePacketTest, Simple) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
std::string ser_buf = proto.SerializeAsString();
TracePacket tp;
@@ -37,13 +38,13 @@
ASSERT_EQ(ser_buf.size(), slice->size);
ASSERT_EQ(tp.slices().end(), ++slice);
- protos::TracePacket decoded_packet;
+ protos::gen::TracePacket decoded_packet;
ASSERT_TRUE(decoded_packet.ParseFromString(tp.GetRawBytesForTesting()));
ASSERT_EQ(proto.for_testing().str(), decoded_packet.for_testing().str());
}
TEST(TracePacketTest, Sliced) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str(
"this is an arbitrarily long string ........................");
std::string ser_buf = proto.SerializeAsString();
@@ -68,18 +69,18 @@
ASSERT_EQ(tp.slices().end(), ++slice);
- protos::TracePacket decoded_packet;
+ protos::gen::TracePacket decoded_packet;
ASSERT_TRUE(decoded_packet.ParseFromString(tp.GetRawBytesForTesting()));
ASSERT_EQ(proto.for_testing().str(), decoded_packet.for_testing().str());
}
TEST(TracePacketTest, Corrupted) {
- protos::TracePacket proto;
+ protos::gen::TracePacket proto;
proto.mutable_for_testing()->set_str("string field");
std::string ser_buf = proto.SerializeAsString();
TracePacket tp;
tp.AddSlice({ser_buf.data(), ser_buf.size() - 2}); // corrupted.
- protos::TracePacket decoded_packet;
+ protos::gen::TracePacket decoded_packet;
ASSERT_FALSE(decoded_packet.ParseFromString(tp.GetRawBytesForTesting()));
}
@@ -96,7 +97,7 @@
ASSERT_EQ(0, preamble[1]);
// Test packet with one slice.
- protos::TracePacket tp_proto;
+ protos::gen::TracePacket tp_proto;
char payload[257];
for (size_t i = 0; i < sizeof(payload) - 1; i++)
payload[i] = 'a' + (i % 16);
@@ -113,11 +114,10 @@
memcpy(buf, preamble, preamble_size);
ASSERT_EQ(1u, tp.slices().size());
memcpy(&buf[preamble_size], tp.slices()[0].start, tp.slices()[0].size);
- protos::Trace trace;
- ASSERT_TRUE(
- trace.ParseFromArray(buf, static_cast<int>(preamble_size + tp.size())));
+ protos::gen::Trace trace;
+ ASSERT_TRUE(trace.ParseFromArray(buf, preamble_size + tp.size()));
ASSERT_EQ(1, trace.packet_size());
- ASSERT_EQ(payload, trace.packet(0).for_testing().str());
+ ASSERT_EQ(payload, trace.packet()[0].for_testing().str());
}
TEST(TracePacketTest, MoveOperators) {
diff --git a/src/tracing/core/trace_writer_for_testing.cc b/src/tracing/core/trace_writer_for_testing.cc
index 98544b8..838f93e 100644
--- a/src/tracing/core/trace_writer_for_testing.cc
+++ b/src/tracing/core/trace_writer_for_testing.cc
@@ -19,9 +19,7 @@
#include "perfetto/base/logging.h"
#include "perfetto/ext/base/utils.h"
#include "perfetto/protozero/message.h"
-#include "protos/perfetto/trace/trace.pb.h"
#include "protos/perfetto/trace/trace.pbzero.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto {
@@ -45,22 +43,24 @@
callback();
}
-std::vector<protos::TracePacket> TraceWriterForTesting::GetAllTracePackets() {
+std::vector<protos::gen::TracePacket>
+TraceWriterForTesting::GetAllTracePackets() {
PERFETTO_CHECK(cur_packet_->is_finalized());
- auto trace = protos::Trace();
std::vector<uint8_t> buffer = delegate_.StitchSlices();
- if (!trace.ParseFromArray(buffer.data(), static_cast<int>(buffer.size())))
- return {};
-
- std::vector<protos::TracePacket> ret;
- for (const auto& packet : trace.packet()) {
- ret.emplace_back(packet);
+ protozero::ProtoDecoder trace(buffer.data(), buffer.size());
+ std::vector<protos::gen::TracePacket> ret;
+ for (auto fld = trace.ReadField(); fld.valid(); fld = trace.ReadField()) {
+ PERFETTO_CHECK(fld.id() == protos::pbzero::Trace::kPacketFieldNumber);
+ protos::gen::TracePacket packet;
+ packet.ParseFromArray(fld.data(), fld.size());
+ ret.emplace_back(std::move(packet));
}
+ PERFETTO_CHECK(trace.bytes_left() == 0);
return ret;
}
-protos::TracePacket TraceWriterForTesting::GetOnlyTracePacket() {
+protos::gen::TracePacket TraceWriterForTesting::GetOnlyTracePacket() {
auto packets = GetAllTracePackets();
PERFETTO_CHECK(packets.size() == 1);
return packets[0];
diff --git a/src/tracing/core/trace_writer_for_testing.h b/src/tracing/core/trace_writer_for_testing.h
index b71f605..f066fee 100644
--- a/src/tracing/core/trace_writer_for_testing.h
+++ b/src/tracing/core/trace_writer_for_testing.h
@@ -21,7 +21,7 @@
#include "perfetto/ext/tracing/core/trace_writer.h"
#include "perfetto/protozero/message_handle.h"
#include "perfetto/protozero/scattered_heap_buffer.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto {
@@ -38,8 +38,8 @@
TracePacketHandle NewTracePacket() override;
void Flush(std::function<void()> callback = {}) override;
- std::vector<protos::TracePacket> GetAllTracePackets();
- protos::TracePacket GetOnlyTracePacket();
+ std::vector<protos::gen::TracePacket> GetAllTracePackets();
+ protos::gen::TracePacket GetOnlyTracePacket();
WriterID writer_id() const override;
uint64_t written() const override;
diff --git a/src/tracing/core/tracing_service_impl_unittest.cc b/src/tracing/core/tracing_service_impl_unittest.cc
index b301612..0394937 100644
--- a/src/tracing/core/tracing_service_impl_unittest.cc
+++ b/src/tracing/core/tracing_service_impl_unittest.cc
@@ -36,10 +36,12 @@
#include "src/tracing/test/test_shared_memory.h"
#include "test/gtest_and_gmock.h"
+#include "protos/perfetto/trace/test_event.gen.h"
#include "protos/perfetto/trace/test_event.pbzero.h"
-#include "protos/perfetto/trace/trace.pb.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "protos/perfetto/trace/trigger.gen.h"
using ::testing::_;
using ::testing::AssertionFailure;
@@ -68,15 +70,16 @@
constexpr size_t kMaxShmSizeKb = TracingServiceImpl::kMaxShmSize / 1024;
AssertionResult HasTriggerModeInternal(
- const std::vector<protos::TracePacket>& packets,
- protos::TraceConfig::TriggerConfig::TriggerMode mode) {
+ const std::vector<protos::gen::TracePacket>& packets,
+ protos::gen::TraceConfig::TriggerConfig::TriggerMode mode) {
StringMatchResultListener matcher_result_string;
bool contains = ExplainMatchResult(
Contains(Property(
- &protos::TracePacket::trace_config,
- Property(&protos::TraceConfig::trigger_config,
- Property(&protos::TraceConfig::TriggerConfig::trigger_mode,
- Eq(mode))))),
+ &protos::gen::TracePacket::trace_config,
+ Property(
+ &protos::gen::TraceConfig::trigger_config,
+ Property(&protos::gen::TraceConfig::TriggerConfig::trigger_mode,
+ Eq(mode))))),
packets, &matcher_result_string);
if (contains) {
return AssertionSuccess();
@@ -330,7 +333,7 @@
EXPECT_THAT(
consumer->ReadBuffers(),
- HasTriggerMode(protos::TraceConfig::TriggerConfig::START_TRACING));
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::START_TRACING));
}
// Creates a tracing session with a START_TRACING trigger and checks that the
@@ -466,7 +469,7 @@
consumer->WaitForTracingDisabled();
EXPECT_THAT(
consumer->ReadBuffers(),
- HasTriggerMode(protos::TraceConfig::TriggerConfig::START_TRACING));
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::START_TRACING));
}
// Creates a tracing session with a START_TRACING trigger and checks that the
@@ -557,7 +560,7 @@
consumer->WaitForTracingDisabled();
EXPECT_THAT(
consumer->ReadBuffers(),
- HasTriggerMode(protos::TraceConfig::TriggerConfig::START_TRACING));
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::START_TRACING));
}
// Creates two tracing sessions with a START_TRACING trigger and checks that
@@ -686,10 +689,10 @@
EXPECT_TRUE(flushed_writer_2);
EXPECT_THAT(
consumer_1->ReadBuffers(),
- HasTriggerMode(protos::TraceConfig::TriggerConfig::START_TRACING));
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::START_TRACING));
EXPECT_THAT(
consumer_2->ReadBuffers(),
- HasTriggerMode(protos::TraceConfig::TriggerConfig::START_TRACING));
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::START_TRACING));
}
// Creates a tracing session with a START_TRACING trigger and checks that the
@@ -741,21 +744,21 @@
EXPECT_THAT(
packets,
Contains(Property(
- &protos::TracePacket::trace_config,
+ &protos::gen::TracePacket::trace_config,
Property(
- &protos::TraceConfig::trigger_config,
- Property(
- &protos::TraceConfig::TriggerConfig::trigger_mode,
- Eq(protos::TraceConfig::TriggerConfig::START_TRACING))))));
+ &protos::gen::TraceConfig::trigger_config,
+ Property(&protos::gen::TraceConfig::TriggerConfig::trigger_mode,
+ Eq(protos::gen::TraceConfig::TriggerConfig::
+ START_TRACING))))));
auto expect_received_trigger = [&](const std::string& name) {
return Contains(AllOf(
- Property(
- &protos::TracePacket::trigger,
- AllOf(Property(&protos::Trigger::trigger_name, Eq(name)),
- Property(&protos::Trigger::trusted_producer_uid, Eq(123)),
- Property(&protos::Trigger::producer_name,
- Eq("mock_producer")))),
- Property(&protos::TracePacket::trusted_packet_sequence_id,
+ Property(&protos::gen::TracePacket::trigger,
+ AllOf(Property(&protos::gen::Trigger::trigger_name, Eq(name)),
+ Property(&protos::gen::Trigger::trusted_producer_uid,
+ Eq(123)),
+ Property(&protos::gen::Trigger::producer_name,
+ Eq("mock_producer")))),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
Eq(kServicePacketSequenceID))));
};
EXPECT_THAT(packets, expect_received_trigger("trigger_name"));
@@ -816,22 +819,22 @@
EXPECT_THAT(
packets,
Contains(Property(
- &protos::TracePacket::trace_config,
+ &protos::gen::TracePacket::trace_config,
Property(
- &protos::TraceConfig::trigger_config,
- Property(
- &protos::TraceConfig::TriggerConfig::trigger_mode,
- Eq(protos::TraceConfig::TriggerConfig::STOP_TRACING))))));
+ &protos::gen::TraceConfig::trigger_config,
+ Property(&protos::gen::TraceConfig::TriggerConfig::trigger_mode,
+ Eq(protos::gen::TraceConfig::TriggerConfig::
+ STOP_TRACING))))));
auto expect_received_trigger = [&](const std::string& name) {
return Contains(AllOf(
- Property(
- &protos::TracePacket::trigger,
- AllOf(Property(&protos::Trigger::trigger_name, Eq(name)),
- Property(&protos::Trigger::trusted_producer_uid, Eq(321)),
- Property(&protos::Trigger::producer_name,
- Eq("mock_producer")))),
- Property(&protos::TracePacket::trusted_packet_sequence_id,
+ Property(&protos::gen::TracePacket::trigger,
+ AllOf(Property(&protos::gen::Trigger::trigger_name, Eq(name)),
+ Property(&protos::gen::Trigger::trusted_producer_uid,
+ Eq(321)),
+ Property(&protos::gen::Trigger::producer_name,
+ Eq("mock_producer")))),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
Eq(kServicePacketSequenceID))));
};
EXPECT_THAT(packets, expect_received_trigger("trigger_name"));
@@ -868,13 +871,13 @@
trigger_config->set_trigger_timeout_ms(30000);
auto expect_received_trigger = [&](const std::string& name) {
- return Contains(
- AllOf(Property(&protos::TracePacket::trigger,
- AllOf(Property(&protos::Trigger::trigger_name, Eq(name)),
- Property(&protos::Trigger::producer_name,
- Eq("mock_producer")))),
- Property(&protos::TracePacket::trusted_packet_sequence_id,
- Eq(kServicePacketSequenceID))));
+ return Contains(AllOf(
+ Property(&protos::gen::TracePacket::trigger,
+ AllOf(Property(&protos::gen::Trigger::trigger_name, Eq(name)),
+ Property(&protos::gen::Trigger::producer_name,
+ Eq("mock_producer")))),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
+ Eq(kServicePacketSequenceID))));
};
consumer->EnableTracing(trace_config);
@@ -890,12 +893,12 @@
EXPECT_THAT(
packets,
Contains(Property(
- &protos::TracePacket::trace_config,
+ &protos::gen::TracePacket::trace_config,
Property(
- &protos::TraceConfig::trigger_config,
- Property(
- &protos::TraceConfig::TriggerConfig::trigger_mode,
- Eq(protos::TraceConfig::TriggerConfig::STOP_TRACING))))));
+ &protos::gen::TraceConfig::trigger_config,
+ Property(&protos::gen::TraceConfig::TriggerConfig::trigger_mode,
+ Eq(protos::gen::TraceConfig::TriggerConfig::
+ STOP_TRACING))))));
EXPECT_THAT(packets, expect_received_trigger("trigger_name"));
EXPECT_THAT(packets, Not(expect_received_trigger("trigger_name_2")));
@@ -1041,21 +1044,24 @@
// We expect for the TraceConfig preamble packet to be there correctly and
// then we expect each payload to be there, but not the |large_payload|
// packet.
- EXPECT_THAT(packets,
- HasTriggerMode(protos::TraceConfig::TriggerConfig::STOP_TRACING));
+ EXPECT_THAT(
+ packets,
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::STOP_TRACING));
for (size_t i = 0; i < kNumTestPackets; i++) {
std::string payload = kPayload;
payload += std::to_string(i);
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq(payload)))));
+ EXPECT_THAT(packets,
+ Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq(payload)))));
}
// The large payload was overwritten before we trigger and ReadBuffers so it
// should not be in the returned data.
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq(large_payload))))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq(large_payload))))));
}
// Creates a tracing session with a STOP_TRACING trigger and checks that the
@@ -1111,8 +1117,9 @@
producer->WaitForDataSourceStop("ds_1");
consumer->WaitForTracingDisabled();
- EXPECT_THAT(consumer->ReadBuffers(),
- HasTriggerMode(protos::TraceConfig::TriggerConfig::STOP_TRACING));
+ EXPECT_THAT(
+ consumer->ReadBuffers(),
+ HasTriggerMode(protos::gen::TraceConfig::TriggerConfig::STOP_TRACING));
}
TEST_F(TracingServiceImplTest, LockdownMode) {
@@ -1382,12 +1389,13 @@
// Verify the contents of the file.
std::string trace_raw;
ASSERT_TRUE(base::ReadFile(tmp_file.path().c_str(), &trace_raw));
- protos::Trace trace;
+ protos::gen::Trace trace;
ASSERT_TRUE(trace.ParseFromString(trace_raw));
ASSERT_EQ(trace.packet_size(), kNumPreamblePackets + kNumTestPackets);
- for (int i = 0; i < kNumTestPackets; i++) {
- const protos::TracePacket& tp = trace.packet(kNumPreamblePackets + i);
+ for (size_t i = 0; i < kNumTestPackets; i++) {
+ const protos::gen::TracePacket& tp =
+ trace.packet()[kNumPreamblePackets + i];
ASSERT_EQ(kPayload + std::to_string(i++), tp.for_testing().str());
}
}
@@ -1499,10 +1507,10 @@
consumer->DisableTracing();
producer->WaitForDataSourceStop("data_source");
consumer->WaitForTracingDisabled();
- EXPECT_THAT(
- consumer->ReadBuffers(),
- Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload")))));
+ EXPECT_THAT(consumer->ReadBuffers(),
+ Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload")))));
}
TEST_F(TracingServiceImplTest, ImplicitFlushOnTimedTraces) {
@@ -1536,10 +1544,10 @@
producer->WaitForDataSourceStop("data_source");
consumer->WaitForTracingDisabled();
- EXPECT_THAT(
- consumer->ReadBuffers(),
- Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload")))));
+ EXPECT_THAT(consumer->ReadBuffers(),
+ Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload")))));
}
// Tests the monotonic semantic of flush request IDs, i.e., once a producer
@@ -1599,10 +1607,10 @@
consumer->DisableTracing();
producer->WaitForDataSourceStop("data_source");
consumer->WaitForTracingDisabled();
- EXPECT_THAT(
- consumer->ReadBuffers(),
- Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload")))));
+ EXPECT_THAT(consumer->ReadBuffers(),
+ Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload")))));
}
TEST_F(TracingServiceImplTest, PeriodicFlush) {
@@ -1653,8 +1661,8 @@
auto trace_packets = consumer->ReadBuffers();
for (int i = 0; i < kNumFlushes; i++) {
EXPECT_THAT(trace_packets,
- Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
+ Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
Eq("f_" + std::to_string(i))))));
}
}
@@ -1999,22 +2007,26 @@
size_t num_markers = 0;
size_t start = 0;
size_t end = 0;
- protos::Trace merged_trace;
+ std::string merged_trace_raw;
for (size_t pos = 0; pos != std::string::npos; start = end) {
pos = trace_raw.find(kSyncMarkerStr, pos + 1);
num_markers++;
end = (pos == std::string::npos) ? trace_raw.size() : pos + kMarkerSize;
- int size = static_cast<int>(end - start);
- ASSERT_GT(size, 0);
- protos::Trace trace_partition;
- ASSERT_TRUE(trace_partition.ParseFromArray(trace_raw.data() + start, size));
- merged_trace.MergeFrom(trace_partition);
+ size_t size = end - start;
+ ASSERT_GT(size, 0u);
+ std::string trace_partition_raw = trace_raw.substr(start, size);
+ protos::gen::Trace trace_partition;
+ ASSERT_TRUE(trace_partition.ParseFromString(trace_partition_raw));
+ merged_trace_raw += trace_partition_raw;
}
EXPECT_GE(num_markers, static_cast<size_t>(kNumMarkers));
- protos::Trace whole_trace;
+ protos::gen::Trace whole_trace;
ASSERT_TRUE(whole_trace.ParseFromString(trace_raw));
+ protos::gen::Trace merged_trace;
+ merged_trace.ParseFromString(merged_trace_raw);
+
ASSERT_EQ(whole_trace.packet_size(), merged_trace.packet_size());
EXPECT_EQ(whole_trace.SerializeAsString(), merged_trace.SerializeAsString());
}
@@ -2114,38 +2126,43 @@
EXPECT_THAT(
packets,
Contains(AllOf(
- Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1a1"))),
- Property(&protos::TracePacket::trusted_uid, Eq(123)),
- Property(&protos::TracePacket::trusted_packet_sequence_id, Eq(2u)))));
+ Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload1a1"))),
+ Property(&protos::gen::TracePacket::trusted_uid, Eq(123)),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
+ Eq(2u)))));
EXPECT_THAT(
packets,
Contains(AllOf(
- Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1a2"))),
- Property(&protos::TracePacket::trusted_uid, Eq(123)),
- Property(&protos::TracePacket::trusted_packet_sequence_id, Eq(2u)))));
+ Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload1a2"))),
+ Property(&protos::gen::TracePacket::trusted_uid, Eq(123)),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
+ Eq(2u)))));
EXPECT_THAT(
packets,
Contains(AllOf(
- Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1b1"))),
- Property(&protos::TracePacket::trusted_uid, Eq(123)),
- Property(&protos::TracePacket::trusted_packet_sequence_id, Eq(3u)))));
+ Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload1b1"))),
+ Property(&protos::gen::TracePacket::trusted_uid, Eq(123)),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
+ Eq(3u)))));
EXPECT_THAT(
packets,
Contains(AllOf(
- Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1b2"))),
- Property(&protos::TracePacket::trusted_uid, Eq(123)),
- Property(&protos::TracePacket::trusted_packet_sequence_id, Eq(3u)))));
+ Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload1b2"))),
+ Property(&protos::gen::TracePacket::trusted_uid, Eq(123)),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
+ Eq(3u)))));
EXPECT_THAT(
packets,
Contains(AllOf(
- Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload2a1"))),
- Property(&protos::TracePacket::trusted_uid, Eq(456)),
- Property(&protos::TracePacket::trusted_packet_sequence_id, Eq(4u)))));
+ Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload2a1"))),
+ Property(&protos::gen::TracePacket::trusted_uid, Eq(456)),
+ Property(&protos::gen::TracePacket::trusted_packet_sequence_id,
+ Eq(4u)))));
}
TEST_F(TracingServiceImplTest, AllowedBuffers) {
@@ -2288,12 +2305,13 @@
consumer->WaitForTracingDisabled();
auto packets = consumer->ReadBuffers();
- EXPECT_THAT(packets, Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
Eq("good_payload")))));
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("bad_payload"))))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("bad_payload"))))));
consumer->FreeBuffers();
EXPECT_EQ(std::set<BufferID>(), GetAllowedTargetBuffers(producer_id));
@@ -2356,9 +2374,9 @@
consumer->WaitForTracingDisabled();
auto packets = consumer->ReadBuffers();
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload")))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload")))));
}
TEST_F(TracingServiceImplTest, ScrapeBuffersOnFlush) {
@@ -2404,15 +2422,16 @@
// Chunk with the packets should have been scraped. The service can't know
// whether the last packet was completed, so shouldn't read it.
auto packets = consumer->ReadBuffers();
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1")))));
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload2")))));
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("payload3"))))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload1")))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload2")))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload3"))))));
// Write some more packets.
writer->NewTracePacket()->set_for_testing()->set_str("payload4");
@@ -2427,21 +2446,24 @@
// original one. Again, the last packet should be ignored and the first two
// should not be read twice.
packets = consumer->ReadBuffers();
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("payload1"))))));
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("payload2"))))));
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload3")))));
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload4")))));
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("payload5"))))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload1"))))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload2"))))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload3")))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload4")))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload5"))))));
consumer->DisableTracing();
producer->WaitForDataSourceStop("data_source");
@@ -2549,15 +2571,16 @@
// Chunk with the packets should have been scraped. The service can't know
// whether the last packet was completed, so shouldn't read it.
auto packets = consumer->ReadBuffers();
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1")))));
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload2")))));
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("payload3"))))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload1")))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload2")))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload3"))))));
// Cleanup writer without causing a crash because the producer already went
// away.
@@ -2611,15 +2634,16 @@
// Chunk with the packets should have been scraped. The service can't know
// whether the last packet was completed, so shouldn't read it.
auto packets = consumer->ReadBuffers();
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload1")))));
- EXPECT_THAT(packets, Contains(Property(
- &protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str, Eq("payload2")))));
- EXPECT_THAT(packets, Not(Contains(Property(&protos::TracePacket::for_testing,
- Property(&protos::TestEvent::str,
- Eq("payload3"))))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload1")))));
+ EXPECT_THAT(packets, Contains(Property(&protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str,
+ Eq("payload2")))));
+ EXPECT_THAT(packets,
+ Not(Contains(Property(
+ &protos::gen::TracePacket::for_testing,
+ Property(&protos::gen::TestEvent::str, Eq("payload3"))))));
}
TEST_F(TracingServiceImplTest, AbortIfTraceDurationIsTooLong) {
diff --git a/src/tracing/test/mock_consumer.cc b/src/tracing/test/mock_consumer.cc
index 17a983d..e7cf3b1 100644
--- a/src/tracing/test/mock_consumer.cc
+++ b/src/tracing/test/mock_consumer.cc
@@ -97,8 +97,8 @@
return FlushRequest(wait_for_flush_completion);
}
-std::vector<protos::TracePacket> MockConsumer::ReadBuffers() {
- std::vector<protos::TracePacket> decoded_packets;
+std::vector<protos::gen::TracePacket> MockConsumer::ReadBuffers() {
+ std::vector<protos::gen::TracePacket> decoded_packets;
static int i = 0;
std::string checkpoint_name = "on_read_buffers_" + std::to_string(i++);
auto on_read_buffers = task_runner_->CreateCheckpoint(checkpoint_name);
@@ -108,7 +108,8 @@
std::vector<TracePacket>* packets, bool has_more) {
for (TracePacket& packet : *packets) {
decoded_packets.emplace_back();
- protos::TracePacket* decoded_packet = &decoded_packets.back();
+ protos::gen::TracePacket* decoded_packet =
+ &decoded_packets.back();
decoded_packet->ParseFromString(packet.GetRawBytesForTesting());
}
if (!has_more)
diff --git a/src/tracing/test/mock_consumer.h b/src/tracing/test/mock_consumer.h
index b2f3563..a1f050e 100644
--- a/src/tracing/test/mock_consumer.h
+++ b/src/tracing/test/mock_consumer.h
@@ -25,7 +25,7 @@
#include "perfetto/tracing/core/tracing_service_state.h"
#include "test/gtest_and_gmock.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto {
@@ -55,7 +55,7 @@
void FreeBuffers();
void WaitForTracingDisabled(uint32_t timeout_ms = 3000);
FlushRequest Flush(uint32_t timeout_ms = 10000);
- std::vector<protos::TracePacket> ReadBuffers();
+ std::vector<protos::gen::TracePacket> ReadBuffers();
void GetTraceStats();
void WaitForTraceStats(bool success);
TracingServiceState QueryServiceState();
diff --git a/src/tracing/test/tracing_integration_test.cc b/src/tracing/test/tracing_integration_test.cc
index 799b614..8e4ec3a 100644
--- a/src/tracing/test/tracing_integration_test.cc
+++ b/src/tracing/test/tracing_integration_test.cc
@@ -34,10 +34,12 @@
#include "src/tracing/core/tracing_service_impl.h"
#include "test/gtest_and_gmock.h"
-#include "protos/perfetto/config/trace_config.pb.h"
+#include "protos/perfetto/config/trace_config.gen.h"
+#include "protos/perfetto/trace/clock_snapshot.gen.h"
+#include "protos/perfetto/trace/test_event.gen.h"
#include "protos/perfetto/trace/test_event.pbzero.h"
-#include "protos/perfetto/trace/trace.pb.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto {
@@ -91,7 +93,7 @@
}
};
-void CheckTraceStats(const protos::TracePacket& packet) {
+void CheckTraceStats(const protos::gen::TracePacket& packet) {
EXPECT_TRUE(packet.has_trace_stats());
EXPECT_GE(packet.trace_stats().producers_seen(), 1u);
EXPECT_EQ(1u, packet.trace_stats().producers_connected());
@@ -100,7 +102,7 @@
EXPECT_EQ(1u, packet.trace_stats().total_buffers());
EXPECT_EQ(1, packet.trace_stats().buffer_stats_size());
- const auto& buf_stats = packet.trace_stats().buffer_stats(0);
+ const auto& buf_stats = packet.trace_stats().buffer_stats()[0];
EXPECT_GT(buf_stats.bytes_written(), 0u);
EXPECT_GT(buf_stats.chunks_written(), 0u);
EXPECT_EQ(0u, buf_stats.chunks_overwritten());
@@ -238,14 +240,13 @@
// Store the arguments passed to SetupDataSource() and later check that they
// match the ones passed to StartDataSource().
DataSourceInstanceID setup_id;
- perfetto::protos::DataSourceConfig setup_cfg_proto;
+ DataSourceConfig setup_cfg_proto;
EXPECT_CALL(producer_, SetupDataSource(_, _))
.WillOnce(
Invoke([&setup_id, &setup_cfg_proto](DataSourceInstanceID id,
const DataSourceConfig& cfg) {
-
setup_id = id;
- cfg.ToProto(&setup_cfg_proto);
+ setup_cfg_proto = cfg;
}));
EXPECT_CALL(producer_, StartDataSource(_, _))
.WillOnce(
@@ -254,11 +255,7 @@
const DataSourceConfig& cfg) {
// id and config should match the ones passed to SetupDataSource.
ASSERT_EQ(id, setup_id);
- perfetto::protos::DataSourceConfig cfg_proto;
- cfg.ToProto(&cfg_proto);
- ASSERT_EQ(cfg_proto.SerializeAsString(),
- setup_cfg_proto.SerializeAsString());
-
+ ASSERT_EQ(setup_cfg_proto, cfg);
ASSERT_NE(0u, id);
ds_iid = id;
ASSERT_EQ("perfetto.test", cfg.name());
@@ -307,7 +304,7 @@
#endif
for (auto& encoded_packet : *packets) {
- protos::TracePacket packet;
+ protos::gen::TracePacket packet;
ASSERT_TRUE(packet.ParseFromString(
encoded_packet.GetRawBytesForTesting()));
if (packet.has_for_testing()) {
@@ -319,22 +316,7 @@
kExpectedMinNumberOfClocks);
saw_clock_snapshot = true;
} else if (packet.has_trace_config()) {
- protos::TraceConfig config_proto;
- trace_config.ToProto(&config_proto);
- Slice expected_slice = Slice::Allocate(
- static_cast<size_t>(config_proto.ByteSize()));
- config_proto.SerializeWithCachedSizesToArray(
- expected_slice.own_data());
- Slice actual_slice = Slice::Allocate(
- static_cast<size_t>(packet.trace_config().ByteSize()));
- packet.trace_config().SerializeWithCachedSizesToArray(
- actual_slice.own_data());
- EXPECT_EQ(std::string(reinterpret_cast<const char*>(
- expected_slice.own_data()),
- expected_slice.size),
- std::string(reinterpret_cast<const char*>(
- actual_slice.own_data()),
- actual_slice.size));
+ EXPECT_EQ(packet.trace_config(), trace_config);
saw_trace_config = true;
} else if (packet.has_trace_stats()) {
saw_trace_stats = true;
@@ -417,14 +399,14 @@
char tmp_buf[1024];
ssize_t rsize = read(tmp_file.fd(), tmp_buf, sizeof(tmp_buf));
ASSERT_GT(rsize, 0);
- protos::Trace tmp_trace;
- ASSERT_TRUE(tmp_trace.ParseFromArray(tmp_buf, static_cast<int>(rsize)));
+ protos::gen::Trace tmp_trace;
+ ASSERT_TRUE(tmp_trace.ParseFromArray(tmp_buf, static_cast<size_t>(rsize)));
size_t num_test_packet = 0;
size_t num_clock_snapshot_packet = 0;
size_t num_system_info_packet = 0;
bool saw_trace_stats = false;
for (int i = 0; i < tmp_trace.packet_size(); i++) {
- const protos::TracePacket& packet = tmp_trace.packet(i);
+ const auto& packet = tmp_trace.packet()[static_cast<size_t>(i)];
if (packet.has_for_testing()) {
ASSERT_EQ("evt_" + std::to_string(num_test_packet++),
packet.for_testing().str());
@@ -516,7 +498,7 @@
Invoke([&num_test_pack_rx, all_packets_rx](
std::vector<TracePacket>* packets, bool has_more) {
for (auto& encoded_packet : *packets) {
- protos::TracePacket packet;
+ protos::gen::TracePacket packet;
ASSERT_TRUE(packet.ParseFromString(
encoded_packet.GetRawBytesForTesting()));
if (packet.has_for_testing()) {
diff --git a/test/BUILD.gn b/test/BUILD.gn
index d30efae..0e9ff85 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -29,8 +29,10 @@
"../protos/perfetto/config:cpp",
"../protos/perfetto/config:zero",
"../protos/perfetto/config/power:zero",
- "../protos/perfetto/trace:lite",
+ "../protos/perfetto/trace:cpp",
"../protos/perfetto/trace:zero",
+ "../protos/perfetto/trace/ftrace:cpp",
+ "../protos/perfetto/trace/power:cpp",
"../src/base:base",
"../src/base:test_support",
"../src/traced/probes/ftrace",
@@ -130,6 +132,7 @@
source_set("test_helper") {
testonly = true
public_deps = [
+ "../protos/perfetto/trace:cpp",
"../src/tracing:ipc",
]
deps = [
@@ -137,7 +140,6 @@
":task_runner_thread_delegates",
"../gn:default_deps",
"../include/perfetto/ext/traced",
- "../protos/perfetto/trace:lite",
"../protos/perfetto/trace:zero",
"../src/base:test_support",
]
@@ -162,7 +164,7 @@
"../gn:gtest_and_gmock",
"../include/perfetto/ext/traced",
"../protos/perfetto/config:cpp",
- "../protos/perfetto/trace:lite",
+ "../protos/perfetto/trace:cpp",
"../protos/perfetto/trace:zero",
"../src/base:test_support",
]
diff --git a/test/cts/BUILD.gn b/test/cts/BUILD.gn
index 7e04b15..4ecb26c 100644
--- a/test/cts/BUILD.gn
+++ b/test/cts/BUILD.gn
@@ -24,8 +24,10 @@
"../../gn:default_deps",
"../../gn:gtest_and_gmock",
"../../include/perfetto/ext/tracing/core",
- "../../protos/perfetto/config/profiling:lite",
- "../../protos/perfetto/trace:lite",
+ "../../protos/perfetto/config:cpp",
+ "../../protos/perfetto/config/profiling:cpp",
+ "../../protos/perfetto/trace:cpp",
+ "../../protos/perfetto/trace/profiling:cpp",
"../../src/base:test_support",
"../../test:test_helper",
]
diff --git a/test/cts/end_to_end_integrationtest_cts.cc b/test/cts/end_to_end_integrationtest_cts.cc
index 3e7b404..1a9407b 100644
--- a/test/cts/end_to_end_integrationtest_cts.cc
+++ b/test/cts/end_to_end_integrationtest_cts.cc
@@ -23,7 +23,8 @@
#include "test/test_helper.h"
#include "protos/perfetto/config/test_config.gen.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/test_event.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto {
diff --git a/test/cts/heapprofd_java_test_cts.cc b/test/cts/heapprofd_java_test_cts.cc
index 23bba73..ae5a18a 100644
--- a/test/cts/heapprofd_java_test_cts.cc
+++ b/test/cts/heapprofd_java_test_cts.cc
@@ -26,12 +26,15 @@
#include "test/gtest_and_gmock.h"
#include "test/test_helper.h"
-#include "protos/perfetto/config/profiling/java_hprof_config.pb.h"
+#include "protos/perfetto/config/profiling/java_hprof_config.gen.h"
+#include "protos/perfetto/trace/profiling/heap_graph.gen.h"
+#include "protos/perfetto/trace/profiling/profile_common.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto {
namespace {
-std::vector<protos::TracePacket> ProfileRuntime(std::string app_name) {
+std::vector<protos::gen::TracePacket> ProfileRuntime(std::string app_name) {
base::TestTaskRunner task_runner;
// (re)start the target app's main activity
@@ -59,7 +62,7 @@
ds_config->set_name("android.java_hprof");
ds_config->set_target_buffer(0);
- protos::JavaHprofConfig java_hprof_config;
+ protos::gen::JavaHprofConfig java_hprof_config;
java_hprof_config.add_process_cmdline(app_name.c_str());
ds_config->set_java_hprof_config_raw(java_hprof_config.SerializeAsString());
@@ -73,7 +76,7 @@
return helper.trace();
}
-void AssertGraphPresent(std::vector<protos::TracePacket> packets) {
+void AssertGraphPresent(std::vector<protos::gen::TracePacket> packets) {
ASSERT_GT(packets.size(), 0u);
size_t objects = 0;
@@ -86,7 +89,7 @@
ASSERT_GT(roots, 0u);
}
-void AssertNoProfileContents(std::vector<protos::TracePacket> packets) {
+void AssertNoProfileContents(std::vector<protos::gen::TracePacket> packets) {
// If profile packets are present, they must be empty.
for (const auto& packet : packets) {
ASSERT_EQ(packet.heap_graph().roots_size(), 0);
diff --git a/test/cts/heapprofd_test_cts.cc b/test/cts/heapprofd_test_cts.cc
index c1faf6c..739f303 100644
--- a/test/cts/heapprofd_test_cts.cc
+++ b/test/cts/heapprofd_test_cts.cc
@@ -27,7 +27,10 @@
#include "test/gtest_and_gmock.h"
#include "test/test_helper.h"
-#include "protos/perfetto/config/profiling/heapprofd_config.pb.h"
+#include "protos/perfetto/config/profiling/heapprofd_config.gen.h"
+#include "protos/perfetto/trace/profiling/profile_common.gen.h"
+#include "protos/perfetto/trace/profiling/profile_packet.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto {
namespace {
@@ -41,8 +44,7 @@
static_assert(kExpectedIndividualAllocSz > kTestSamplingInterval,
"kTestSamplingInterval invalid");
-
-std::vector<protos::TracePacket> ProfileRuntime(std::string app_name) {
+std::vector<protos::gen::TracePacket> ProfileRuntime(std::string app_name) {
base::TestTaskRunner task_runner;
// (re)start the target app's main activity
@@ -67,7 +69,7 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protos::HeapprofdConfig heapprofd_config;
+ protos::gen::HeapprofdConfig heapprofd_config;
heapprofd_config.set_sampling_interval_bytes(kTestSamplingInterval);
heapprofd_config.add_process_cmdline(app_name.c_str());
heapprofd_config.set_block_client(true);
@@ -83,7 +85,7 @@
return helper.trace();
}
-std::vector<protos::TracePacket> ProfileStartup(std::string app_name) {
+std::vector<protos::gen::TracePacket> ProfileStartup(std::string app_name) {
base::TestTaskRunner task_runner;
if (IsAppRunning(app_name)) {
@@ -104,7 +106,7 @@
ds_config->set_name("android.heapprofd");
ds_config->set_target_buffer(0);
- protos::HeapprofdConfig heapprofd_config;
+ protos::gen::HeapprofdConfig heapprofd_config;
heapprofd_config.set_sampling_interval_bytes(kTestSamplingInterval);
heapprofd_config.add_process_cmdline(app_name.c_str());
heapprofd_config.set_block_client(true);
@@ -127,7 +129,7 @@
}
void AssertExpectedAllocationsPresent(
- std::vector<protos::TracePacket> packets) {
+ std::vector<protos::gen::TracePacket> packets) {
ASSERT_GT(packets.size(), 0u);
// TODO(rsavitski): assert particular stack frames once we clarify the
@@ -152,7 +154,7 @@
ASSERT_TRUE(found_alloc);
}
-void AssertNoProfileContents(std::vector<protos::TracePacket> packets) {
+void AssertNoProfileContents(std::vector<protos::gen::TracePacket> packets) {
// If profile packets are present, they must be empty.
for (const auto& packet : packets) {
ASSERT_EQ(packet.profile_packet().process_dumps_size(), 0);
diff --git a/test/end_to_end_benchmark.cc b/test/end_to_end_benchmark.cc
index 5cdedb3..91635f7 100644
--- a/test/end_to_end_benchmark.cc
+++ b/test/end_to_end_benchmark.cc
@@ -27,6 +27,7 @@
#include "test/test_helper.h"
#include "protos/perfetto/config/test_config.gen.h"
+#include "protos/perfetto/trace/test_event.gen.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto {
diff --git a/test/end_to_end_integrationtest.cc b/test/end_to_end_integrationtest.cc
index eab9338..209693d 100644
--- a/test/end_to_end_integrationtest.cc
+++ b/test/end_to_end_integrationtest.cc
@@ -31,12 +31,6 @@
#include "perfetto/ext/tracing/core/trace_packet.h"
#include "perfetto/ext/tracing/ipc/default_socket.h"
#include "perfetto/protozero/scattered_heap_buffer.h"
-#include "protos/perfetto/config/power/android_power_config.pbzero.h"
-#include "protos/perfetto/config/test_config.gen.h"
-#include "protos/perfetto/config/trace_config.gen.h"
-#include "protos/perfetto/trace/trace.pb.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
-#include "protos/perfetto/trace/trace_packet.pbzero.h"
#include "src/base/test/test_task_runner.h"
#include "src/traced/probes/ftrace/ftrace_controller.h"
#include "src/traced/probes/ftrace/ftrace_procfs.h"
@@ -45,6 +39,19 @@
#include "test/task_runner_thread_delegates.h"
#include "test/test_helper.h"
+#include "protos/perfetto/config/power/android_power_config.pbzero.h"
+#include "protos/perfetto/config/test_config.gen.h"
+#include "protos/perfetto/config/trace_config.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event.gen.h"
+#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h"
+#include "protos/perfetto/trace/power/battery_counters.gen.h"
+#include "protos/perfetto/trace/test_event.gen.h"
+#include "protos/perfetto/trace/trace.gen.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
+#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "protos/perfetto/trace/trigger.gen.h"
+
namespace perfetto {
namespace {
@@ -371,7 +378,7 @@
ds_config->set_name("linux.ftrace");
ds_config->set_target_buffer(0);
- protos::FtraceConfig ftrace_config;
+ protos::gen::FtraceConfig ftrace_config;
ftrace_config.add_ftrace_events("sched_switch");
ftrace_config.add_ftrace_events("bar");
ds_config->set_ftrace_config_raw(ftrace_config.SerializeAsString());
@@ -387,7 +394,9 @@
for (const auto& packet : packets) {
for (int ev = 0; ev < packet.ftrace_events().event_size(); ev++) {
- ASSERT_TRUE(packet.ftrace_events().event(ev).has_sched_switch());
+ ASSERT_TRUE(packet.ftrace_events()
+ .event()[static_cast<size_t>(ev)]
+ .has_sched_switch());
}
}
}
@@ -415,7 +424,7 @@
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("linux.ftrace");
- protos::FtraceConfig ftrace_config;
+ protos::gen::FtraceConfig ftrace_config;
ftrace_config.add_ftrace_events("print");
ds_config->set_ftrace_config_raw(ftrace_config.SerializeAsString());
@@ -443,7 +452,7 @@
int marker_found = 0;
for (const auto& packet : helper.trace()) {
for (int i = 0; i < packet.ftrace_events().event_size(); i++) {
- const auto& ev = packet.ftrace_events().event(i);
+ const auto& ev = packet.ftrace_events().event()[static_cast<size_t>(i)];
if (ev.has_print() && ev.print().buf().find(kMarker) != std::string::npos)
marker_found++;
}
@@ -814,7 +823,7 @@
// See |message_count| and |message_size| in the TraceConfig above.
constexpr size_t kMessageCount = 11;
constexpr size_t kMessageSize = 32;
- protos::TraceConfig trace_config;
+ protos::gen::TraceConfig trace_config;
trace_config.add_buffers()->set_size_kb(1024);
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.perfetto.FakeProducer");
@@ -822,7 +831,7 @@
ds_config->mutable_for_testing()->set_message_size(kMessageSize);
auto* trigger_cfg = trace_config.mutable_trigger_config();
trigger_cfg->set_trigger_mode(
- protos::TraceConfig::TriggerConfig::START_TRACING);
+ protos::gen::TraceConfig::TriggerConfig::START_TRACING);
trigger_cfg->set_trigger_timeout_ms(15000);
auto* trigger = trigger_cfg->add_triggers();
trigger->set_name("trigger_name");
@@ -878,19 +887,20 @@
std::string trace_str;
base::ReadFile(path, &trace_str);
- protos::Trace trace;
+ protos::gen::Trace trace;
ASSERT_TRUE(trace.ParseFromString(trace_str));
EXPECT_EQ(static_cast<int>(kPreamblePackets + kMessageCount),
trace.packet_size());
for (const auto& packet : trace.packet()) {
- if (packet.data_case() == protos::TracePacket::kTraceConfig) {
+ if (packet.has_trace_config()) {
// Ensure the trace config properly includes the trigger mode we set.
- EXPECT_EQ(protos::TraceConfig::TriggerConfig::START_TRACING,
+ auto kStartTrig = protos::gen::TraceConfig::TriggerConfig::START_TRACING;
+ EXPECT_EQ(kStartTrig,
packet.trace_config().trigger_config().trigger_mode());
- } else if (packet.data_case() == protos::TracePacket::kTrigger) {
+ } else if (packet.has_trigger()) {
// validate that the triggers are properly added to the trace.
EXPECT_EQ("trigger_name", packet.trigger().trigger_name());
- } else if (packet.data_case() == protos::TracePacket::kForTesting) {
+ } else if (packet.has_for_testing()) {
// Make sure that the data size is correctly set based on what we
// requested.
EXPECT_EQ(kMessageSize, packet.for_testing().str().size());
@@ -902,7 +912,7 @@
// See |message_count| and |message_size| in the TraceConfig above.
constexpr size_t kMessageCount = 11;
constexpr size_t kMessageSize = 32;
- protos::TraceConfig trace_config;
+ protos::gen::TraceConfig trace_config;
trace_config.add_buffers()->set_size_kb(1024);
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.perfetto.FakeProducer");
@@ -910,7 +920,7 @@
ds_config->mutable_for_testing()->set_message_size(kMessageSize);
auto* trigger_cfg = trace_config.mutable_trigger_config();
trigger_cfg->set_trigger_mode(
- protos::TraceConfig::TriggerConfig::STOP_TRACING);
+ protos::gen::TraceConfig::TriggerConfig::STOP_TRACING);
trigger_cfg->set_trigger_timeout_ms(15000);
auto* trigger = trigger_cfg->add_triggers();
trigger->set_name("trigger_name");
@@ -970,17 +980,18 @@
std::string trace_str;
base::ReadFile(path, &trace_str);
- protos::Trace trace;
+ protos::gen::Trace trace;
ASSERT_TRUE(trace.ParseFromString(trace_str));
EXPECT_EQ(static_cast<int>(kPreamblePackets + kMessageCount),
trace.packet_size());
bool seen_first_trigger = false;
for (const auto& packet : trace.packet()) {
- if (packet.data_case() == protos::TracePacket::kTraceConfig) {
+ if (packet.has_trace_config()) {
// Ensure the trace config properly includes the trigger mode we set.
- EXPECT_EQ(protos::TraceConfig::TriggerConfig::STOP_TRACING,
+ auto kStopTrig = protos::gen::TraceConfig::TriggerConfig::STOP_TRACING;
+ EXPECT_EQ(kStopTrig,
packet.trace_config().trigger_config().trigger_mode());
- } else if (packet.data_case() == protos::TracePacket::kTrigger) {
+ } else if (packet.has_trigger()) {
// validate that the triggers are properly added to the trace.
if (!seen_first_trigger) {
EXPECT_EQ("trigger_name", packet.trigger().trigger_name());
@@ -988,7 +999,7 @@
} else {
EXPECT_EQ("trigger_name_3", packet.trigger().trigger_name());
}
- } else if (packet.data_case() == protos::TracePacket::kForTesting) {
+ } else if (packet.has_for_testing()) {
// Make sure that the data size is correctly set based on what we
// requested.
EXPECT_EQ(kMessageSize, packet.for_testing().str().size());
@@ -1006,7 +1017,7 @@
// See |message_count| and |message_size| in the TraceConfig above.
constexpr size_t kMessageCount = 11;
constexpr size_t kMessageSize = 32;
- protos::TraceConfig trace_config;
+ protos::gen::TraceConfig trace_config;
trace_config.add_buffers()->set_size_kb(1024);
trace_config.set_allow_user_build_tracing(true);
auto* ds_config = trace_config.add_data_sources()->mutable_config();
@@ -1015,7 +1026,7 @@
ds_config->mutable_for_testing()->set_message_size(kMessageSize);
auto* trigger_cfg = trace_config.mutable_trigger_config();
trigger_cfg->set_trigger_mode(
- protos::TraceConfig::TriggerConfig::STOP_TRACING);
+ protos::gen::TraceConfig::TriggerConfig::STOP_TRACING);
trigger_cfg->set_trigger_timeout_ms(1000);
auto* trigger = trigger_cfg->add_triggers();
trigger->set_name("trigger_name");
@@ -1059,7 +1070,7 @@
// See |message_count| and |message_size| in the TraceConfig above.
constexpr size_t kMessageCount = 11;
constexpr size_t kMessageSize = 32;
- protos::TraceConfig trace_config;
+ protos::gen::TraceConfig trace_config;
trace_config.add_buffers()->set_size_kb(1024);
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.perfetto.FakeProducer");
@@ -1067,7 +1078,7 @@
ds_config->mutable_for_testing()->set_message_size(kMessageSize);
auto* trigger_cfg = trace_config.mutable_trigger_config();
trigger_cfg->set_trigger_mode(
- protos::TraceConfig::TriggerConfig::STOP_TRACING);
+ protos::gen::TraceConfig::TriggerConfig::STOP_TRACING);
trigger_cfg->set_trigger_timeout_ms(15000);
auto* trigger = trigger_cfg->add_triggers();
trigger->set_name("trigger_name");
@@ -1132,16 +1143,17 @@
std::string trace_str;
base::ReadFile(path, &trace_str);
- protos::Trace trace;
+ protos::gen::Trace trace;
ASSERT_TRUE(trace.ParseFromString(trace_str));
EXPECT_LT(static_cast<int>(kMessageCount), trace.packet_size());
bool seen_first_trigger = false;
for (const auto& packet : trace.packet()) {
- if (packet.data_case() == protos::TracePacket::kTraceConfig) {
+ if (packet.has_trace_config()) {
// Ensure the trace config properly includes the trigger mode we set.
- EXPECT_EQ(protos::TraceConfig::TriggerConfig::STOP_TRACING,
+ auto kStopTrig = protos::gen::TraceConfig::TriggerConfig::STOP_TRACING;
+ EXPECT_EQ(kStopTrig,
packet.trace_config().trigger_config().trigger_mode());
- } else if (packet.data_case() == protos::TracePacket::kTrigger) {
+ } else if (packet.has_trigger()) {
// validate that the triggers are properly added to the trace.
if (!seen_first_trigger) {
EXPECT_EQ("trigger_name", packet.trigger().trigger_name());
@@ -1149,7 +1161,7 @@
} else {
EXPECT_EQ("trigger_name_3", packet.trigger().trigger_name());
}
- } else if (packet.data_case() == protos::TracePacket::kForTesting) {
+ } else if (packet.has_for_testing()) {
// Make sure that the data size is correctly set based on what we
// requested.
EXPECT_EQ(kMessageSize, packet.for_testing().str().size());
@@ -1161,7 +1173,7 @@
// See |message_count| and |message_size| in the TraceConfig above.
constexpr size_t kMessageCount = 11;
constexpr size_t kMessageSize = 32;
- protos::TraceConfig trace_config;
+ protos::gen::TraceConfig trace_config;
trace_config.add_buffers()->set_size_kb(1024);
auto* ds_config = trace_config.add_data_sources()->mutable_config();
ds_config->set_name("android.perfetto.FakeProducer");
@@ -1169,7 +1181,7 @@
ds_config->mutable_for_testing()->set_message_size(kMessageSize);
auto* trigger_cfg = trace_config.mutable_trigger_config();
trigger_cfg->set_trigger_mode(
- protos::TraceConfig::TriggerConfig::STOP_TRACING);
+ protos::gen::TraceConfig::TriggerConfig::STOP_TRACING);
trigger_cfg->set_trigger_timeout_ms(15000);
auto* trigger = trigger_cfg->add_triggers();
trigger->set_name("trigger_name");
diff --git a/test/test_helper.cc b/test/test_helper.cc
index 57e8b10..e716c07 100644
--- a/test/test_helper.cc
+++ b/test/test_helper.cc
@@ -19,10 +19,8 @@
#include "perfetto/ext/traced/traced.h"
#include "perfetto/ext/tracing/core/trace_packet.h"
#include "test/task_runner_thread_delegates.h"
-
#include "perfetto/ext/tracing/ipc/default_socket.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto {
@@ -60,7 +58,7 @@
void TestHelper::OnTraceData(std::vector<TracePacket> packets, bool has_more) {
for (auto& encoded_packet : packets) {
- protos::TracePacket packet;
+ protos::gen::TracePacket packet;
PERFETTO_CHECK(
packet.ParseFromString(encoded_packet.GetRawBytesForTesting()));
if (packet.has_clock_snapshot() || packet.has_trace_config() ||
@@ -68,8 +66,7 @@
packet.has_system_info()) {
continue;
}
- PERFETTO_CHECK(packet.optional_trusted_uid_case() ==
- protos::TracePacket::kTrustedUid);
+ PERFETTO_CHECK(packet.has_trusted_uid());
trace_.push_back(std::move(packet));
}
diff --git a/test/test_helper.h b/test/test_helper.h
index f20c206..11897e5 100644
--- a/test/test_helper.h
+++ b/test/test_helper.h
@@ -26,7 +26,7 @@
#include "test/fake_producer.h"
#include "test/task_runner_thread.h"
-#include "protos/perfetto/trace/trace_packet.pb.h"
+#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto {
@@ -81,7 +81,7 @@
TaskRunnerThread* service_thread() { return &service_thread_; }
TaskRunnerThread* producer_thread() { return &producer_thread_; }
- const std::vector<protos::TracePacket>& trace() { return trace_; }
+ const std::vector<protos::gen::TracePacket>& trace() { return trace_; }
private:
static uint64_t next_instance_num_;
@@ -95,7 +95,7 @@
std::function<void()> on_detach_callback_;
std::function<void(bool)> on_attach_callback_;
- std::vector<protos::TracePacket> trace_;
+ std::vector<protos::gen::TracePacket> trace_;
TaskRunnerThread service_thread_;
TaskRunnerThread producer_thread_;