I have installed Ftrace on android AVD and try to use Ftrace's functionality, but it does not work.
Below is a list of what I did:
- Install ubuntu 10.04 LTS
- Install essential tools such as android sdk, toolchain, libs, etc
- Download goldfish kernel
refer - http://blog.markloiseau.com/2012/07/how-to-compile-the-android-goldfish-emulator-kernel/ - Modify kernel config file (turned on Tracer Options)
- Boot up goldfish with custom kernel which has compiled with tracer options
- Tried to use Ftrace functionality
- The kernel freezes
This is the log:
\# mount -t debugfs nodev /sys/kernel/debug
\# ls /sys/kernel/debug
sched_features
mmc0
tracing
bdi
\# cd /sys/kernel/debug/tracing
\# ls
events
set_event
available_events
printk_formats
per_cpu
options
saved_cmdlines
trace_marker
buffer_size_kb
trace_pipe
README
tracing_thresh
tracing_max_latency
current_tracer
available_tracers
trace
tracing_cpumask
trace_options
tracing_enabled
tracing_on
set_ftrace_pid
\# cat available_tracers
function_graph function sched_switch nop
\# cat current_tracer
nop
\# echo sched_switch > current_tracer
\# cat current_tracer
sched_switch
\# cat trace | /data/busybox head -10
\# tracer: sched_switch
\#
\# TASK-PID CPU# TIMESTAMP FUNCTION
\# | | | | |
bash-258 [000] 490.261240: 258:120:R + [000] 4:115:S events/0
bash-258 [000] 490.262087: 258:120:S ==> [000] 45:120:R adbd
adbd-45 [000] 490.262318: 45:120:S ==> [000] 4:115:R events/0
events/0-4 [000] 490.262457: 4:115:R + [000] 43:120:S qemud
events/0-4 [000] 490.262492: 4:115:S ==> [000] 43:120:R qemud
qemud-43 [000] 490.262643: 43:120:R + [000] 109:112:S er$SensorThread
\# echo function > current_tracer *<--- this command occur freeze*
As shown above, some of the features work well. But at the time I turn on the tracking function, a key feature, the system is down.
What should i do ?
There's several reasons that the function tracer may freeze. It's a very invasive tracer (traces almost all functions of the kernel). One issue is if it traces an internal function like disabling interrupts. This would cause it to go into an infinite loop. Now I assume you have an ARM device if you are running Android. Depending on the configuration some of the low level functions for ARM may need to be marked notrace to prevent them to be traced. If you have dynamic tracing enabled, try just tracing a single function and if that works you know the issue is with something that's being traced that shouldn't be. To trace a single function, just:
echo schedule > set_ftrace_filter; echo function > current_tracer
Good luck.
来源:https://stackoverflow.com/questions/13044214/ftrace-on-android-freeze-when-turn-on-function-trace-somebody-help-me