162306a36Sopenharmony_ciperf-ftrace(1) 262306a36Sopenharmony_ci============== 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciNAME 562306a36Sopenharmony_ci---- 662306a36Sopenharmony_ciperf-ftrace - simple wrapper for kernel's ftrace functionality 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciSYNOPSIS 1062306a36Sopenharmony_ci-------- 1162306a36Sopenharmony_ci[verse] 1262306a36Sopenharmony_ci'perf ftrace' {trace|latency} <command> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciDESCRIPTION 1562306a36Sopenharmony_ci----------- 1662306a36Sopenharmony_ciThe 'perf ftrace' command provides a collection of subcommands which use 1762306a36Sopenharmony_cikernel's ftrace infrastructure. 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci 'perf ftrace trace' is a simple wrapper of the ftrace. It only supports 2062306a36Sopenharmony_ci single thread tracing currently and just reads trace_pipe in text and then 2162306a36Sopenharmony_ci write it to stdout. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci 'perf ftrace latency' calculates execution latency of a given function 2462306a36Sopenharmony_ci (optionally with BPF) and display it as a histogram. 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciThe following options apply to perf ftrace. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciCOMMON OPTIONS 2962306a36Sopenharmony_ci-------------- 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci-p:: 3262306a36Sopenharmony_ci--pid=:: 3362306a36Sopenharmony_ci Trace on existing process id (comma separated list). 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci--tid=:: 3662306a36Sopenharmony_ci Trace on existing thread id (comma separated list). 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci-a:: 3962306a36Sopenharmony_ci--all-cpus:: 4062306a36Sopenharmony_ci Force system-wide collection. Scripts run without a <command> 4162306a36Sopenharmony_ci normally use -a by default, while scripts run with a <command> 4262306a36Sopenharmony_ci normally don't - this option allows the latter to be run in 4362306a36Sopenharmony_ci system-wide mode. 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci-C:: 4662306a36Sopenharmony_ci--cpu=:: 4762306a36Sopenharmony_ci Only trace for the list of CPUs provided. Multiple CPUs can 4862306a36Sopenharmony_ci be provided as a comma separated list with no space like: 0,1. 4962306a36Sopenharmony_ci Ranges of CPUs are specified with -: 0-2. 5062306a36Sopenharmony_ci Default is to trace on all online CPUs. 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci-v:: 5362306a36Sopenharmony_ci--verbose:: 5462306a36Sopenharmony_ci Increase the verbosity level. 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ciOPTIONS for 'perf ftrace trace' 5862306a36Sopenharmony_ci------------------------------- 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci-t:: 6162306a36Sopenharmony_ci--tracer=:: 6262306a36Sopenharmony_ci Tracer to use when neither -G nor -F option is not 6362306a36Sopenharmony_ci specified: function_graph or function. 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci-F:: 6662306a36Sopenharmony_ci--funcs:: 6762306a36Sopenharmony_ci List available functions to trace. It accepts a pattern to 6862306a36Sopenharmony_ci only list interested functions. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci-D:: 7162306a36Sopenharmony_ci--delay:: 7262306a36Sopenharmony_ci Time (ms) to wait before starting tracing after program start. 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci-m:: 7562306a36Sopenharmony_ci--buffer-size:: 7662306a36Sopenharmony_ci Set the size of per-cpu tracing buffer, <size> is expected to 7762306a36Sopenharmony_ci be a number with appended unit character - B/K/M/G. 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci--inherit:: 8062306a36Sopenharmony_ci Trace children processes spawned by our target. 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci-T:: 8362306a36Sopenharmony_ci--trace-funcs=:: 8462306a36Sopenharmony_ci Select function tracer and set function filter on the given 8562306a36Sopenharmony_ci function (or a glob pattern). Multiple functions can be given 8662306a36Sopenharmony_ci by using this option more than once. The function argument also 8762306a36Sopenharmony_ci can be a glob pattern. It will be passed to 'set_ftrace_filter' 8862306a36Sopenharmony_ci in tracefs. 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci-N:: 9162306a36Sopenharmony_ci--notrace-funcs=:: 9262306a36Sopenharmony_ci Select function tracer and do not trace functions given by the 9362306a36Sopenharmony_ci argument. Like -T option, this can be used more than once to 9462306a36Sopenharmony_ci specify multiple functions (or glob patterns). It will be 9562306a36Sopenharmony_ci passed to 'set_ftrace_notrace' in tracefs. 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci--func-opts:: 9862306a36Sopenharmony_ci List of options allowed to set: 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci - call-graph - Display kernel stack trace for function tracer. 10162306a36Sopenharmony_ci - irq-info - Display irq context info for function tracer. 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci-G:: 10462306a36Sopenharmony_ci--graph-funcs=:: 10562306a36Sopenharmony_ci Select function_graph tracer and set graph filter on the given 10662306a36Sopenharmony_ci function (or a glob pattern). This is useful to trace for 10762306a36Sopenharmony_ci functions executed from the given function. This can be used more 10862306a36Sopenharmony_ci than once to specify multiple functions. It will be passed to 10962306a36Sopenharmony_ci 'set_graph_function' in tracefs. 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci-g:: 11262306a36Sopenharmony_ci--nograph-funcs=:: 11362306a36Sopenharmony_ci Select function_graph tracer and set graph notrace filter on the 11462306a36Sopenharmony_ci given function (or a glob pattern). Like -G option, this is useful 11562306a36Sopenharmony_ci for the function_graph tracer only and disables tracing for function 11662306a36Sopenharmony_ci executed from the given function. This can be used more than once to 11762306a36Sopenharmony_ci specify multiple functions. It will be passed to 'set_graph_notrace' 11862306a36Sopenharmony_ci in tracefs. 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci--graph-opts:: 12162306a36Sopenharmony_ci List of options allowed to set: 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci - nosleep-time - Measure on-CPU time only for function_graph tracer. 12462306a36Sopenharmony_ci - noirqs - Ignore functions that happen inside interrupt. 12562306a36Sopenharmony_ci - verbose - Show process names, PIDs, timestamps, etc. 12662306a36Sopenharmony_ci - thresh=<n> - Setup trace duration threshold in microseconds. 12762306a36Sopenharmony_ci - depth=<n> - Set max depth for function graph tracer to follow. 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ciOPTIONS for 'perf ftrace latency' 13162306a36Sopenharmony_ci--------------------------------- 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci-T:: 13462306a36Sopenharmony_ci--trace-funcs=:: 13562306a36Sopenharmony_ci Set the function name to get the histogram. Unlike perf ftrace trace, 13662306a36Sopenharmony_ci it only allows single function to calculate the histogram. 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci-b:: 13962306a36Sopenharmony_ci--use-bpf:: 14062306a36Sopenharmony_ci Use BPF to measure function latency instead of using the ftrace (it 14162306a36Sopenharmony_ci uses function_graph tracer internally). 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci-n:: 14462306a36Sopenharmony_ci--use-nsec:: 14562306a36Sopenharmony_ci Use nano-second instead of micro-second as a base unit of the histogram. 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ciSEE ALSO 14962306a36Sopenharmony_ci-------- 15062306a36Sopenharmony_cilinkperf:perf-record[1], linkperf:perf-trace[1] 151