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。