Add libperfetto_android_internal.so library to access HAL/VNDK
This CL introduces a new shared library, meant to be used
only in in-android-tree builds, to access Android internal
HAL services via hwbinder (and in future maybe other sw
binder interfaces).
The concrete use case is battery tracing (see CLs based
op top of this).
The reasons for splitting off a dedicated .so are twofold:
1) Keep non-NDK dependencies isolated in a standalone target
and avoid polluting the codebase with #ifdefs.
2) Avoid the memory impact of pulling the various VNDK .so(s)
unless necessary.
Using hwbinder requires pulling 6 (or more) .so(s), which adds
150 KB of private dirty memory at load time due to linker
relocations.
The plan is to dlopen() libperfetto_android_internal.so
only when required and unload it when unneeded.
Bug: 113076327
Change-Id: I55b76d3c6637fb3604afff6b27870418e4831aa1
diff --git a/tools/tmux b/tools/tmux
index ff12b42..e3d7a82 100755
--- a/tools/tmux
+++ b/tools/tmux
@@ -30,10 +30,15 @@
return $?
}
+function is_mac {
+ ! test -d /proc
+ return $?
+}
+
function reset_tracing {
if is_android $OUT; then
adb shell 'echo 0 > /d/tracing/tracing_on'
- else
+ elif ! is_mac; then
if [ ! -w /sys/kernel/debug ]; then
echo "debugfs not accessible, try sudo chown -R $USER /sys/kernel/debug"
sudo chown -R $USER /sys/kernel/debug
@@ -93,6 +98,8 @@
if is_android $OUT ; then
DIR=/data/local/tmp
+elif is_mac; then
+ DIR=$(mktemp -d $TMPDIR/perfetto.XXXXXX)
else
DIR=$(mktemp -p $TMPDIR -d perfetto.XXXXXX)
fi
@@ -113,6 +120,9 @@
if ! is_monolithic $OUT; then
PREFIX="$PREFIX LD_LIBRARY_PATH=$DIR"
push $OUT/libperfetto.so
+ if is_android $OUT; then
+ push $OUT/libperfetto_android_internal.so
+ fi
fi
CONFIG_DEVICE_PATH=$CONFIG