The most commonly used perf commands are: annotate Read perf.data (created by perf record) and display annotated code archive Create archive with object files with build-ids found in perf.data file bench General framework for benchmark suites buildid-cache Manage build-id cache. buildid-list List the buildids in a perf.data file c2c Shared Data C2C/HITM Analyzer. config Get and set variables in a configuration file. daemon Run record sessions on background data Data file related processing diff Read perf.data files and display the differential profile evlist List the event names in a perf.data file ftrace simple wrapper for kernel's ftrace functionality inject Filter to augment the events stream with additional information iostat Show I/O performance metrics kallsyms Searches running kernel for symbols kvm Tool to trace/measure kvm guest os list List all symbolic event types mem Profile memory accesses record Run a command and record its profile into perf.data report Read perf.data (created by perf record) and display the profile script Read perf.data (created by perf record) and display trace output stat Run a command and gather performance counter statistics test Runs sanity tests. top System profiling tool. version display the version of perf binary probe Define new dynamic tracepoints trace strace inspired tool kmem Tool to trace/measure kernel memory properties kwork Tool to trace/measure kernel work properties (latencies) lock Analyze lock events sched Tool to trace/measure scheduler properties (latencies) timechart Tool to visualize total system behavior during a workload
See 'perf help COMMAND' for more information on a specific command.
perf sched record #先进行采样 perf sched latency # 然后根据采样结果,输出延迟报表
显示如下
sudo perf sched latency
------------------------------------------------------------------------------------------------------------------------------------------- Task | Runtime ms | Switches | Avg delay ms | Max delay ms | Max delay start | Max delay end | ------------------------------------------------------------------------------------------------------------------------------------------- :211817:211817 | 0.249 ms | 1 | avg: 0.092 ms | max: 0.092 ms | max start: 131750.828191 s | max end: 131750.828283 s :198303:198303 | 0.206 ms | 1 | avg: 0.076 ms | max: 0.076 ms | max start: 131750.828165 s | max end: 131750.828241 s :198094:198094 | 0.014 ms | 1 | avg: 0.074 ms | max: 0.074 ms | max start: 131750.584621 s | max end: 131750.584695 s :211838:211838 | 0.511 ms | 2 | avg: 0.044 ms | max: 0.052 ms | max start: 131751.035039 s | max end: 131751.035090 s :198302:198302 | 0.050 ms | 1 | avg: 0.043 ms | max: 0.043 ms | max start: 131750.828382 s | max end: 131750.828425 s :211816:211816 | 0.045 ms | 1 | avg: 0.042 ms | max: 0.042 ms | max start: 131750.828423 s | max end: 131750.828465 s :1957:1957 | 0.112 ms | 5 | avg: 0.041 ms | max: 0.076 ms | max start: 131750.720146 s | max end: 131750.720222 s :1958:1958 | 0.049 ms | 2 | avg: 0.037 ms | max: 0.038 ms | max start: 131750.720493 s | max end: 131750.720531 s :174:174 | 0.041 ms | 1 | avg: 0.037 ms | max: 0.037 ms | max start: 131751.033691 s | max end: 131751.033728 s ... ----------------------------------------------------------------------------------------------------------------- TOTAL: | 106.102 ms | 1060 | ---------------------------------------------------