Tuesday, February 22, 2022

[SOLVED] Android Binder Tracing

Issue

In Android OS source code (Path: /drivers/staging/android/binder_trace.h), we have a file named binder_trace.h and also in /drivers/staging/android/binder.c binder_trace is included. As we can see in binder_trace.h file, the binder transactions are traced with TP_printk instruction.

Now my question is that how I can see these kernel logs in my phone with adb shell? Also there isn't any file related to binder tracing in /sys/kernel/debug/tracing directory!


Solution

$ cd /sys/kernel/debug/tracing
$ echo > set_event  # clear all unrelated events
$ echo 1 > events/binder/enable
$ echo 1 > tracing_on

# .. do your test jobs ..

$ cat trace

refer to https://android.googlesource.com/kernel/common/+/android-3.10.y/Documentation/trace/ftrace.txt for more detail info.



Answered By - Yingchun
Answer Checked By - Marilyn (WPSolving Volunteer)