Linux command
trace-cmd 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo trace-cmd stat
Example
sudo trace-cmd list -t
Start
sudo trace-cmd start -p [function|function_graph|irqsoff|wakeup]
View
sudo trace-cmd show
Stop
sudo trace-cmd stop
Clear
sudo trace-cmd clear
Record
sudo trace-cmd record -e [sched_switch]
Record
sudo trace-cmd record -p function_graph -g [function_name]
Example
trace-cmd report
Example
sudo trace-cmd list -e
说明
trace-cmd is a utility for interacting with the Linux kernel's Ftrace tracing framework. It provides a user-friendly interface for configuring and capturing kernel traces, analyzing function calls, timing, and system events. The tool supports various tracer plugins including function tracing, function call graphs, and latency tracers for debugging and performance analysis.
参数
- -p _PLUGIN_
- Specify tracer plugin (function, function_graph, irqsoff, wakeup, etc.)
- -e _EVENT_
- Enable a trace event (can be specified multiple times)
- -g _FUNCTION_
- Trace calls starting from a specific function (used with function_graph)
- -o _FILE_
- Write trace output to specified file (default: trace.dat)
- -t
- List available tracers (used with list subcommand)
- -F
- Trace only the child process after a fork
FAQ
What is the trace-cmd command used for?
trace-cmd is a utility for interacting with the Linux kernel's Ftrace tracing framework. It provides a user-friendly interface for configuring and capturing kernel traces, analyzing function calls, timing, and system events. The tool supports various tracer plugins including function tracing, function call graphs, and latency tracers for debugging and performance analysis.
How do I run a basic trace-cmd example?
Run `sudo trace-cmd stat` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p _PLUGIN_ do in trace-cmd?
Specify tracer plugin (function, function_graph, irqsoff, wakeup, etc.)