ftrace分析程序的调用栈

ftrace能干什么

能够对内核函数以及用户态函数进行trace。获取函数的调用栈以及函数的性能。

ftrace怎么用

ftrace依赖于内核中的debugfs,debugfs是将内核态和用户态联通的手段。
/sys/kernel/debug/tracing是总的入口。

配置文件说明

  1. available_tracers:表示当前系统可用的trace功能
cat available_tracers 
hwlat blk function_graph wakeup_dl wakeup_rt wakeup function nop
tracer名称 解释 备注
nop This is the “trace nothing” tracer. To remove all tracers from tracing simply echo “nop” into current_tracer. 清除tracer
function_graph the function graph tracer traces on both entry and exit of the functions. It then provides the ability to draw a graph of function calls similar to C code source. 能够捕捉函数的调用栈
  1. current_tracer:表示当前使用tracer,可选值为1中的值。
  2. tracing_on:开启tracer的开关。
  3. set_graph_function:设置对那些函数进行tracer。

ftrace怎么实现的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章