Split executables and introduce common shared library
[Splitting this CL off https://android-review.googlesource.com/c/platform/external/perfetto/+/575382]
This CL turns the perfetto daemons into two standalone
executables. Given the amount of shared code between the
two (traced and traced_probes) the code is shared in a
.so library.
Change-Id: I370a536ed3576e991e01032c183f7cdf61a4b7d3
diff --git a/Android.bp b/Android.bp
index e833d98..429038f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,6 +14,74 @@
//
// This file is automatically generated by tools/gen_android_bp. Do not edit.
+// GN target: //:libtraced_shared
+cc_library_shared {
+ name: "libtraced_shared",
+ srcs: [
+ ":perfetto_protos_ftrace_lite_gen",
+ ":perfetto_protos_ftrace_zero_gen",
+ ":perfetto_protos_lite_gen",
+ ":perfetto_protos_tracing_service_lite_gen",
+ ":perfetto_protos_tracing_service_tracing_service_gen",
+ ":perfetto_protos_zero_gen",
+ ":perfetto_src_ipc_wire_protocol_gen",
+ "src/base/android_task_runner.cc",
+ "src/base/page_allocator.cc",
+ "src/base/thread_checker.cc",
+ "src/base/unix_task_runner.cc",
+ "src/ftrace_reader/cpu_reader.cc",
+ "src/ftrace_reader/event_info.cc",
+ "src/ftrace_reader/format_parser.cc",
+ "src/ftrace_reader/ftrace_controller.cc",
+ "src/ftrace_reader/ftrace_procfs.cc",
+ "src/ftrace_reader/ftrace_to_proto.cc",
+ "src/ftrace_reader/proto_translation_table.cc",
+ "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/unix_socket.cc",
+ "src/protozero/proto_utils.cc",
+ "src/protozero/protozero_message.cc",
+ "src/protozero/protozero_message_handle.cc",
+ "src/protozero/scattered_stream_writer.cc",
+ "src/traced/probes/probes.cc",
+ "src/traced/service/service.cc",
+ "src/tracing/core/chunked_protobuf_input_stream.cc",
+ "src/tracing/core/data_source_config.cc",
+ "src/tracing/core/data_source_descriptor.cc",
+ "src/tracing/core/id_allocator.cc",
+ "src/tracing/core/service_impl.cc",
+ "src/tracing/core/shared_memory_abi.cc",
+ "src/tracing/core/shared_memory_arbiter.cc",
+ "src/tracing/core/trace_config.cc",
+ "src/tracing/core/trace_packet.cc",
+ "src/tracing/core/trace_writer_impl.cc",
+ ],
+ shared_libs: [
+ "libandroid",
+ "liblog",
+ "libprotobuf-cpp-lite",
+ ],
+ static_libs: [
+ "libgtest_prod",
+ "perfetto_src_tracing_ipc",
+ ],
+ generated_headers: [
+ "perfetto_protos_ftrace_lite_gen_headers",
+ "perfetto_protos_ftrace_zero_gen_headers",
+ "perfetto_protos_lite_gen_headers",
+ "perfetto_protos_tracing_service_lite_gen_headers",
+ "perfetto_protos_tracing_service_tracing_service_gen_headers",
+ "perfetto_protos_zero_gen_headers",
+ "perfetto_src_ipc_wire_protocol_gen_headers",
+ ],
+ defaults: [
+ "perfetto_defaults",
+ ],
+}
+
cc_defaults {
name: "perfetto_defaults",
cflags: [
@@ -802,65 +870,28 @@
cc_binary {
name: "traced",
srcs: [
- ":perfetto_protos_ftrace_lite_gen",
- ":perfetto_protos_ftrace_zero_gen",
- ":perfetto_protos_lite_gen",
- ":perfetto_protos_tracing_service_lite_gen",
- ":perfetto_protos_tracing_service_tracing_service_gen",
- ":perfetto_protos_zero_gen",
- ":perfetto_src_ipc_wire_protocol_gen",
- "src/base/android_task_runner.cc",
- "src/base/page_allocator.cc",
- "src/base/thread_checker.cc",
- "src/base/unix_task_runner.cc",
- "src/ftrace_reader/cpu_reader.cc",
- "src/ftrace_reader/event_info.cc",
- "src/ftrace_reader/format_parser.cc",
- "src/ftrace_reader/ftrace_controller.cc",
- "src/ftrace_reader/ftrace_procfs.cc",
- "src/ftrace_reader/ftrace_to_proto.cc",
- "src/ftrace_reader/proto_translation_table.cc",
- "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/unix_socket.cc",
- "src/protozero/proto_utils.cc",
- "src/protozero/protozero_message.cc",
- "src/protozero/protozero_message_handle.cc",
- "src/protozero/scattered_stream_writer.cc",
- "src/traced/probes/probes.cc",
- "src/traced/service/service.cc",
- "src/traced/traced.cc",
- "src/tracing/core/chunked_protobuf_input_stream.cc",
- "src/tracing/core/data_source_config.cc",
- "src/tracing/core/data_source_descriptor.cc",
- "src/tracing/core/id_allocator.cc",
- "src/tracing/core/service_impl.cc",
- "src/tracing/core/shared_memory_abi.cc",
- "src/tracing/core/shared_memory_arbiter.cc",
- "src/tracing/core/trace_config.cc",
- "src/tracing/core/trace_packet.cc",
- "src/tracing/core/trace_writer_impl.cc",
+ "src/traced/service/main.cc",
],
shared_libs: [
"libandroid",
"liblog",
- "libprotobuf-cpp-lite",
+ "libtraced_shared",
],
- static_libs: [
- "libgtest_prod",
- "perfetto_src_tracing_ipc",
+ defaults: [
+ "perfetto_defaults",
],
- generated_headers: [
- "perfetto_protos_ftrace_lite_gen_headers",
- "perfetto_protos_ftrace_zero_gen_headers",
- "perfetto_protos_lite_gen_headers",
- "perfetto_protos_tracing_service_lite_gen_headers",
- "perfetto_protos_tracing_service_tracing_service_gen_headers",
- "perfetto_protos_zero_gen_headers",
- "perfetto_src_ipc_wire_protocol_gen_headers",
+}
+
+// GN target: //:traced_probes
+cc_binary {
+ name: "traced_probes",
+ srcs: [
+ "src/traced/probes/main.cc",
+ ],
+ shared_libs: [
+ "libandroid",
+ "liblog",
+ "libtraced_shared",
],
defaults: [
"perfetto_defaults",