Move binder libraries into perfetto binary and save ~5 MB of ram
This change moves the dependencies on libandroir,libbinder & friends
from libtraced_shared.so to the perfetto binary.
Thankfully, in fact, only the short lived client binary requires
those.
Doing so causes a memory reduction of our traced and traced_probes
of roughly 2.5 MB private dirty memory for each of our two daemon
(traced, traced_probes).
The memory is mostly coming from relocations and initializers
coming from the tree of recursive dependencies of those libraries.
For the moment that causes a binary size hit of +268 KB
Memory
------
Before:
Shared_Clean: 7900 kB
Shared_Dirty: 80 kB
Private_Clean: 156 kB
Private_Dirty: 3176 kB
After:
Shared_Clean: 1224 kB
Shared_Dirty: 80 kB
Private_Clean: 160 kB
Private_Dirty: 528 kB !!!
Binary size
-----------
Before:
bin/traced: 12 KB
bin/traced_probes: 12 KB
bin/perfetto: 12 KB
lib64/libtraced_shared.so: 468 KB
*TOTAL*: 504 KB
After:
bin/traced: 12 KB
bin/traced_probes: 12 KB
bin/perfetto: 280 KB
lib64/libtraced_shared.so: 468 KB
*TOTAL*: 772 KB
Change-Id: I72bc05a68edf9b485775c51e7e2f18f29594458b
diff --git a/BUILD.gn b/BUILD.gn
index 2af4f42..e62e1ed 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -87,19 +87,9 @@
target(libtraced_shared_target_type, "libtraced_shared") {
deps = [
"gn:default_deps",
- "src/traced/perfetto_cmd",
"src/traced/probes",
"src/traced/service",
]
- if (build_with_android) {
- cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ]
- deps += [ "src/base:android_task_runner" ]
- libs = [
- "binder",
- "services",
- "utils",
- ]
- }
}
# The unprivileged trace daemon that listens for Producer and Consumer
@@ -131,12 +121,21 @@
# tracing, acting as a Consumer.
executable("perfetto") {
deps = [
- ":libtraced_shared",
"gn:default_deps",
+ "src/traced/perfetto_cmd",
]
sources = [
"src/traced/perfetto_cmd/main.cc",
]
+ if (build_with_android) {
+ cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ]
+ deps += [ "src/base:android_task_runner" ]
+ libs = [
+ "binder",
+ "services",
+ "utils",
+ ]
+ }
}
} else {
group("lib") {