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怎麼實現的

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