GN: clean up build files, split ipc client/service
This CL refactors the build files to allow a cleaner
separation of producer, consumer and service code by
later CLs. The end goal is to allow clients to link
a reduced version of the client library with only the
the producer code in Android (i.e. no kInProcess mode)
to reduce binary size and memory usage (see bug).
This CL alone doesn't reduce the binary size but just
puts the GN files in a better state. Changes introduced:
1. src/tracing: create GN files for each sub-directory
instead of having one monster BUILD.gn.
2. Split the src/ipc targets into client vs host.
3. Split the src/tracing/ipc targets into
producer, consumer, service.
4. Some further minor cleanups.
Bug: 148198993
Change-Id: Ie501c930255b10b8eafcd61b7226cd49e32728be
diff --git a/Android.bp b/Android.bp
index abbbb9a..d29f875 100644
--- a/Android.bp
+++ b/Android.bp
@@ -108,7 +108,8 @@
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_base_base",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
":perfetto_src_profiling_memory_daemon",
":perfetto_src_profiling_memory_proc_utils",
":perfetto_src_profiling_memory_ring_buffer",
@@ -116,8 +117,9 @@
":perfetto_src_profiling_memory_wire_protocol",
":perfetto_src_protozero_protozero",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_producer_producer",
"src/profiling/memory/main.cc",
],
shared_libs: [
@@ -297,7 +299,9 @@
":perfetto_src_android_internal_lazy_library_loader",
":perfetto_src_base_base",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
+ ":perfetto_src_ipc_host",
":perfetto_src_perfetto_cmd_perfetto_atoms",
":perfetto_src_protozero_protozero",
":perfetto_src_traced_probes_android_log_android_log",
@@ -314,9 +318,13 @@
":perfetto_src_traced_probes_sys_stats_sys_stats",
":perfetto_src_traced_service_service",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_consumer_api_deprecated",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_consumer_api_deprecated_consumer_api_deprecated",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
+ ":perfetto_src_tracing_ipc_service_service",
],
shared_libs: [
"liblog",
@@ -466,13 +474,19 @@
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_base_base",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
+ ":perfetto_src_ipc_host",
":perfetto_src_protozero_protozero",
":perfetto_src_tracing_client_api",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
+ ":perfetto_src_tracing_ipc_service_service",
":perfetto_src_tracing_platform_posix",
- ":perfetto_src_tracing_tracing",
],
export_include_dirs: [
"include",
@@ -620,15 +634,18 @@
":perfetto_src_android_internal_lazy_library_loader",
":perfetto_src_base_base",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
":perfetto_src_perfetto_cmd_perfetto_atoms",
":perfetto_src_perfetto_cmd_perfetto_cmd",
":perfetto_src_perfetto_cmd_protos_gen",
":perfetto_src_perfetto_cmd_trigger_producer",
":perfetto_src_protozero_protozero",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
"src/perfetto_cmd/main.cc",
],
shared_libs: [
@@ -756,7 +773,9 @@
":perfetto_src_base_base",
":perfetto_src_base_test_support",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
+ ":perfetto_src_ipc_host",
":perfetto_src_perfetto_cmd_perfetto_atoms",
":perfetto_src_protozero_protozero",
":perfetto_src_traced_probes_android_log_android_log",
@@ -771,8 +790,12 @@
":perfetto_src_traced_probes_ps_ps",
":perfetto_src_traced_probes_sys_stats_sys_stats",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
+ ":perfetto_src_tracing_ipc_service_service",
":perfetto_test_end_to_end_integrationtests",
":perfetto_test_test_helper",
"test/cts/device_feature_test_cts.cc",
@@ -976,7 +999,9 @@
":perfetto_src_base_base",
":perfetto_src_base_test_support",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
+ ":perfetto_src_ipc_host",
":perfetto_src_perfetto_cmd_perfetto_atoms",
":perfetto_src_protozero_protozero",
":perfetto_src_traced_probes_android_log_android_log",
@@ -991,8 +1016,12 @@
":perfetto_src_traced_probes_ps_ps",
":perfetto_src_traced_probes_sys_stats_sys_stats",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
+ ":perfetto_src_tracing_ipc_service_service",
":perfetto_test_test_helper",
],
export_include_dirs: [
@@ -1306,7 +1335,9 @@
":perfetto_src_base_base",
":perfetto_src_base_test_support",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
+ ":perfetto_src_ipc_host",
":perfetto_src_perfetto_cmd_perfetto_atoms",
":perfetto_src_profiling_memory_client",
":perfetto_src_profiling_memory_daemon",
@@ -1330,12 +1361,16 @@
":perfetto_src_traced_probes_ps_ps",
":perfetto_src_traced_probes_sys_stats_sys_stats",
":perfetto_src_tracing_client_api",
- ":perfetto_src_tracing_client_api_integrationtests",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
+ ":perfetto_src_tracing_ipc_service_service",
":perfetto_src_tracing_platform_posix",
":perfetto_src_tracing_test_api_test_support",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_test_client_api_integrationtests",
":perfetto_test_end_to_end_integrationtests",
":perfetto_test_test_helper",
],
@@ -5333,19 +5368,33 @@
],
}
-// GN: //src/ipc:ipc
+// GN: //src/ipc:client
filegroup {
- name: "perfetto_src_ipc_ipc",
+ name: "perfetto_src_ipc_client",
+ srcs: [
+ "src/ipc/client_impl.cc",
+ "src/ipc/service_proxy.cc",
+ ],
+}
+
+// GN: //src/ipc:common
+filegroup {
+ name: "perfetto_src_ipc_common",
srcs: [
"src/ipc/buffered_frame_deserializer.cc",
- "src/ipc/client_impl.cc",
"src/ipc/deferred.cc",
- "src/ipc/host_impl.cc",
- "src/ipc/service_proxy.cc",
"src/ipc/virtual_destructors.cc",
],
}
+// GN: //src/ipc:host
+filegroup {
+ name: "perfetto_src_ipc_host",
+ srcs: [
+ "src/ipc/host_impl.cc",
+ ],
+}
+
// GN: //src/ipc:test_messages_cpp
genrule {
name: "perfetto_src_ipc_test_messages_cpp_gen",
@@ -6470,16 +6519,6 @@
],
}
-// GN: //src/tracing:client_api_integrationtests
-filegroup {
- name: "perfetto_src_tracing_client_api_integrationtests",
- srcs: [
- "src/tracing/api_integrationtest.cc",
- "src/tracing/test/tracing_module.cc",
- "src/tracing/test/tracing_module2.cc",
- ],
-}
-
// GN: //src/tracing:common
filegroup {
name: "perfetto_src_tracing_common",
@@ -6488,28 +6527,110 @@
],
}
-// GN: //src/tracing:consumer_api_deprecated
+// GN: //src/tracing/consumer_api_deprecated:consumer_api_deprecated
filegroup {
- name: "perfetto_src_tracing_consumer_api_deprecated",
+ name: "perfetto_src_tracing_consumer_api_deprecated_consumer_api_deprecated",
srcs: [
- "src/tracing/api_impl/consumer_api.cc",
+ "src/tracing/consumer_api_deprecated/consumer_api_deprecated.cc",
],
}
-// GN: //src/tracing:ipc
+// GN: //src/tracing/core:core
filegroup {
- name: "perfetto_src_tracing_ipc",
+ name: "perfetto_src_tracing_core_core",
srcs: [
- "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
+ "src/tracing/core/id_allocator.cc",
+ "src/tracing/core/null_trace_writer.cc",
+ "src/tracing/core/shared_memory_abi.cc",
+ "src/tracing/core/shared_memory_arbiter_impl.cc",
+ "src/tracing/core/startup_trace_writer.cc",
+ "src/tracing/core/startup_trace_writer_registry.cc",
+ "src/tracing/core/trace_packet.cc",
+ "src/tracing/core/trace_writer_impl.cc",
+ "src/tracing/core/virtual_destructors.cc",
+ ],
+}
+
+// GN: //src/tracing/core:service
+filegroup {
+ name: "perfetto_src_tracing_core_service",
+ srcs: [
+ "src/tracing/core/metatrace_writer.cc",
+ "src/tracing/core/packet_stream_validator.cc",
+ "src/tracing/core/trace_buffer.cc",
+ "src/tracing/core/tracing_service_impl.cc",
+ ],
+}
+
+// GN: //src/tracing/core:test_support
+filegroup {
+ name: "perfetto_src_tracing_core_test_support",
+ srcs: [
+ "src/tracing/core/trace_writer_for_testing.cc",
+ ],
+}
+
+// GN: //src/tracing/core:unittests
+filegroup {
+ name: "perfetto_src_tracing_core_unittests",
+ srcs: [
+ "src/tracing/core/id_allocator_unittest.cc",
+ "src/tracing/core/null_trace_writer_unittest.cc",
+ "src/tracing/core/packet_stream_validator_unittest.cc",
+ "src/tracing/core/patch_list_unittest.cc",
+ "src/tracing/core/shared_memory_abi_unittest.cc",
+ "src/tracing/core/shared_memory_arbiter_impl_unittest.cc",
+ "src/tracing/core/startup_trace_writer_unittest.cc",
+ "src/tracing/core/trace_buffer_unittest.cc",
+ "src/tracing/core/trace_packet_unittest.cc",
+ "src/tracing/core/trace_writer_impl_unittest.cc",
+ "src/tracing/core/tracing_service_impl_unittest.cc",
+ ],
+}
+
+// GN: //src/tracing/ipc:common
+filegroup {
+ name: "perfetto_src_tracing_ipc_common",
+ srcs: [
"src/tracing/ipc/default_socket.cc",
"src/tracing/ipc/posix_shared_memory.cc",
+ ],
+}
+
+// GN: //src/tracing/ipc/consumer:consumer
+filegroup {
+ name: "perfetto_src_tracing_ipc_consumer_consumer",
+ srcs: [
+ "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
+ ],
+}
+
+// GN: //src/tracing/ipc/producer:producer
+filegroup {
+ name: "perfetto_src_tracing_ipc_producer_producer",
+ srcs: [
"src/tracing/ipc/producer/producer_ipc_client_impl.cc",
+ ],
+}
+
+// GN: //src/tracing/ipc/service:service
+filegroup {
+ name: "perfetto_src_tracing_ipc_service_service",
+ srcs: [
"src/tracing/ipc/service/consumer_ipc_service.cc",
"src/tracing/ipc/service/producer_ipc_service.cc",
"src/tracing/ipc/service/service_ipc_host_impl.cc",
],
}
+// GN: //src/tracing/ipc:unittests
+filegroup {
+ name: "perfetto_src_tracing_ipc_unittests",
+ srcs: [
+ "src/tracing/ipc/posix_shared_memory_unittest.cc",
+ ],
+}
+
// GN: //src/tracing:platform_posix
filegroup {
name: "perfetto_src_tracing_platform_posix",
@@ -6526,55 +6647,32 @@
],
}
-// GN: //src/tracing:test_support
+// GN: //src/tracing/test:client_api_integrationtests
filegroup {
- name: "perfetto_src_tracing_test_support",
+ name: "perfetto_src_tracing_test_client_api_integrationtests",
srcs: [
- "src/tracing/core/trace_writer_for_testing.cc",
+ "src/tracing/test/api_integrationtest.cc",
+ "src/tracing/test/tracing_module.cc",
+ "src/tracing/test/tracing_module2.cc",
],
}
-// GN: //src/tracing:tracing
+// GN: //src/tracing/test:test_support
filegroup {
- name: "perfetto_src_tracing_tracing",
+ name: "perfetto_src_tracing_test_test_support",
srcs: [
- "src/tracing/core/id_allocator.cc",
- "src/tracing/core/metatrace_writer.cc",
- "src/tracing/core/null_trace_writer.cc",
- "src/tracing/core/packet_stream_validator.cc",
- "src/tracing/core/shared_memory_abi.cc",
- "src/tracing/core/shared_memory_arbiter_impl.cc",
- "src/tracing/core/startup_trace_writer.cc",
- "src/tracing/core/startup_trace_writer_registry.cc",
- "src/tracing/core/trace_buffer.cc",
- "src/tracing/core/trace_packet.cc",
- "src/tracing/core/trace_writer_impl.cc",
- "src/tracing/core/tracing_service_impl.cc",
- "src/tracing/core/virtual_destructors.cc",
- ],
-}
-
-// GN: //src/tracing:unittests
-filegroup {
- name: "perfetto_src_tracing_unittests",
- srcs: [
- "src/tracing/core/id_allocator_unittest.cc",
- "src/tracing/core/null_trace_writer_unittest.cc",
- "src/tracing/core/packet_stream_validator_unittest.cc",
- "src/tracing/core/patch_list_unittest.cc",
- "src/tracing/core/shared_memory_abi_unittest.cc",
- "src/tracing/core/shared_memory_arbiter_impl_unittest.cc",
- "src/tracing/core/startup_trace_writer_unittest.cc",
- "src/tracing/core/trace_buffer_unittest.cc",
- "src/tracing/core/trace_packet_unittest.cc",
- "src/tracing/core/trace_writer_impl_unittest.cc",
- "src/tracing/core/tracing_service_impl_unittest.cc",
- "src/tracing/ipc/posix_shared_memory_unittest.cc",
"src/tracing/test/aligned_buffer_test.cc",
"src/tracing/test/fake_packet.cc",
"src/tracing/test/mock_consumer.cc",
"src/tracing/test/mock_producer.cc",
"src/tracing/test/test_shared_memory.cc",
+ ],
+}
+
+// GN: //src/tracing/test:tracing_integration_test
+filegroup {
+ name: "perfetto_src_tracing_test_tracing_integration_test",
+ srcs: [
"src/tracing/test/tracing_integration_test.cc",
],
}
@@ -6820,7 +6918,9 @@
":perfetto_src_base_test_support",
":perfetto_src_base_unittests",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
+ ":perfetto_src_ipc_host",
":perfetto_src_ipc_test_messages_cpp_gen",
":perfetto_src_ipc_test_messages_ipc_gen",
":perfetto_src_ipc_unittests",
@@ -6891,10 +6991,17 @@
":perfetto_src_traced_service_service",
":perfetto_src_traced_service_unittests",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_test_support",
- ":perfetto_src_tracing_tracing",
- ":perfetto_src_tracing_unittests",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_core_test_support",
+ ":perfetto_src_tracing_core_unittests",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_consumer_consumer",
+ ":perfetto_src_tracing_ipc_producer_producer",
+ ":perfetto_src_tracing_ipc_service_service",
+ ":perfetto_src_tracing_ipc_unittests",
+ ":perfetto_src_tracing_test_test_support",
+ ":perfetto_src_tracing_test_tracing_integration_test",
":perfetto_tools_sanitizers_unittests_sanitizers_unittests",
],
shared_libs: [
@@ -7314,14 +7421,16 @@
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_base_base",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
":perfetto_src_profiling_perf_producer",
":perfetto_src_profiling_perf_traced_perf_main",
":perfetto_src_profiling_perf_unwind_support",
":perfetto_src_protozero_protozero",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_producer_producer",
"src/profiling/perf/main.cc",
],
shared_libs: [
@@ -7454,14 +7563,16 @@
":perfetto_protos_perfetto_trace_track_event_zero_gen",
":perfetto_src_base_base",
":perfetto_src_base_unix_socket",
- ":perfetto_src_ipc_ipc",
+ ":perfetto_src_ipc_client",
+ ":perfetto_src_ipc_common",
":perfetto_src_perfetto_cmd_protos_gen",
":perfetto_src_perfetto_cmd_trigger_perfetto_cmd",
":perfetto_src_perfetto_cmd_trigger_producer",
":perfetto_src_protozero_protozero",
":perfetto_src_tracing_common",
- ":perfetto_src_tracing_ipc",
- ":perfetto_src_tracing_tracing",
+ ":perfetto_src_tracing_core_core",
+ ":perfetto_src_tracing_ipc_common",
+ ":perfetto_src_tracing_ipc_producer_producer",
"src/perfetto_cmd/trigger_perfetto_main.cc",
],
shared_libs: [
diff --git a/BUILD b/BUILD
index 3df1dca..be3b241 100644
--- a/BUILD
+++ b/BUILD
@@ -58,7 +58,9 @@
srcs = [
":src_base_base",
":src_base_unix_socket",
- ":src_ipc_ipc",
+ ":src_ipc_client",
+ ":src_ipc_common",
+ ":src_ipc_host",
],
hdrs = [
":include_perfetto_base_base",
@@ -161,7 +163,9 @@
":src_android_internal_lazy_library_loader",
":src_base_base",
":src_base_unix_socket",
- ":src_ipc_ipc",
+ ":src_ipc_client",
+ ":src_ipc_common",
+ ":src_ipc_host",
":src_perfetto_cmd_perfetto_atoms",
":src_protozero_protozero",
":src_traced_probes_android_log_android_log",
@@ -178,9 +182,13 @@
":src_traced_probes_sys_stats_sys_stats",
":src_traced_service_service",
":src_tracing_common",
- ":src_tracing_consumer_api_deprecated",
- ":src_tracing_ipc",
- ":src_tracing_tracing",
+ ":src_tracing_consumer_api_deprecated_consumer_api_deprecated",
+ ":src_tracing_core_core",
+ ":src_tracing_core_service",
+ ":src_tracing_ipc_common",
+ ":src_tracing_ipc_consumer_consumer",
+ ":src_tracing_ipc_producer_producer",
+ ":src_tracing_ipc_service_service",
],
hdrs = [
":include_perfetto_base_base",
@@ -540,19 +548,33 @@
],
)
-# GN target: //src/ipc:ipc
+# GN target: //src/ipc:client
filegroup(
- name = "src_ipc_ipc",
+ name = "src_ipc_client",
+ srcs = [
+ "src/ipc/client_impl.cc",
+ "src/ipc/client_impl.h",
+ "src/ipc/service_proxy.cc",
+ ],
+)
+
+# GN target: //src/ipc:common
+filegroup(
+ name = "src_ipc_common",
srcs = [
"src/ipc/buffered_frame_deserializer.cc",
"src/ipc/buffered_frame_deserializer.h",
- "src/ipc/client_impl.cc",
- "src/ipc/client_impl.h",
"src/ipc/deferred.cc",
+ "src/ipc/virtual_destructors.cc",
+ ],
+)
+
+# GN target: //src/ipc:host
+filegroup(
+ name = "src_ipc_host",
+ srcs = [
"src/ipc/host_impl.cc",
"src/ipc/host_impl.h",
- "src/ipc/service_proxy.cc",
- "src/ipc/virtual_destructors.cc",
],
)
@@ -1123,6 +1145,91 @@
],
)
+# GN target: //src/tracing/consumer_api_deprecated:consumer_api_deprecated
+filegroup(
+ name = "src_tracing_consumer_api_deprecated_consumer_api_deprecated",
+ srcs = [
+ "src/tracing/consumer_api_deprecated/consumer_api_deprecated.cc",
+ ],
+)
+
+# GN target: //src/tracing/core:core
+filegroup(
+ name = "src_tracing_core_core",
+ srcs = [
+ "src/tracing/core/id_allocator.cc",
+ "src/tracing/core/id_allocator.h",
+ "src/tracing/core/null_trace_writer.cc",
+ "src/tracing/core/null_trace_writer.h",
+ "src/tracing/core/patch_list.h",
+ "src/tracing/core/shared_memory_abi.cc",
+ "src/tracing/core/shared_memory_arbiter_impl.cc",
+ "src/tracing/core/shared_memory_arbiter_impl.h",
+ "src/tracing/core/startup_trace_writer.cc",
+ "src/tracing/core/startup_trace_writer_registry.cc",
+ "src/tracing/core/trace_packet.cc",
+ "src/tracing/core/trace_writer_impl.cc",
+ "src/tracing/core/trace_writer_impl.h",
+ "src/tracing/core/virtual_destructors.cc",
+ ],
+)
+
+# GN target: //src/tracing/core:service
+filegroup(
+ name = "src_tracing_core_service",
+ srcs = [
+ "src/tracing/core/metatrace_writer.cc",
+ "src/tracing/core/metatrace_writer.h",
+ "src/tracing/core/packet_stream_validator.cc",
+ "src/tracing/core/packet_stream_validator.h",
+ "src/tracing/core/trace_buffer.cc",
+ "src/tracing/core/trace_buffer.h",
+ "src/tracing/core/tracing_service_impl.cc",
+ "src/tracing/core/tracing_service_impl.h",
+ ],
+)
+
+# GN target: //src/tracing/ipc/consumer:consumer
+filegroup(
+ name = "src_tracing_ipc_consumer_consumer",
+ srcs = [
+ "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
+ "src/tracing/ipc/consumer/consumer_ipc_client_impl.h",
+ ],
+)
+
+# GN target: //src/tracing/ipc/producer:producer
+filegroup(
+ name = "src_tracing_ipc_producer_producer",
+ srcs = [
+ "src/tracing/ipc/producer/producer_ipc_client_impl.cc",
+ "src/tracing/ipc/producer/producer_ipc_client_impl.h",
+ ],
+)
+
+# GN target: //src/tracing/ipc/service:service
+filegroup(
+ name = "src_tracing_ipc_service_service",
+ srcs = [
+ "src/tracing/ipc/service/consumer_ipc_service.cc",
+ "src/tracing/ipc/service/consumer_ipc_service.h",
+ "src/tracing/ipc/service/producer_ipc_service.cc",
+ "src/tracing/ipc/service/producer_ipc_service.h",
+ "src/tracing/ipc/service/service_ipc_host_impl.cc",
+ "src/tracing/ipc/service/service_ipc_host_impl.h",
+ ],
+)
+
+# GN target: //src/tracing/ipc:common
+filegroup(
+ name = "src_tracing_ipc_common",
+ srcs = [
+ "src/tracing/ipc/default_socket.cc",
+ "src/tracing/ipc/posix_shared_memory.cc",
+ "src/tracing/ipc/posix_shared_memory.h",
+ ],
+)
+
# GN target: //src/tracing:client_api
filegroup(
name = "src_tracing_client_api",
@@ -1153,34 +1260,6 @@
],
)
-# GN target: //src/tracing:consumer_api_deprecated
-filegroup(
- name = "src_tracing_consumer_api_deprecated",
- srcs = [
- "src/tracing/api_impl/consumer_api.cc",
- ],
-)
-
-# GN target: //src/tracing:ipc
-filegroup(
- name = "src_tracing_ipc",
- srcs = [
- "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
- "src/tracing/ipc/consumer/consumer_ipc_client_impl.h",
- "src/tracing/ipc/default_socket.cc",
- "src/tracing/ipc/posix_shared_memory.cc",
- "src/tracing/ipc/posix_shared_memory.h",
- "src/tracing/ipc/producer/producer_ipc_client_impl.cc",
- "src/tracing/ipc/producer/producer_ipc_client_impl.h",
- "src/tracing/ipc/service/consumer_ipc_service.cc",
- "src/tracing/ipc/service/consumer_ipc_service.h",
- "src/tracing/ipc/service/producer_ipc_service.cc",
- "src/tracing/ipc/service/producer_ipc_service.h",
- "src/tracing/ipc/service/service_ipc_host_impl.cc",
- "src/tracing/ipc/service/service_ipc_host_impl.h",
- ],
-)
-
# GN target: //src/tracing:platform_posix
filegroup(
name = "src_tracing_platform_posix",
@@ -1189,35 +1268,6 @@
],
)
-# GN target: //src/tracing:tracing
-filegroup(
- name = "src_tracing_tracing",
- srcs = [
- "src/tracing/core/id_allocator.cc",
- "src/tracing/core/id_allocator.h",
- "src/tracing/core/metatrace_writer.cc",
- "src/tracing/core/metatrace_writer.h",
- "src/tracing/core/null_trace_writer.cc",
- "src/tracing/core/null_trace_writer.h",
- "src/tracing/core/packet_stream_validator.cc",
- "src/tracing/core/packet_stream_validator.h",
- "src/tracing/core/patch_list.h",
- "src/tracing/core/shared_memory_abi.cc",
- "src/tracing/core/shared_memory_arbiter_impl.cc",
- "src/tracing/core/shared_memory_arbiter_impl.h",
- "src/tracing/core/startup_trace_writer.cc",
- "src/tracing/core/startup_trace_writer_registry.cc",
- "src/tracing/core/trace_buffer.cc",
- "src/tracing/core/trace_buffer.h",
- "src/tracing/core/trace_packet.cc",
- "src/tracing/core/trace_writer_impl.cc",
- "src/tracing/core/trace_writer_impl.h",
- "src/tracing/core/tracing_service_impl.cc",
- "src/tracing/core/tracing_service_impl.h",
- "src/tracing/core/virtual_destructors.cc",
- ],
-)
-
# GN target: //tools/trace_to_text:common
filegroup(
name = "tools_trace_to_text_common",
@@ -2420,13 +2470,19 @@
srcs = [
":src_base_base",
":src_base_unix_socket",
- ":src_ipc_ipc",
+ ":src_ipc_client",
+ ":src_ipc_common",
+ ":src_ipc_host",
":src_protozero_protozero",
":src_tracing_client_api",
":src_tracing_common",
- ":src_tracing_ipc",
+ ":src_tracing_core_core",
+ ":src_tracing_core_service",
+ ":src_tracing_ipc_common",
+ ":src_tracing_ipc_consumer_consumer",
+ ":src_tracing_ipc_producer_producer",
+ ":src_tracing_ipc_service_service",
":src_tracing_platform_posix",
- ":src_tracing_tracing",
],
hdrs = [
":include_perfetto_base_base",
@@ -2504,14 +2560,17 @@
":src_android_internal_lazy_library_loader",
":src_base_base",
":src_base_unix_socket",
- ":src_ipc_ipc",
+ ":src_ipc_client",
+ ":src_ipc_common",
":src_perfetto_cmd_perfetto_atoms",
":src_perfetto_cmd_perfetto_cmd",
":src_perfetto_cmd_trigger_producer",
":src_protozero_protozero",
":src_tracing_common",
- ":src_tracing_ipc",
- ":src_tracing_tracing",
+ ":src_tracing_core_core",
+ ":src_tracing_ipc_common",
+ ":src_tracing_ipc_consumer_consumer",
+ ":src_tracing_ipc_producer_producer",
],
visibility = [
"//visibility:public",
diff --git a/BUILD.gn b/BUILD.gn
index 7fa8514..b5b799b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -114,7 +114,7 @@
# compile-time checks for the CI.
if (perfetto_build_standalone) {
all_targets += [
- "src/tracing:consumer_api_test",
+ "src/tracing/consumer_api_deprecated:consumer_api_test",
"test/configs",
# For syntax-checking the proto.
@@ -155,7 +155,9 @@
# depending on other GN files.
group("default") {
testonly = true
- deps = [ ":all" ]
+ deps = [
+ ":all",
+ ]
}
# +----------------------------------------------------------------------------+
@@ -164,7 +166,9 @@
if (enable_perfetto_ui) {
group("ui") {
- deps = [ "ui" ]
+ deps = [
+ "ui",
+ ]
}
}
@@ -194,7 +198,7 @@
"gn:default_deps",
"src/traced/probes",
"src/traced/service",
- "src/tracing:consumer_api_deprecated",
+ "src/tracing/consumer_api_deprecated",
]
}
}
@@ -208,11 +212,13 @@
complete_static_lib = true
public_deps = [
"gn:default_deps",
- "src/tracing",
"src/tracing:client_api",
"src/tracing:platform_posix",
+ "src/tracing/core",
]
- sources = [ "include/perfetto/tracing.h" ]
+ sources = [
+ "include/perfetto/tracing.h",
+ ]
assert_no_deps = [ "//gn:protobuf_lite" ]
}
}
@@ -227,8 +233,8 @@
deps = [
"src/trace_processor:export_json",
"src/trace_processor:storage_minimal",
- "src/tracing",
"src/tracing:client_api",
+ "src/tracing/core",
# TODO(eseckler): Create a platform for chrome and hook it up somehow.
"src/tracing:platform_fake",
@@ -248,15 +254,19 @@
"protos/perfetto/trace/track_event:zero",
]
if (enable_perfetto_ipc) {
- deps += [ "src/tracing:ipc" ]
+ deps += [ "src/tracing/ipc/producer" ]
public_deps += [ "include/perfetto/ext/tracing/ipc:ipc" ]
}
}
component("libtrace_processor") {
public_configs = [ "gn:public_config" ]
- deps = [ "src/trace_processor:lib" ]
+ deps = [
+ "src/trace_processor:lib",
+ ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
- public_deps = [ "include/perfetto/trace_processor" ]
+ public_deps = [
+ "include/perfetto/trace_processor",
+ ]
}
}
diff --git a/gn/perfetto_benchmarks.gni b/gn/perfetto_benchmarks.gni
index 0571557..2abd944 100644
--- a/gn/perfetto_benchmarks.gni
+++ b/gn/perfetto_benchmarks.gni
@@ -20,7 +20,7 @@
"src/traced/probes/ftrace:benchmarks",
"src/trace_processor/containers:benchmarks",
"src/trace_processor/tables:benchmarks",
- "src/tracing:benchmarks",
+ "src/tracing/core:benchmarks",
"src/traced/probes/ftrace/kallsyms:benchmarks",
"test:benchmark_main",
"test:end_to_end_benchmarks",
diff --git a/gn/perfetto_fuzzers.gni b/gn/perfetto_fuzzers.gni
index a82b74f..0a5dbfa 100644
--- a/gn/perfetto_fuzzers.gni
+++ b/gn/perfetto_fuzzers.gni
@@ -18,7 +18,7 @@
"gn:default_deps",
"src/ipc:buffered_frame_deserializer_fuzzer",
"src/protozero:protozero_decoder_fuzzer",
- "src/tracing:packet_stream_validator_fuzzer",
+ "src/tracing/core:packet_stream_validator_fuzzer",
"src/trace_processor:trace_processor_fuzzer",
"src/traced/probes/ftrace:cpu_reader_fuzzer",
"test:end_to_end_shared_memory_fuzzer",
diff --git a/gn/perfetto_integrationtests.gni b/gn/perfetto_integrationtests.gni
index 19b5189..d2b0181 100644
--- a/gn/perfetto_integrationtests.gni
+++ b/gn/perfetto_integrationtests.gni
@@ -17,7 +17,7 @@
perfetto_integrationtests_targets = [
"gn:default_deps",
"gn:gtest_main",
- "src/tracing:client_api_integrationtests",
+ "src/tracing/test:client_api_integrationtests",
]
if (enable_perfetto_platform_services) {
diff --git a/gn/perfetto_unittests.gni b/gn/perfetto_unittests.gni
index 3574664..ca956bc 100644
--- a/gn/perfetto_unittests.gni
+++ b/gn/perfetto_unittests.gni
@@ -19,8 +19,9 @@
"gn:gtest_main",
"src/base:unittests",
"src/protozero:unittests",
- "src/tracing:unittests",
+ "src/tracing/core:unittests",
"src/profiling:unittests",
+ "src/tracing/test:tracing_integration_test",
]
if (enable_perfetto_tools && current_toolchain == host_toolchain) {
@@ -36,7 +37,10 @@
}
if (enable_perfetto_ipc) {
- perfetto_unittests_targets += [ "src/ipc:unittests" ]
+ perfetto_unittests_targets += [
+ "src/tracing/ipc:unittests",
+ "src/ipc:unittests",
+ ]
}
if (enable_perfetto_platform_services) {
diff --git a/gn/proto_library.gni b/gn/proto_library.gni
index b6118bf..d92c669 100644
--- a/gn/proto_library.gni
+++ b/gn/proto_library.gni
@@ -149,7 +149,8 @@
"$perfetto_root_path/src/ipc/protoc_plugin:ipc_plugin"
generator_plugin_suffix = ".ipc"
deps = [
- "$perfetto_root_path/src/ipc",
+ "$perfetto_root_path/gn:default_deps",
+ "$perfetto_root_path/src/ipc:common",
]
if (defined(invoker.deps)) {
deps += invoker.deps
diff --git a/src/ipc/BUILD.gn b/src/ipc/BUILD.gn
index 3e48bb0..bd6ade2 100644
--- a/src/ipc/BUILD.gn
+++ b/src/ipc/BUILD.gn
@@ -21,26 +21,54 @@
# projects should be depending on our IPC layer.
assert(enable_perfetto_ipc)
-source_set("ipc") {
- public_configs = [ "../../gn:default_config" ]
+source_set("client") {
public_deps = [
"../../include/perfetto/ext/ipc",
"../base:unix_socket",
]
deps = [
+ ":common",
"../../gn:default_deps",
"../../protos/perfetto/ipc:wire_protocol_cpp",
"../base",
]
sources = [
- "buffered_frame_deserializer.cc",
- "buffered_frame_deserializer.h",
"client_impl.cc",
"client_impl.h",
- "deferred.cc",
+ "service_proxy.cc",
+ ]
+}
+
+source_set("host") {
+ public_deps = [
+ "../../include/perfetto/ext/ipc",
+ "../base:unix_socket",
+ ]
+ deps = [
+ ":common",
+ "../../gn:default_deps",
+ "../../protos/perfetto/ipc:wire_protocol_cpp",
+ "../base",
+ ]
+ sources = [
"host_impl.cc",
"host_impl.h",
- "service_proxy.cc",
+ ]
+}
+
+source_set("common") {
+ public_deps = [
+ "../../include/perfetto/ext/ipc",
+ "../../protos/perfetto/ipc:wire_protocol_cpp",
+ ]
+ deps = [
+ "../../gn:default_deps",
+ "../base",
+ ]
+ sources = [
+ "buffered_frame_deserializer.cc",
+ "buffered_frame_deserializer.h",
+ "deferred.cc",
"virtual_destructors.cc",
]
}
@@ -50,16 +78,19 @@
"buffered_frame_deserializer_fuzzer.cc",
]
deps = [
- ":ipc",
+ ":common",
"../../gn:default_deps",
"../../protos/perfetto/ipc:wire_protocol_cpp",
+ "../base",
]
}
perfetto_unittest_source_set("unittests") {
testonly = true
deps = [
- ":ipc",
+ ":client",
+ ":common",
+ ":host",
":test_messages_cpp",
":test_messages_ipc",
"../../gn:default_deps",
@@ -94,7 +125,8 @@
static_library("perfetto_ipc") {
complete_static_lib = true
deps = [
- ":ipc",
+ ":client",
+ ":host",
"../../gn:default_deps",
]
}
diff --git a/src/ipc/client_impl.cc b/src/ipc/client_impl.cc
index e2dbc35..f38ef6d 100644
--- a/src/ipc/client_impl.cc
+++ b/src/ipc/client_impl.cc
@@ -27,6 +27,8 @@
#include "perfetto/ext/ipc/service_descriptor.h"
#include "perfetto/ext/ipc/service_proxy.h"
+#include "protos/perfetto/ipc/wire_protocol.gen.h"
+
// TODO(primiano): Add ThreadChecker everywhere.
// TODO(primiano): Add timeouts.
diff --git a/src/ipc/client_impl.h b/src/ipc/client_impl.h
index 35dea50..ff9c7bc 100644
--- a/src/ipc/client_impl.h
+++ b/src/ipc/client_impl.h
@@ -17,20 +17,25 @@
#ifndef SRC_IPC_CLIENT_IMPL_H_
#define SRC_IPC_CLIENT_IMPL_H_
+#include <list>
+#include <map>
+#include <memory>
+
#include "perfetto/base/task_runner.h"
#include "perfetto/ext/base/scoped_file.h"
#include "perfetto/ext/base/unix_socket.h"
#include "perfetto/ext/ipc/client.h"
#include "src/ipc/buffered_frame_deserializer.h"
-#include "protos/perfetto/ipc/wire_protocol.gen.h"
-
-#include <list>
-#include <map>
-#include <memory>
-
namespace perfetto {
+namespace protos {
+namespace gen {
+class IPCFrame_BindServiceReply;
+class IPCFrame_InvokeMethodReply;
+} // namespace gen
+} // namespace protos
+
namespace base {
class TaskRunner;
} // namespace base
@@ -78,8 +83,10 @@
bool SendFrame(const Frame&, int fd = -1);
void OnFrameReceived(const Frame&);
- void OnBindServiceReply(QueuedRequest, const Frame::BindServiceReply&);
- void OnInvokeMethodReply(QueuedRequest, const Frame::InvokeMethodReply&);
+ void OnBindServiceReply(QueuedRequest,
+ const protos::gen::IPCFrame_BindServiceReply&);
+ void OnInvokeMethodReply(QueuedRequest,
+ const protos::gen::IPCFrame_InvokeMethodReply&);
bool invoking_method_reply_ = false;
std::unique_ptr<base::UnixSocket> sock_;
diff --git a/src/ipc/client_impl_unittest.cc b/src/ipc/client_impl_unittest.cc
index 42a5dd2..08ea09c 100644
--- a/src/ipc/client_impl_unittest.cc
+++ b/src/ipc/client_impl_unittest.cc
@@ -32,6 +32,7 @@
#include "src/ipc/test/test_socket.h"
#include "test/gtest_and_gmock.h"
+#include "protos/perfetto/ipc/wire_protocol.gen.h"
#include "src/ipc/test/client_unittest_messages.gen.h"
namespace perfetto {
diff --git a/src/ipc/service_proxy.cc b/src/ipc/service_proxy.cc
index e416f5f..7246a04 100644
--- a/src/ipc/service_proxy.cc
+++ b/src/ipc/service_proxy.cc
@@ -23,6 +23,8 @@
#include "perfetto/ext/ipc/service_descriptor.h"
#include "src/ipc/client_impl.h"
+#include "protos/perfetto/ipc/wire_protocol.gen.h"
+
namespace perfetto {
namespace ipc {
diff --git a/src/perfetto_cmd/BUILD.gn b/src/perfetto_cmd/BUILD.gn
index 6e920a9..d99e623 100644
--- a/src/perfetto_cmd/BUILD.gn
+++ b/src/perfetto_cmd/BUILD.gn
@@ -67,7 +67,7 @@
"../android_internal:lazy_library_loader",
"../base",
"../protozero",
- "../tracing:ipc",
+ "../tracing/ipc/consumer",
]
if (enable_perfetto_zlib) {
deps += [ "../../gn:zlib" ]
@@ -99,7 +99,7 @@
":trigger_producer",
"../../gn:default_deps",
"../base",
- "../tracing:ipc",
+ "../tracing/ipc/producer",
]
sources = [
"trigger_perfetto.cc",
@@ -114,7 +114,7 @@
deps = [
"../../gn:default_deps",
"../base",
- "../tracing:ipc",
+ "../tracing/ipc/producer",
]
}
@@ -138,7 +138,7 @@
"../../protos/perfetto/config:cpp",
"../../protos/perfetto/config/ftrace:cpp",
"../../protos/perfetto/trace:cpp",
- "../tracing",
+ "../tracing/core",
]
if (enable_perfetto_zlib) {
deps += [ "../../gn:zlib" ]
diff --git a/src/profiling/memory/BUILD.gn b/src/profiling/memory/BUILD.gn
index 1862fb4..3d3590b 100644
--- a/src/profiling/memory/BUILD.gn
+++ b/src/profiling/memory/BUILD.gn
@@ -27,7 +27,7 @@
"../../../src/base:unix_socket",
"../../../src/profiling/memory:daemon",
"../../../src/profiling/memory:wire_protocol",
- "../../../src/tracing:ipc",
+ "../../../src/tracing/ipc/producer",
]
sources = [
"main.cc",
@@ -148,8 +148,8 @@
"../../../protos/perfetto/config/profiling:cpp",
"../../base",
"../../base:unix_socket",
- "../../tracing",
- "../../tracing:ipc",
+ "../../tracing/core",
+ "../../tracing/ipc/producer",
]
public_deps = [
"../../../gn:libunwindstack",
@@ -213,7 +213,7 @@
"../../../include/perfetto/profiling:normalize",
"../../base",
"../../base:test_support",
- "../../tracing",
+ "../../tracing/core",
]
sources = [
"bookkeeping_unittest.cc",
@@ -263,7 +263,7 @@
":wire_protocol",
"../../../gn:default_deps",
"../../base",
- "../../tracing",
+ "../../tracing/core",
]
}
diff --git a/src/profiling/perf/BUILD.gn b/src/profiling/perf/BUILD.gn
index b864674..208df8a 100644
--- a/src/profiling/perf/BUILD.gn
+++ b/src/profiling/perf/BUILD.gn
@@ -36,7 +36,7 @@
":producer",
"../../../gn:default_deps",
"../../../src/base",
- "../../../src/tracing:ipc",
+ "../../../src/tracing/ipc/producer",
]
sources = [
"traced_perf.cc",
@@ -53,7 +53,7 @@
"../../../protos/perfetto/trace:zero",
"../../../src/base",
"../../../src/base:unix_socket",
- "../../../src/tracing:ipc",
+ "../../../src/tracing/ipc/producer",
]
public_deps = [
"../../../include/perfetto/tracing/core",
diff --git a/src/traced/probes/BUILD.gn b/src/traced/probes/BUILD.gn
index 6acb64a..7d37ec8 100644
--- a/src/traced/probes/BUILD.gn
+++ b/src/traced/probes/BUILD.gn
@@ -37,7 +37,7 @@
deps = [
":probes_src",
"../../../gn:default_deps",
- "../../tracing:ipc",
+ "../../tracing/ipc/producer",
]
if (enable_perfetto_version_gen) {
deps += [ "//gn/standalone:gen_git_revision" ]
@@ -56,10 +56,11 @@
"../../../gn:default_deps",
"../../../include/perfetto/ext/traced",
"../../../protos/perfetto/config/ftrace:cpp",
+ "../../../protos/perfetto/trace:zero",
"../../../protos/perfetto/trace/ps:zero",
"../../base",
- "../../tracing:ipc",
- "../../tracing:tracing",
+ "../../tracing/core",
+ "../../tracing/ipc/producer",
"android_log",
"filesystem",
"metatrace",
@@ -79,7 +80,7 @@
source_set("data_source") {
deps = [
"../../../gn:default_deps",
- "../../tracing",
+ "../../tracing/core",
]
sources = [
"probes_data_source.cc",
@@ -93,7 +94,7 @@
":probes_src",
"../../../gn:default_deps",
"../../../gn:gtest_and_gmock",
- "../../tracing:test_support",
+ "../../tracing/test:test_support",
"android_log:unittests",
"filesystem:unittests",
"packages_list:unittests",
diff --git a/src/traced/probes/android_log/BUILD.gn b/src/traced/probes/android_log/BUILD.gn
index cc25cd4..d2ab1af 100644
--- a/src/traced/probes/android_log/BUILD.gn
+++ b/src/traced/probes/android_log/BUILD.gn
@@ -16,7 +16,7 @@
source_set("android_log") {
public_deps = [
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
"..:data_source",
@@ -24,6 +24,7 @@
"../../../../include/perfetto/ext/traced",
"../../../../protos/perfetto/common:zero",
"../../../../protos/perfetto/config/android:zero",
+ "../../../../protos/perfetto/trace:zero",
"../../../../protos/perfetto/trace/android:zero",
"../../../base",
]
@@ -43,7 +44,7 @@
"../../../../protos/perfetto/config/android:cpp",
"../../../../protos/perfetto/trace/android:cpp",
"../../../../src/base:test_support",
- "../../../../src/tracing:test_support",
+ "../../../../src/tracing/test:test_support",
]
sources = [
"android_log_data_source_unittest.cc",
diff --git a/src/traced/probes/filesystem/BUILD.gn b/src/traced/probes/filesystem/BUILD.gn
index d3aeba5..faf101a 100644
--- a/src/traced/probes/filesystem/BUILD.gn
+++ b/src/traced/probes/filesystem/BUILD.gn
@@ -17,13 +17,14 @@
source_set("filesystem") {
public_deps = [
"../../../../protos/perfetto/trace/filesystem:zero",
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
"..:data_source",
"../../../../gn:default_deps",
"../../../../include/perfetto/ext/traced",
"../../../../protos/perfetto/config/inode_file:zero",
+ "../../../../protos/perfetto/trace:zero",
"../../../base",
]
sources = [
diff --git a/src/traced/probes/ftrace/BUILD.gn b/src/traced/probes/ftrace/BUILD.gn
index 02ef384..f108183 100644
--- a/src/traced/probes/ftrace/BUILD.gn
+++ b/src/traced/probes/ftrace/BUILD.gn
@@ -57,7 +57,7 @@
"../../../../protos/perfetto/trace/ftrace:cpp",
"../../../../protos/perfetto/trace/ftrace:zero",
"../../../base:test_support",
- "../../../tracing:test_support",
+ "../../../tracing/test:test_support",
]
sources = [
"cpu_reader_unittest.cc",
@@ -94,7 +94,7 @@
"../../../../gn:default_deps",
"../../../../gn:gtest_and_gmock",
"../../../base",
- "../../../tracing",
+ "../../../tracing/core",
]
sources = [
"ftrace_procfs_integrationtest.cc",
@@ -105,13 +105,14 @@
public_deps = [
"../../../../protos/perfetto/config/ftrace:cpp",
"../../../../protos/perfetto/trace/ftrace:zero",
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
":format_parser",
"..:data_source",
"../../../../gn:default_deps",
"../../../../include/perfetto/ext/traced",
+ "../../../../protos/perfetto/trace:zero",
"../../../android_internal:lazy_library_loader",
"../../../base",
"../../../protozero",
diff --git a/src/traced/probes/metatrace/BUILD.gn b/src/traced/probes/metatrace/BUILD.gn
index 489b85a..c53789b 100644
--- a/src/traced/probes/metatrace/BUILD.gn
+++ b/src/traced/probes/metatrace/BUILD.gn
@@ -14,15 +14,17 @@
source_set("metatrace") {
public_deps = [
- "../../../tracing",
+ "../../../tracing/core",
+ "../../../tracing/core:service",
]
deps = [
"..:data_source",
"../../../../gn:default_deps",
"../../../../include/perfetto/ext/traced",
+ "../../../../protos/perfetto/trace:zero",
"../../../../protos/perfetto/trace/perfetto:zero",
"../../../base",
- "../../../tracing",
+ "../../../tracing/core",
]
sources = [
"metatrace_data_source.cc",
diff --git a/src/traced/probes/packages_list/BUILD.gn b/src/traced/probes/packages_list/BUILD.gn
index eaee21d..66ef1ff 100644
--- a/src/traced/probes/packages_list/BUILD.gn
+++ b/src/traced/probes/packages_list/BUILD.gn
@@ -16,7 +16,7 @@
source_set("packages_list") {
public_deps = [
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
"..:data_source",
@@ -24,6 +24,7 @@
"../../../../include/perfetto/ext/traced",
"../../../../protos/perfetto/common:zero",
"../../../../protos/perfetto/config/android:zero",
+ "../../../../protos/perfetto/trace:zero",
"../../../../protos/perfetto/trace/android:zero",
"../../../base",
]
@@ -42,7 +43,7 @@
"../../../../protos/perfetto/trace/android:cpp",
"../../../../protos/perfetto/trace/android:zero",
"../../../../src/base:test_support",
- "../../../../src/tracing:test_support",
+ "../../../../src/tracing/test:test_support",
]
sources = [
"packages_list_data_source_unittest.cc",
diff --git a/src/traced/probes/power/BUILD.gn b/src/traced/probes/power/BUILD.gn
index d3af4a3..a05c08c 100644
--- a/src/traced/probes/power/BUILD.gn
+++ b/src/traced/probes/power/BUILD.gn
@@ -14,13 +14,14 @@
source_set("power") {
public_deps = [
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
"..:data_source",
"../../../../gn:default_deps",
"../../../../include/perfetto/ext/traced",
"../../../../protos/perfetto/config/power:zero",
+ "../../../../protos/perfetto/trace:zero",
"../../../../protos/perfetto/trace/power:zero",
"../../../android_internal:lazy_library_loader",
"../../../base",
diff --git a/src/traced/probes/ps/BUILD.gn b/src/traced/probes/ps/BUILD.gn
index 85c24bc..fefe74f 100644
--- a/src/traced/probes/ps/BUILD.gn
+++ b/src/traced/probes/ps/BUILD.gn
@@ -16,13 +16,14 @@
source_set("ps") {
public_deps = [
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
"..:data_source",
"../../../../gn:default_deps",
"../../../../include/perfetto/ext/traced",
"../../../../protos/perfetto/config/process_stats:zero",
+ "../../../../protos/perfetto/trace:zero",
"../../../../protos/perfetto/trace/ps:zero",
"../../../base",
]
@@ -41,7 +42,7 @@
"../../../../protos/perfetto/config/process_stats:cpp",
"../../../../protos/perfetto/trace/ps:cpp",
"../../../../src/base:test_support",
- "../../../../src/tracing:test_support",
+ "../../../../src/tracing/test:test_support",
]
sources = [
"process_stats_data_source_unittest.cc",
diff --git a/src/traced/probes/sys_stats/BUILD.gn b/src/traced/probes/sys_stats/BUILD.gn
index efea7a9..39105c1 100644
--- a/src/traced/probes/sys_stats/BUILD.gn
+++ b/src/traced/probes/sys_stats/BUILD.gn
@@ -16,7 +16,7 @@
source_set("sys_stats") {
public_deps = [
- "../../../tracing",
+ "../../../tracing/core",
]
deps = [
"..:data_source",
@@ -25,6 +25,7 @@
"../../../../include/perfetto/ext/traced:sys_stats_counters",
"../../../../protos/perfetto/common:zero",
"../../../../protos/perfetto/config/sys_stats:zero",
+ "../../../../protos/perfetto/trace:zero",
"../../../../protos/perfetto/trace/sys_stats:zero",
"../../../base",
]
@@ -43,7 +44,7 @@
"../../../../protos/perfetto/config/sys_stats:cpp",
"../../../../protos/perfetto/trace/sys_stats:cpp",
"../../../../src/base:test_support",
- "../../../../src/tracing:test_support",
+ "../../../../src/tracing/test:test_support",
]
sources = [
"sys_stats_data_source_unittest.cc",
diff --git a/src/traced/service/BUILD.gn b/src/traced/service/BUILD.gn
index 340d3fa..4ce7484 100644
--- a/src/traced/service/BUILD.gn
+++ b/src/traced/service/BUILD.gn
@@ -42,8 +42,9 @@
deps = [
"../../../gn:default_deps",
"../../base",
- "../../tracing",
- "../../tracing:ipc",
+ "../../tracing/core",
+ "../../tracing/core:service",
+ "../../tracing/ipc/service",
]
if (enable_perfetto_version_gen) {
deps += [ "//gn/standalone:gen_git_revision" ]
@@ -63,7 +64,7 @@
"../../../gn:gtest_and_gmock",
"../../base",
"../../base:test_support",
- "../../tracing",
+ "../../tracing/core",
]
sources = [
"builtin_producer_unittest.cc",
diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn
index 2ebb7da..12bd8a7 100644
--- a/src/tracing/BUILD.gn
+++ b/src/tracing/BUILD.gn
@@ -17,184 +17,6 @@
import("../../gn/perfetto.gni")
import("../../gn/test.gni")
-# Core tracing library, platform independent, no transport layer.
-source_set("tracing") {
- public_deps = [
- ":common",
- "../../include/perfetto/ext/tracing/core",
- "../../protos/perfetto/trace:zero",
- "../../protos/perfetto/trace/interned_data:zero",
- "../../protos/perfetto/trace/track_event:zero",
- ]
- deps = [
- "../../gn:default_deps",
- "../../include/perfetto/tracing",
- "../../protos/perfetto/common:zero",
- "../../protos/perfetto/config:zero",
- "../../protos/perfetto/trace/perfetto:zero", # For MetatraceWriter.
- "../base",
- "../protozero",
- ]
- sources = [
- "core/id_allocator.cc",
- "core/id_allocator.h",
- "core/metatrace_writer.cc",
- "core/metatrace_writer.h",
- "core/null_trace_writer.cc",
- "core/null_trace_writer.h",
- "core/packet_stream_validator.cc",
- "core/packet_stream_validator.h",
- "core/patch_list.h",
- "core/shared_memory_abi.cc",
- "core/shared_memory_arbiter_impl.cc",
- "core/shared_memory_arbiter_impl.h",
- "core/startup_trace_writer.cc",
- "core/startup_trace_writer_registry.cc",
- "core/trace_buffer.cc",
- "core/trace_buffer.h",
- "core/trace_packet.cc",
- "core/trace_writer_impl.cc",
- "core/trace_writer_impl.h",
- "core/tracing_service_impl.cc",
- "core/tracing_service_impl.h",
- "core/virtual_destructors.cc",
- ]
-}
-
-perfetto_unittest_source_set("unittests") {
- testonly = true
- deps = [
- ":test_support",
- ":tracing",
- "../../gn:default_deps",
- "../../gn:gtest_and_gmock",
- "../../protos/perfetto/trace:cpp",
- "../../protos/perfetto/trace:zero",
- "../../protos/perfetto/trace/ftrace:cpp",
- "../base",
- "../base:test_support",
- ]
- sources = [
- "core/id_allocator_unittest.cc",
- "core/null_trace_writer_unittest.cc",
- "core/packet_stream_validator_unittest.cc",
- "core/patch_list_unittest.cc",
- "core/shared_memory_abi_unittest.cc",
- "core/trace_buffer_unittest.cc",
- "core/trace_packet_unittest.cc",
- "test/aligned_buffer_test.cc",
- "test/aligned_buffer_test.h",
- "test/fake_packet.cc",
- "test/fake_packet.h",
- "test/test_shared_memory.cc",
- "test/test_shared_memory.h",
- ]
-
- if (enable_perfetto_ipc) {
- deps += [ ":ipc" ]
- sources += [
- "ipc/posix_shared_memory_unittest.cc",
- "test/tracing_integration_test.cc",
- ]
- }
-
- # These tests rely on test_task_runner.h which
- # has no Windows implementation.
- if (!is_win) {
- sources += [
- "core/shared_memory_arbiter_impl_unittest.cc",
- "core/startup_trace_writer_unittest.cc",
- "core/trace_writer_impl_unittest.cc",
- "core/tracing_service_impl_unittest.cc",
- "test/fake_producer_endpoint.h",
- "test/mock_consumer.cc",
- "test/mock_consumer.h",
- "test/mock_producer.cc",
- "test/mock_producer.h",
- ]
- }
-}
-
-source_set("test_support") {
- testonly = true
- public_deps = [
- "../../include/perfetto/ext/tracing/core",
- "../../protos/perfetto/trace:cpp",
- "../../protos/perfetto/trace:zero",
- "../protozero",
- ]
- sources = [
- "core/trace_writer_for_testing.cc",
- "core/trace_writer_for_testing.h",
- ]
-}
-
-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:cpp",
- "../../protos/perfetto/config/ftrace:cpp",
- "../../protos/perfetto/trace:cpp",
- "../../protos/perfetto/trace/ftrace:cpp",
- "../base",
- ]
- sources = [ "api_impl/consumer_api_test.cc" ]
- }
-
- # Imlementation of the public-facing consumer API in libperfetto.so (only for
- # Android builds).
- # TODO(primiano): remove this. This is a legacy and deprecated API. The only
- # uses should be moved to the perfetto Client API.
- source_set("consumer_api_deprecated") {
- deps = [
- ":ipc",
- ":tracing",
- "../../gn:default_deps",
- "../../include/perfetto/public",
- "../../protos/perfetto/config:cpp",
- "../base",
- ]
- sources = [ "api_impl/consumer_api.cc" ]
- }
-}
-
-if (enable_perfetto_ipc) {
- # Posix specialization of the tracing library for Linux / Android / Mac.
- # Provides an IPC transport over a UNIX domain socket.
- source_set("ipc") {
- public_deps = [
- "../../include/perfetto/ext/tracing/core",
- "../../include/perfetto/ext/tracing/ipc",
- ]
- sources = [
- "ipc/consumer/consumer_ipc_client_impl.cc",
- "ipc/consumer/consumer_ipc_client_impl.h",
- "ipc/default_socket.cc",
- "ipc/posix_shared_memory.cc",
- "ipc/posix_shared_memory.h",
- "ipc/producer/producer_ipc_client_impl.cc",
- "ipc/producer/producer_ipc_client_impl.h",
- "ipc/service/consumer_ipc_service.cc",
- "ipc/service/consumer_ipc_service.h",
- "ipc/service/producer_ipc_service.cc",
- "ipc/service/producer_ipc_service.h",
- "ipc/service/service_ipc_host_impl.cc",
- "ipc/service/service_ipc_host_impl.h",
- ]
- deps = [
- ":tracing",
- "../../gn:default_deps",
- "../../protos/perfetto/ipc",
- "../base",
- "../ipc",
- ]
- }
-}
-
# Separate target because the embedder might not want this (e.g. on Windows).
if (is_linux || is_mac || is_android) {
source_set("platform_posix") {
@@ -203,7 +25,9 @@
"../../include/perfetto/tracing",
"../base",
]
- sources = [ "platform_posix.cc" ]
+ sources = [
+ "platform_posix.cc",
+ ]
}
}
@@ -214,7 +38,9 @@
"../../gn:default_deps",
"../../include/perfetto/tracing",
]
- sources = [ "platform_fake.cc" ]
+ sources = [
+ "platform_fake.cc",
+ ]
}
# Code that both public headers and other non-public sources (e.g.
@@ -226,16 +52,17 @@
"../../gn:default_deps",
"../../include/perfetto/tracing",
]
- sources = [ "trace_writer_base.cc" ]
+ sources = [
+ "trace_writer_base.cc",
+ ]
}
source_set("client_api") {
deps = [
- ":common",
"../../include/perfetto/tracing/core",
"../../protos/perfetto/config:cpp",
"../base",
- "../tracing",
+ "core",
]
public_deps = [
"../../gn:default_deps",
@@ -258,62 +85,14 @@
]
if (enable_perfetto_ipc) {
- deps += [ ":ipc" ]
+ deps += [
+ "ipc/consumer",
+ "ipc/producer",
+ "ipc/service",
+ ]
sources += [
"internal/system_tracing_backend.cc",
"internal/system_tracing_backend.h",
]
}
}
-
-if (enable_perfetto_integration_tests) {
- source_set("client_api_integrationtests") {
- testonly = true
- deps = [
- ":client_api",
- ":platform_posix",
- "../../:libperfetto_client_experimental",
- "../../gn:default_deps",
- "../../gn:gtest_and_gmock",
- "../../include/perfetto/tracing/core",
- "../../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",
- ]
- sources = [
- "api_integrationtest.cc",
- "test/tracing_module.cc",
- "test/tracing_module.h",
- "test/tracing_module2.cc",
- "test/tracing_module_categories.h",
- ]
- }
-}
-
-if (enable_perfetto_benchmarks) {
- source_set("benchmarks") {
- testonly = true
- deps = [
- ":tracing",
- "../../../../gn:benchmark",
- "../../../../gn:default_deps",
- "../../protos/perfetto/trace:zero",
- "../../protos/perfetto/trace/ftrace:zero",
- "../protozero",
- ]
- sources = [ "core/packet_stream_validator_benchmark.cc" ]
- }
-}
-
-perfetto_fuzzer_test("packet_stream_validator_fuzzer") {
- sources = [ "core/packet_stream_validator_fuzzer.cc" ]
- deps = [
- ":tracing",
- "../../../../gn:default_deps",
- ]
-}
diff --git a/src/tracing/consumer_api_deprecated/BUILD.gn b/src/tracing/consumer_api_deprecated/BUILD.gn
new file mode 100644
index 0000000..de4cc65
--- /dev/null
+++ b/src/tracing/consumer_api_deprecated/BUILD.gn
@@ -0,0 +1,54 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Imlementation of the public-facing consumer API in libperfetto.so (only for
+# Android builds).
+# TODO(primiano): remove this. This is a legacy and deprecated API. The only
+# user is iorap which should be moved to the perfetto Client API.
+
+import("../../../gn/perfetto.gni")
+import("../../../gn/test.gni")
+
+assert(perfetto_build_standalone || perfetto_build_with_android)
+
+source_set("consumer_api_deprecated") {
+ deps = [
+ "../../../gn:default_deps",
+ "../../../include/perfetto/public",
+ "../../../protos/perfetto/config:cpp",
+ "../../base",
+ "../core",
+ "../ipc/consumer",
+ ]
+ sources = [
+ "consumer_api_deprecated.cc",
+ ]
+}
+
+executable("consumer_api_test") {
+ testonly = true
+ deps = [
+ ":consumer_api_deprecated",
+ "../../../gn:default_deps",
+ "../../../include/perfetto/public",
+ "../../../protos/perfetto/config:cpp",
+ "../../../protos/perfetto/config/ftrace:cpp",
+ "../../../protos/perfetto/trace:cpp",
+ "../../../protos/perfetto/trace/ftrace:cpp",
+ "../../base",
+ ]
+ sources = [
+ "consumer_api_deprecated_test.cc",
+ ]
+}
diff --git a/src/tracing/api_impl/consumer_api.cc b/src/tracing/consumer_api_deprecated/consumer_api_deprecated.cc
similarity index 100%
rename from src/tracing/api_impl/consumer_api.cc
rename to src/tracing/consumer_api_deprecated/consumer_api_deprecated.cc
diff --git a/src/tracing/api_impl/consumer_api_test.cc b/src/tracing/consumer_api_deprecated/consumer_api_deprecated_test.cc
similarity index 100%
rename from src/tracing/api_impl/consumer_api_test.cc
rename to src/tracing/consumer_api_deprecated/consumer_api_deprecated_test.cc
diff --git a/src/tracing/core/BUILD.gn b/src/tracing/core/BUILD.gn
new file mode 100644
index 0000000..fce4719
--- /dev/null
+++ b/src/tracing/core/BUILD.gn
@@ -0,0 +1,154 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("../../../gn/fuzzer.gni")
+import("../../../gn/perfetto.gni")
+import("../../../gn/test.gni")
+
+# Core tracing library, platform independent, no IPC layer, no service.
+source_set("core") {
+ public_deps = [
+ "../../../include/perfetto/ext/tracing/core",
+ "../../protozero",
+ ]
+ deps = [
+ "..:common",
+ "../../../gn:default_deps",
+ "../../../include/perfetto/tracing",
+ "../../../protos/perfetto/trace:zero",
+ "../../base",
+ ]
+ sources = [
+ "id_allocator.cc",
+ "id_allocator.h",
+ "null_trace_writer.cc",
+ "null_trace_writer.h",
+ "patch_list.h",
+ "shared_memory_abi.cc",
+ "shared_memory_arbiter_impl.cc",
+ "shared_memory_arbiter_impl.h",
+ "startup_trace_writer.cc",
+ "startup_trace_writer_registry.cc",
+ "trace_packet.cc",
+ "trace_writer_impl.cc",
+ "trace_writer_impl.h",
+ "virtual_destructors.cc",
+ ]
+}
+
+source_set("service") {
+ public_deps = [
+ "..:common",
+ "../../../include/perfetto/ext/base",
+ "../../../include/perfetto/ext/tracing/core",
+ ]
+ deps = [
+ ":core",
+ "../../../gn:default_deps",
+ "../../../include/perfetto/tracing",
+ "../../../protos/perfetto/common:zero",
+ "../../../protos/perfetto/config:zero",
+ "../../../protos/perfetto/trace:zero",
+ "../../../protos/perfetto/trace/perfetto:zero", # For MetatraceWriter.
+ "../../base",
+ ]
+ sources = [
+ "metatrace_writer.cc",
+ "metatrace_writer.h",
+ "packet_stream_validator.cc",
+ "packet_stream_validator.h",
+ "trace_buffer.cc",
+ "trace_buffer.h",
+ "tracing_service_impl.cc",
+ "tracing_service_impl.h",
+ ]
+}
+
+perfetto_unittest_source_set("unittests") {
+ testonly = true
+ deps = [
+ ":core",
+ ":service",
+ "../../../gn:default_deps",
+ "../../../gn:gtest_and_gmock",
+ "../../../protos/perfetto/trace:cpp",
+ "../../../protos/perfetto/trace:zero",
+ "../../../protos/perfetto/trace/ftrace:cpp",
+ "../../base",
+ "../../base:test_support",
+ "../test:test_support",
+ ]
+ sources = [
+ "id_allocator_unittest.cc",
+ "null_trace_writer_unittest.cc",
+ "packet_stream_validator_unittest.cc",
+ "patch_list_unittest.cc",
+ "shared_memory_abi_unittest.cc",
+ "trace_buffer_unittest.cc",
+ "trace_packet_unittest.cc",
+ ]
+
+ # These tests rely on test_task_runner.h which
+ # has no Windows implementation.
+ if (!is_win) {
+ sources += [
+ "shared_memory_arbiter_impl_unittest.cc",
+ "startup_trace_writer_unittest.cc",
+ "trace_writer_impl_unittest.cc",
+ "tracing_service_impl_unittest.cc",
+ ]
+ }
+}
+
+perfetto_unittest_source_set("test_support") {
+ testonly = true
+ public_deps = [
+ "../../../include/perfetto/ext/tracing/core",
+ "../../../protos/perfetto/trace:cpp",
+ "../../../protos/perfetto/trace:zero",
+ "../../protozero",
+ ]
+ sources = [
+ "trace_writer_for_testing.cc",
+ "trace_writer_for_testing.h",
+ ]
+}
+
+if (enable_perfetto_benchmarks) {
+ source_set("benchmarks") {
+ testonly = true
+ deps = [
+ ":core",
+ ":service",
+ "../../../../../gn:benchmark",
+ "../../../../../gn:default_deps",
+ "../../../protos/perfetto/trace:zero",
+ "../../../protos/perfetto/trace/ftrace:zero",
+ "../../protozero",
+ ]
+ sources = [
+ "packet_stream_validator_benchmark.cc",
+ ]
+ }
+}
+
+perfetto_fuzzer_test("packet_stream_validator_fuzzer") {
+ sources = [
+ "packet_stream_validator_fuzzer.cc",
+ ]
+ deps = [
+ ":service",
+ "../../../../../gn:default_deps",
+ ]
+}
diff --git a/src/tracing/ipc/BUILD.gn b/src/tracing/ipc/BUILD.gn
new file mode 100644
index 0000000..055e2e6
--- /dev/null
+++ b/src/tracing/ipc/BUILD.gn
@@ -0,0 +1,55 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("../../../gn/perfetto.gni")
+import("../../../gn/test.gni")
+
+assert(enable_perfetto_ipc)
+
+# The lack of a default "ipc" target is deliberate. Clients need to explicitly
+# depend on ipc/{producer, consumer, service}. This is to avoid binary bloat
+# by always linking everything.
+
+source_set("common") {
+ public_deps = [
+ "../../../include/perfetto/ext/tracing/core",
+ "../../../include/perfetto/ext/tracing/ipc",
+ ]
+ sources = [
+ "default_socket.cc",
+ "posix_shared_memory.cc",
+ "posix_shared_memory.h",
+ ]
+ deps = [
+ "../../../gn:default_deps",
+ "../../../include/perfetto/ext/ipc",
+ "../../base",
+ "../core",
+ ]
+}
+
+perfetto_unittest_source_set("unittests") {
+ testonly = true
+ deps = [
+ ":common",
+ "../../../gn:default_deps",
+ "../../../gn:gtest_and_gmock",
+ "../../../include/perfetto/ext/ipc",
+ "../../base",
+ "../../base:test_support",
+ ]
+ sources = [
+ "posix_shared_memory_unittest.cc",
+ ]
+}
diff --git a/src/tracing/ipc/consumer/BUILD.gn b/src/tracing/ipc/consumer/BUILD.gn
new file mode 100644
index 0000000..0a2dcc2
--- /dev/null
+++ b/src/tracing/ipc/consumer/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("../../../../gn/perfetto.gni")
+
+assert(enable_perfetto_ipc)
+
+# Posix specialization of the tracing library for Linux / Android / Mac.
+# Provides an IPC transport over a UNIX socket for the consumer interface.
+source_set("consumer") {
+ public_deps = [
+ "../../../../include/perfetto/ext/tracing/core",
+ "../../../../include/perfetto/ext/tracing/ipc",
+ "../../../../protos/perfetto/ipc",
+ ]
+ sources = [
+ "consumer_ipc_client_impl.cc",
+ "consumer_ipc_client_impl.h",
+ ]
+ deps = [
+ "..:common",
+ "../../../../gn:default_deps",
+ "../../../base",
+ "../../../ipc:client",
+ ]
+}
diff --git a/src/tracing/ipc/consumer/consumer_ipc_client_impl.h b/src/tracing/ipc/consumer/consumer_ipc_client_impl.h
index e65f1fc..66c7943 100644
--- a/src/tracing/ipc/consumer/consumer_ipc_client_impl.h
+++ b/src/tracing/ipc/consumer/consumer_ipc_client_impl.h
@@ -29,6 +29,7 @@
#include "perfetto/ext/tracing/core/tracing_service.h"
#include "perfetto/ext/tracing/ipc/consumer_ipc_client.h"
#include "perfetto/tracing/core/forward_decls.h"
+
#include "protos/perfetto/ipc/consumer_port.ipc.h"
namespace perfetto {
diff --git a/src/tracing/ipc/producer/BUILD.gn b/src/tracing/ipc/producer/BUILD.gn
new file mode 100644
index 0000000..c7e0d8a
--- /dev/null
+++ b/src/tracing/ipc/producer/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("../../../../gn/perfetto.gni")
+
+assert(enable_perfetto_ipc)
+
+# Posix specialization of the tracing library for Linux / Android / Mac.
+# Provides an IPC transport over a UNIX socket for the producer interface.
+source_set("producer") {
+ public_deps = [
+ "../../../../include/perfetto/ext/tracing/core",
+ "../../../../include/perfetto/ext/tracing/ipc",
+ "../../../../protos/perfetto/ipc",
+ ]
+ sources = [
+ "producer_ipc_client_impl.cc",
+ "producer_ipc_client_impl.h",
+ ]
+ deps = [
+ "..:common",
+ "../../../../gn:default_deps",
+ "../../../base",
+ "../../../ipc:client",
+ ]
+}
diff --git a/src/tracing/ipc/service/BUILD.gn b/src/tracing/ipc/service/BUILD.gn
new file mode 100644
index 0000000..0bc401c
--- /dev/null
+++ b/src/tracing/ipc/service/BUILD.gn
@@ -0,0 +1,42 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("../../../../gn/perfetto.gni")
+
+assert(enable_perfetto_ipc)
+
+# Posix specialization of the tracing library for Linux / Android / Mac.
+# Provides an IPC transport over a UNIX socket for the service interface.
+source_set("service") {
+ public_deps = [
+ "../../../../include/perfetto/ext/tracing/core",
+ "../../../../include/perfetto/ext/tracing/ipc",
+ ]
+ sources = [
+ "consumer_ipc_service.cc",
+ "consumer_ipc_service.h",
+ "producer_ipc_service.cc",
+ "producer_ipc_service.h",
+ "service_ipc_host_impl.cc",
+ "service_ipc_host_impl.h",
+ ]
+ deps = [
+ "..:common",
+ "../../../../gn:default_deps",
+ "../../../../protos/perfetto/ipc",
+ "../../../base",
+ "../../../ipc:host",
+ "../../core:service",
+ ]
+}
diff --git a/src/tracing/test/BUILD.gn b/src/tracing/test/BUILD.gn
index 2c99bc9..a364635 100644
--- a/src/tracing/test/BUILD.gn
+++ b/src/tracing/test/BUILD.gn
@@ -12,6 +12,100 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import("../../../gn/fuzzer.gni")
+import("../../../gn/perfetto.gni")
+import("../../../gn/test.gni")
+
+perfetto_unittest_source_set("test_support") {
+ testonly = true
+ public_deps = [
+ "../core:test_support",
+ ]
+ deps = [
+ "../../../gn:default_deps",
+ "../../../gn:gtest_and_gmock",
+ "../../../protos/perfetto/trace:cpp",
+ "../../../protos/perfetto/trace:zero",
+ "../../../protos/perfetto/trace/ftrace:cpp",
+ "../../base",
+ "../../base:test_support",
+ "../core",
+ "../core:service",
+ "../core:test_support",
+ ]
+ sources = [
+ "aligned_buffer_test.cc",
+ "aligned_buffer_test.h",
+ "fake_packet.cc",
+ "fake_packet.h",
+ "test_shared_memory.cc",
+ "test_shared_memory.h",
+ ]
+
+ # These tests rely on test_task_runner.h which
+ # has no Windows implementation.
+ if (!is_win) {
+ sources += [
+ "fake_producer_endpoint.h",
+ "mock_consumer.cc",
+ "mock_consumer.h",
+ "mock_producer.cc",
+ "mock_producer.h",
+ ]
+ }
+}
+
+perfetto_unittest_source_set("tracing_integration_test") {
+ testonly = true
+ deps = [
+ ":test_support",
+ "../../../gn:default_deps",
+ "../../../gn:gtest_and_gmock",
+ "../../base",
+ "../../base:test_support",
+ "../core:service",
+ ]
+ if (enable_perfetto_ipc) {
+ deps += [
+ "../ipc/consumer",
+ "../ipc/producer",
+ "../ipc/service",
+ ]
+ }
+ sources = [
+ "tracing_integration_test.cc",
+ ]
+}
+
+if (enable_perfetto_integration_tests) {
+ source_set("client_api_integrationtests") {
+ testonly = true
+ deps = [
+ ":api_test_support",
+ "../:client_api",
+ "../:platform_posix",
+ "../../../:libperfetto_client_experimental",
+ "../../../gn:default_deps",
+ "../../../gn:gtest_and_gmock",
+ "../../../include/perfetto/tracing/core",
+ "../../../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",
+ ]
+ sources = [
+ "api_integrationtest.cc",
+ "tracing_module.cc",
+ "tracing_module.h",
+ "tracing_module2.cc",
+ "tracing_module_categories.h",
+ ]
+ }
+}
+
# api_test_support needs to be self-contained and not leak any other perfetto
# deps. See comment in api_test_support.h
source_set("api_test_support") {
diff --git a/src/tracing/api_integrationtest.cc b/src/tracing/test/api_integrationtest.cc
similarity index 98%
rename from src/tracing/api_integrationtest.cc
rename to src/tracing/test/api_integrationtest.cc
index 63a682e..b633582 100644
--- a/src/tracing/api_integrationtest.cc
+++ b/src/tracing/test/api_integrationtest.cc
@@ -1288,22 +1288,21 @@
tracing_session->get()->StartBlocking();
size_t body_iid;
- TRACE_EVENT_BEGIN(
- "foo", "EventWithState", [&](perfetto::EventContext ctx) {
- // Test using a dynamically created interned value.
- body_iid = InternedLogMessageBodyHashed::Get(
- &ctx, std::string("Though this ") + "be madness,");
- auto log = ctx.event()->set_log_message();
- log->set_body_iid(body_iid);
+ TRACE_EVENT_BEGIN("foo", "EventWithState", [&](perfetto::EventContext ctx) {
+ // Test using a dynamically created interned value.
+ body_iid = InternedLogMessageBodyHashed::Get(
+ &ctx, std::string("Though this ") + "be madness,");
+ auto log = ctx.event()->set_log_message();
+ log->set_body_iid(body_iid);
- auto body_iid2 =
- InternedLogMessageBodyHashed::Get(&ctx, "Though this be madness,");
- EXPECT_EQ(body_iid, body_iid2);
+ auto body_iid2 =
+ InternedLogMessageBodyHashed::Get(&ctx, "Though this be madness,");
+ EXPECT_EQ(body_iid, body_iid2);
- auto body_iid3 =
- InternedLogMessageBodyHashed::Get(&ctx, "yet there is method in’t");
- EXPECT_NE(body_iid, body_iid3);
- });
+ auto body_iid3 =
+ InternedLogMessageBodyHashed::Get(&ctx, "yet there is method in’t");
+ EXPECT_NE(body_iid, body_iid3);
+ });
TRACE_EVENT_END("foo");
tracing_session->get()->StopBlocking();
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 0fe00be..46c3ff9 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -76,8 +76,9 @@
"../protos/perfetto/trace:zero",
"../src/base:test_support",
"../src/protozero",
- "../src/tracing",
- "../src/tracing:ipc",
+ "../src/tracing/core",
+ "../src/tracing/ipc/producer",
+ "../src/tracing/ipc/service",
]
}
@@ -98,7 +99,9 @@
testonly = true
public_deps = [
"../protos/perfetto/trace:cpp",
- "../src/tracing:ipc",
+ "../src/tracing/ipc/consumer",
+ "../src/tracing/ipc/producer",
+ "../src/tracing/ipc/service",
]
deps = [
"../gn:default_deps",
@@ -107,7 +110,6 @@
"../protos/perfetto/trace:zero",
"../src/base:test_support",
"../src/traced/probes:probes_src",
- "../src/tracing:ipc",
]
sources = [
"fake_producer.cc",