ftrace 示例
假设debugfs已经挂载到了/sys/kernel/debug目录下,下面的小脚本用来抓取unlink系统调用的耗时:
cd /sys/kernel/debug/tracing echo function_graph > current_tracer echo 1 > tracing_on echo do_unlinkat > set_graph_function echo do_unlinkat > set_ftrace_filter echo > trace cat trace_pipe > /tmp/ftrace.unlink.out & sleep 3600 #cat trace > /tmp/ftrace.unlink.out echo nop > current_tracer echo 0 > tracing_on