commands: record - record a trace into a trace.dat file set - set a ftrace configuration parameter start - start tracing without recording into a file extract - extract a trace from the kernel stop - stop the kernel from recording trace data restart - restart the kernel trace data recording show - show the contents of the kernel tracing buffer reset - disable all kernel tracing and clear the trace buffers clear - clear the trace buffers report - read out the trace stored in a trace.dat file stream - Start tracing and read the output directly profile - Start profiling and read the output directly hist - show a histogram of the trace.dat information stat - show the status of the running tracing (ftrace) system split - parse a trace.dat file into smaller file(s) options - list the plugin options available for trace-cmd report listen - listen on a network socket for trace clients agent - listen on a vsocket for trace clients setup-guest - create FIFOs for tracing guest VMs list - list the available events, plugins or options restore - restore a crashed record snapshot - take snapshot of running trace stack - output, enable or disable kernel stack tracing check-events - parse trace event formats dump - read out the meta data from a trace file
# -m 设置buff的大小,-e 设置event, # -o 输出到指定文件。对于空间比较小的嵌入式设备,可以保存到外挂的U盘 pi@pi4b:~ $ sudo trace-cmd record -m 40960 -e 'sched_*' -e 'irq_*' -o ./ftrace.dat Hit Ctrl^C to stop recording ^CCPU0 data recorded at offset=0x5f7000 29159424 bytes in size CPU1 data recorded at offset=0x21c6000 22093824 bytes in size CPU2 data recorded at offset=0x36d8000 35000320 bytes in size CPU3 data recorded at offset=0x5839000 39243776 bytes in size pi@pi4b:~ $ trace-cmd report -i ftrace.dat > ftrace.log