1) 打开调度相关的的event:其他event一次类推
[[email protected] ~]# echo 1 > /sys/kernel/debug/tracing/events/sched/enable
[[email protected] ~]# cat /sys/kernel/debug/tracing/trace
trace trace_clock trace_marker trace_marker_raw trace_options trace_pipe
[[email protected] ~]# cat /sys/kernel/debug/tracing/trace
trace trace_clock trace_marker trace_marker_raw trace_options trace_pipe
[[email protected] ~]# cat /sys/kernel/debug/tracing/trace_pipe > trace.dat
同时在其他窗口运行程序,按ctrl+c 结束cat
^C
2)查看
chome 浏览器地址栏中输入chrome://tracing/,将trace.dat 拖到chrome浏览器中查看。生成的图如下: