简体   繁体   English

在开启功能跟踪时Ftrace在android冻结,有人帮我:(

[英]Ftrace on android freeze when turn on function trace, somebody help me :(

I have installed Ftrace on android AVD and try to use Ftrace's functionality, but it does not work. 我在Android AVD上安装了Ftrace并尝试使用Ftrace的功能,但它不起作用。

Below is a list of what I did: 以下是我所做的清单:

  1. Install ubuntu 10.04 LTS 安装ubuntu 10.04 LTS
  2. Install essential tools such as android sdk, toolchain, libs, etc 安装基本工具,如android sdk,toolchain,libs等
  3. Download goldfish kernel refer - http://blog.markloiseau.com/2012/07/how-to-compile-the-android-goldfish-emulator-kernel/ 下载金鱼内核 参考 - http://blog.markloiseau.com/2012/07/how-to-compile-the-android-goldfish-emulator-kernel/
  4. Modify kernel config file (turned on Tracer Options) 修改内核配置文件(打开Tracer Options)
  5. Boot up goldfish with custom kernel which has compiled with tracer options 使用已使用跟踪器选项编译的自定义内核启动金鱼
  6. Tried to use Ftrace functionality 试图使用Ftrace功能
  7. 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. 现在我假设您运行Android时有一个ARM设备。 Depending on the configuration some of the low level functions for ARM may need to be marked notrace to prevent them to be traced. 根据配置,ARM的某些低级功能可能需要标记为notrace以防止跟踪它们。 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 schedule> set_ftrace_filter; echo function > current_tracer echo function> current_tracer

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM