Linux调试工具之:ftrace

来源:互联网 发布:电脑为什么连不上网络 编辑:程序博客网 时间:2024/04/28 13:13
Function Trace (ftrace) is a heavy feature that intensely uses CPU resources to produce the  results. Ftrace uses the frysk engine to trace system calls in a manner similar to strace。
1.预备编译kenrel
Kernel hacking → Tracers → Kernel Function Tracer
例如高通平台的编译
# source build/envsetup.sh
# choosecombo 1 1 msm8960 3
# make kernelconfig
2.设置,使用新的Kernel与Android rootfs启动后
2.1挂载调试的文件系统到sdcard
# mount -t debugfs nodev /mnt/sdcard/debug
2.2 调试文件列表
# ls /mnt/sdcard/debug/tracing
2.3 打印available_tracers
# cat mnt/sdcard/debug/tracing/available_tracers
2.4 使能需要监控
# echo function > /mnt/sdcard/debug/tracing/current_trace
# echo 1 > /mnt/sdcard/debug/tracing/tracing_on
2.5 检查是否打开
# cat /mnt/sdcard/debug/tracing/current_tracer
2.6 查看
# cat /mnt/sdcard/debug/tracing/trace
=================================
通过PID查询进程
# echo <pid> > mnt/sdcard/debug/tracing/set_ftrace_pid
禁止
echo -1 > set_ftrace_pid