Path: blob/master/tools/perf/Documentation/perf-ftrace.txt
26282 views
perf-ftrace(1)1==============23NAME4----5perf-ftrace - simple wrapper for kernel's ftrace functionality678SYNOPSIS9--------10[verse]11'perf ftrace' {trace|latency|profile} <command>1213DESCRIPTION14-----------15The 'perf ftrace' command provides a collection of subcommands which use16kernel's ftrace infrastructure.1718'perf ftrace trace' is a simple wrapper of the ftrace. It only supports19single thread tracing currently and just reads trace_pipe in text and then20write it to stdout.2122'perf ftrace latency' calculates execution latency of a given function23(optionally with BPF) and display it as a histogram.2425'perf ftrace profile' show a execution profile for each function including26total, average, max time and the number of calls.2728The following options apply to perf ftrace.2930COMMON OPTIONS31--------------3233-p::34--pid=::35Trace on existing process id (comma separated list).3637--tid=::38Trace on existing thread id (comma separated list).3940-a::41--all-cpus::42Force system-wide collection. Scripts run without a <command>43normally use -a by default, while scripts run with a <command>44normally don't - this option allows the latter to be run in45system-wide mode.4647-C::48--cpu=::49Only trace for the list of CPUs provided. Multiple CPUs can50be provided as a comma separated list with no space like: 0,1.51Ranges of CPUs are specified with -: 0-2.52Default is to trace on all online CPUs.5354-v::55--verbose::56Increase the verbosity level.575859OPTIONS for 'perf ftrace trace'60-------------------------------6162-t::63--tracer=::64Tracer to use when neither -G nor -F option is not65specified: function_graph or function.6667-F::68--funcs::69List available functions to trace. It accepts a pattern to70only list interested functions.7172-D::73--delay::74Time (ms) to wait before starting tracing after program start.7576-m::77--buffer-size::78Set the size of per-cpu tracing buffer, <size> is expected to79be a number with appended unit character - B/K/M/G.8081--inherit::82Trace children processes spawned by our target.8384-T::85--trace-funcs=::86Select function tracer and set function filter on the given87function (or a glob pattern). Multiple functions can be given88by using this option more than once. The function argument also89can be a glob pattern. It will be passed to 'set_ftrace_filter'90in tracefs.9192-N::93--notrace-funcs=::94Select function tracer and do not trace functions given by the95argument. Like -T option, this can be used more than once to96specify multiple functions (or glob patterns). It will be97passed to 'set_ftrace_notrace' in tracefs.9899--func-opts::100List of options allowed to set:101102- call-graph - Display kernel stack trace for function tracer.103- irq-info - Display irq context info for function tracer.104105-G::106--graph-funcs=::107Select function_graph tracer and set graph filter on the given108function (or a glob pattern). This is useful to trace for109functions executed from the given function. This can be used more110than once to specify multiple functions. It will be passed to111'set_graph_function' in tracefs.112113-g::114--nograph-funcs=::115Select function_graph tracer and set graph notrace filter on the116given function (or a glob pattern). Like -G option, this is useful117for the function_graph tracer only and disables tracing for function118executed from the given function. This can be used more than once to119specify multiple functions. It will be passed to 'set_graph_notrace'120in tracefs.121122--graph-opts::123List of options allowed to set:124125- args - Show function arguments.126- retval - Show function return value.127- retval-hex - Show function return value in hexadecimal format.128- retaddr - Show function return address.129- nosleep-time - Measure on-CPU time only for function_graph tracer.130- noirqs - Ignore functions that happen inside interrupt.131- verbose - Show process names, PIDs, timestamps, etc.132- thresh=<n> - Setup trace duration threshold in microseconds.133- depth=<n> - Set max depth for function graph tracer to follow.134- tail - Print function name at the end.135136137OPTIONS for 'perf ftrace latency'138---------------------------------139140-T::141--trace-funcs=::142Set the function name to get the histogram. Unlike perf ftrace trace,143it only allows single function to calculate the histogram.144145-e::146--events=::147Set the pair of events to get the histogram. The histogram is calculated148by the time difference between the two events from the same thread. This149requires -b/--use-bpf option.150151-b::152--use-bpf::153Use BPF to measure function latency instead of using the ftrace (it154uses function_graph tracer internally).155156-n::157--use-nsec::158Use nano-second instead of micro-second as a base unit of the histogram.159160--bucket-range=::161Bucket range in ms or ns (according to -n/--use-nsec), default is log2() mode.162163--min-latency=::164Minimum latency for the start of the first bucket, in ms or ns (according to165-n/--use-nsec).166167--max-latency=::168Maximum latency for the start of the last bucket, in ms or ns (according to169-n/--use-nsec). The setting is ignored if the value results in more than17022 buckets.171172OPTIONS for 'perf ftrace profile'173---------------------------------174175-T::176--trace-funcs=::177Set function filter on the given function (or a glob pattern).178Multiple functions can be given by using this option more than once.179The function argument also can be a glob pattern. It will be passed180to 'set_ftrace_filter' in tracefs.181182-N::183--notrace-funcs=::184Do not trace functions given by the argument. Like -T option, this185can be used more than once to specify multiple functions (or glob186patterns). It will be passed to 'set_ftrace_notrace' in tracefs.187188-G::189--graph-funcs=::190Set graph filter on the given function (or a glob pattern). This is191useful to trace for functions executed from the given function. This192can be used more than once to specify multiple functions. It will be193passed to 'set_graph_function' in tracefs.194195-g::196--nograph-funcs=::197Set graph notrace filter on the given function (or a glob pattern).198Like -G option, this is useful for the function_graph tracer only and199disables tracing for function executed from the given function. This200can be used more than once to specify multiple functions. It will be201passed to 'set_graph_notrace' in tracefs.202203-m::204--buffer-size::205Set the size of per-cpu tracing buffer, <size> is expected to206be a number with appended unit character - B/K/M/G.207208-s::209--sort=::210Sort the result by the given field. Available values are:211total, avg, max, count, name. Default is 'total'.212213--graph-opts::214List of options allowed to set:215216- nosleep-time - Measure on-CPU time only for function_graph tracer.217- noirqs - Ignore functions that happen inside interrupt.218- thresh=<n> - Setup trace duration threshold in microseconds.219- depth=<n> - Set max depth for function graph tracer to follow.220221222SEE ALSO223--------224linkperf:perf-record[1], linkperf:perf-trace[1]225226227