ftrace能干什么
能够对内核函数以及用户态函数进行trace。获取函数的调用栈以及函数的性能。
ftrace怎么用
ftrace依赖于内核中的debugfs,debugfs是将内核态和用户态联通的手段。
/sys/kernel/debug/tracing是总的入口。
配置文件说明
- 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. | 能够捕捉函数的调用栈 |
- current_tracer:表示当前使用tracer,可选值为1中的值。
- tracing_on:开启tracer的开关。
- set_graph_function:设置对那些函数进行tracer。