Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/tools/perf/Documentation/perf-ftrace.txt
26282 views
1
perf-ftrace(1)
2
==============
3
4
NAME
5
----
6
perf-ftrace - simple wrapper for kernel's ftrace functionality
7
8
9
SYNOPSIS
10
--------
11
[verse]
12
'perf ftrace' {trace|latency|profile} <command>
13
14
DESCRIPTION
15
-----------
16
The 'perf ftrace' command provides a collection of subcommands which use
17
kernel's ftrace infrastructure.
18
19
'perf ftrace trace' is a simple wrapper of the ftrace. It only supports
20
single thread tracing currently and just reads trace_pipe in text and then
21
write it to stdout.
22
23
'perf ftrace latency' calculates execution latency of a given function
24
(optionally with BPF) and display it as a histogram.
25
26
'perf ftrace profile' show a execution profile for each function including
27
total, average, max time and the number of calls.
28
29
The following options apply to perf ftrace.
30
31
COMMON OPTIONS
32
--------------
33
34
-p::
35
--pid=::
36
Trace on existing process id (comma separated list).
37
38
--tid=::
39
Trace on existing thread id (comma separated list).
40
41
-a::
42
--all-cpus::
43
Force system-wide collection. Scripts run without a <command>
44
normally use -a by default, while scripts run with a <command>
45
normally don't - this option allows the latter to be run in
46
system-wide mode.
47
48
-C::
49
--cpu=::
50
Only trace for the list of CPUs provided. Multiple CPUs can
51
be provided as a comma separated list with no space like: 0,1.
52
Ranges of CPUs are specified with -: 0-2.
53
Default is to trace on all online CPUs.
54
55
-v::
56
--verbose::
57
Increase the verbosity level.
58
59
60
OPTIONS for 'perf ftrace trace'
61
-------------------------------
62
63
-t::
64
--tracer=::
65
Tracer to use when neither -G nor -F option is not
66
specified: function_graph or function.
67
68
-F::
69
--funcs::
70
List available functions to trace. It accepts a pattern to
71
only list interested functions.
72
73
-D::
74
--delay::
75
Time (ms) to wait before starting tracing after program start.
76
77
-m::
78
--buffer-size::
79
Set the size of per-cpu tracing buffer, <size> is expected to
80
be a number with appended unit character - B/K/M/G.
81
82
--inherit::
83
Trace children processes spawned by our target.
84
85
-T::
86
--trace-funcs=::
87
Select function tracer and set function filter on the given
88
function (or a glob pattern). Multiple functions can be given
89
by using this option more than once. The function argument also
90
can be a glob pattern. It will be passed to 'set_ftrace_filter'
91
in tracefs.
92
93
-N::
94
--notrace-funcs=::
95
Select function tracer and do not trace functions given by the
96
argument. Like -T option, this can be used more than once to
97
specify multiple functions (or glob patterns). It will be
98
passed to 'set_ftrace_notrace' in tracefs.
99
100
--func-opts::
101
List of options allowed to set:
102
103
- call-graph - Display kernel stack trace for function tracer.
104
- irq-info - Display irq context info for function tracer.
105
106
-G::
107
--graph-funcs=::
108
Select function_graph tracer and set graph filter on the given
109
function (or a glob pattern). This is useful to trace for
110
functions executed from the given function. This can be used more
111
than once to specify multiple functions. It will be passed to
112
'set_graph_function' in tracefs.
113
114
-g::
115
--nograph-funcs=::
116
Select function_graph tracer and set graph notrace filter on the
117
given function (or a glob pattern). Like -G option, this is useful
118
for the function_graph tracer only and disables tracing for function
119
executed from the given function. This can be used more than once to
120
specify multiple functions. It will be passed to 'set_graph_notrace'
121
in tracefs.
122
123
--graph-opts::
124
List of options allowed to set:
125
126
- args - Show function arguments.
127
- retval - Show function return value.
128
- retval-hex - Show function return value in hexadecimal format.
129
- retaddr - Show function return address.
130
- nosleep-time - Measure on-CPU time only for function_graph tracer.
131
- noirqs - Ignore functions that happen inside interrupt.
132
- verbose - Show process names, PIDs, timestamps, etc.
133
- thresh=<n> - Setup trace duration threshold in microseconds.
134
- depth=<n> - Set max depth for function graph tracer to follow.
135
- tail - Print function name at the end.
136
137
138
OPTIONS for 'perf ftrace latency'
139
---------------------------------
140
141
-T::
142
--trace-funcs=::
143
Set the function name to get the histogram. Unlike perf ftrace trace,
144
it only allows single function to calculate the histogram.
145
146
-e::
147
--events=::
148
Set the pair of events to get the histogram. The histogram is calculated
149
by the time difference between the two events from the same thread. This
150
requires -b/--use-bpf option.
151
152
-b::
153
--use-bpf::
154
Use BPF to measure function latency instead of using the ftrace (it
155
uses function_graph tracer internally).
156
157
-n::
158
--use-nsec::
159
Use nano-second instead of micro-second as a base unit of the histogram.
160
161
--bucket-range=::
162
Bucket range in ms or ns (according to -n/--use-nsec), default is log2() mode.
163
164
--min-latency=::
165
Minimum latency for the start of the first bucket, in ms or ns (according to
166
-n/--use-nsec).
167
168
--max-latency=::
169
Maximum latency for the start of the last bucket, in ms or ns (according to
170
-n/--use-nsec). The setting is ignored if the value results in more than
171
22 buckets.
172
173
OPTIONS for 'perf ftrace profile'
174
---------------------------------
175
176
-T::
177
--trace-funcs=::
178
Set function filter on the given function (or a glob pattern).
179
Multiple functions can be given by using this option more than once.
180
The function argument also can be a glob pattern. It will be passed
181
to 'set_ftrace_filter' in tracefs.
182
183
-N::
184
--notrace-funcs=::
185
Do not trace functions given by the argument. Like -T option, this
186
can be used more than once to specify multiple functions (or glob
187
patterns). It will be passed to 'set_ftrace_notrace' in tracefs.
188
189
-G::
190
--graph-funcs=::
191
Set graph filter on the given function (or a glob pattern). This is
192
useful to trace for functions executed from the given function. This
193
can be used more than once to specify multiple functions. It will be
194
passed to 'set_graph_function' in tracefs.
195
196
-g::
197
--nograph-funcs=::
198
Set graph notrace filter on the given function (or a glob pattern).
199
Like -G option, this is useful for the function_graph tracer only and
200
disables tracing for function executed from the given function. This
201
can be used more than once to specify multiple functions. It will be
202
passed to 'set_graph_notrace' in tracefs.
203
204
-m::
205
--buffer-size::
206
Set the size of per-cpu tracing buffer, <size> is expected to
207
be a number with appended unit character - B/K/M/G.
208
209
-s::
210
--sort=::
211
Sort the result by the given field. Available values are:
212
total, avg, max, count, name. Default is 'total'.
213
214
--graph-opts::
215
List of options allowed to set:
216
217
- nosleep-time - Measure on-CPU time only for function_graph tracer.
218
- noirqs - Ignore functions that happen inside interrupt.
219
- thresh=<n> - Setup trace duration threshold in microseconds.
220
- depth=<n> - Set max depth for function graph tracer to follow.
221
222
223
SEE ALSO
224
--------
225
linkperf:perf-record[1], linkperf:perf-trace[1]
226
227