3.10. Latency Tracing Using trace-cmd
trace-cmdis a front-end tool to ftrace. It can enable the ftrace interactions described earlier without needing to write into the
/sys/kernel/debug/tracing/directory. It can be installed without the special tracing kernel variants, and it does not add any overhead when it is installed.
- To install the
trace-cmdtool, enter the following command as
yum install trace-cmd
- To start the utility, type
trace-cmdat the shell prompt, along with the options you require, using the following syntax:
trace-cmd commandSome examples of commands are:
trace-cmd record -p function myappEnable and start recording functions executing within the kernel while myapp runs. It records functions from all CPUS and all tasks, even those not related to myapp.
trace-cmd reportDisplay the result.
trace-cmd record -p function -l 'sched*' myappRecord only functions that start with
schedwhile myapp runs.
trace-cmd start -e irqEnable all the IRQ events.
trace-cmd start -p wakeup_rtStart the
trace-cmd start -p preemptirqsoff -dStart the
preemptirqsofftracer but disable function tracing in doing so. Note: the version of trace-cmd in Red Hat Enterprise Linux 7 turns off
ftrace_enabledinstead of using the
function-traceoption. You can enable it again with
trace-cmd start -p function.
trace-cmd start -p nopRestore the state in which the system was before trace-cmd started modifying it. This is important if you want to use the debugfs file system after using trace-cmd, whether or not the system was restarted in the meantime.
- In this example, the
trace-cmdutility will trace a single trace point:
trace-cmd record -e sched_wakeup ls /bin