1PERF-PROBE(1)                     perf Manual                    PERF-PROBE(1)
2
3
4

NAME

6       perf-probe - Define new dynamic tracepoints
7

SYNOPSIS

9       perf probe [options] --add=PROBE [...]
10       or
11       perf probe [options] PROBE
12       or
13       perf probe [options] --del=[GROUP:]EVENT [...]
14       or
15       perf probe --list
16       or
17       perf probe [options] --line=LINE
18       or
19       perf probe [options] --vars=PROBEPOINT
20

DESCRIPTION

22       This command defines dynamic tracepoint events, by symbol and registers
23       without debuginfo, or by C expressions (C line numbers, C function
24       names, and C local variables) with debuginfo.
25

OPTIONS

27       -k, --vmlinux=PATH
28           Specify vmlinux path which has debuginfo (Dwarf binary).
29
30       -m, --module=MODNAME|PATH
31           Specify module name in which perf-probe searches probe points or
32           lines. If a path of module file is passed, perf-probe treat it as
33           an offline module (this means you can add a probe on a module which
34           has not been loaded yet).
35
36       -s, --source=PATH
37           Specify path to kernel source.
38
39       -v, --verbose
40           Be more verbose (show parsed arguments, etc). Can not use with -q.
41
42       -q, --quiet
43           Be quiet (do not show any messages including errors). Can not use
44           with -v.
45
46       -a, --add=
47           Define a probe event (see PROBE SYNTAX for detail).
48
49       -d, --del=
50           Delete probe events. This accepts glob wildcards(*, ?) and
51           character classes(e.g. [a-z], [!A-Z]).
52
53       -l, --list
54           List up current probe events.
55
56       -L, --line=
57           Show source code lines which can be probed. This needs an argument
58           which specifies a range of the source code. (see LINE SYNTAX for
59           detail)
60
61       -V, --vars=
62           Show available local variables at given probe point. The argument
63           syntax is same as PROBE SYNTAX, but NO ARGs.
64
65       --externs
66           (Only for --vars) Show external defined variables in addition to
67           local variables.
68
69       -F, --funcs
70           Show available functions in given module or kernel. With -x/--exec,
71           can also list functions in a user space executable / shared
72           library.
73
74       --filter=FILTER
75           (Only for --vars and --funcs) Set filter. FILTER is a combination
76           of glob pattern, see FILTER PATTERN for detail. Default FILTER is
77           "!k???tab_* & !crc_*" for --vars, and "!_*" for --funcs. If several
78           filters are specified, only the last filter is used.
79
80       -f, --force
81           Forcibly add events with existing name.
82
83       -n, --dry-run
84           Dry run. With this option, --add and --del doesn’t execute actual
85           adding and removal operations.
86
87       --max-probes=NUM
88           Set the maximum number of probe points for an event. Default is
89           128.
90
91       -x, --exec=PATH
92           Specify path to the executable or shared library file for user
93           space tracing. Can also be used with --funcs option. (this feature
94           is unsupported in RHEL6)
95
96       --demangle
97           Demangle application symbols. --no-demangle is also available for
98           disabling demangling.
99
100       --demangle-kernel
101           Demangle kernel symbols. --no-demangle-kernel is also available for
102           disabling kernel demangling.
103
104       In absence of -m/-x options, perf probe checks if the first argument
105       after the options is an absolute path name. If its an absolute path,
106       perf probe uses it as a target module/target user space binary to
107       probe.
108

PROBE SYNTAX

110       Probe points are defined by following syntax.
111
112           1) Define event based on function name
113            [EVENT=]FUNC[@SRC][:RLN|+OFFS|%return|;PTN] [ARG ...]
114
115           2) Define event based on source file with line number
116            [EVENT=]SRC:ALN [ARG ...]
117
118           3) Define event based on source file with lazy pattern
119            [EVENT=]SRC;PTN [ARG ...]
120
121       EVENT specifies the name of new event, if omitted, it will be set the
122       name of the probed function. Currently, event group name is set as
123       probe. FUNC specifies a probed function name, and it may have one of
124       the following options; +OFFS is the offset from function entry address
125       in bytes, :RLN is the relative-line number from function entry line,
126       and %return means that it probes function return. And ;PTN means lazy
127       matching pattern (see LAZY MATCHING). Note that ;PTN must be the end of
128       the probe point definition. In addition, @SRC specifies a source file
129       which has that function. It is also possible to specify a probe point
130       by the source line number or lazy matching by using SRC:ALN or SRC;PTN
131       syntax, where SRC is the source file path, :ALN is the line number and
132       ;PTN is the lazy matching pattern. ARG specifies the arguments of this
133       probe point, (see PROBE ARGUMENT).
134

PROBE ARGUMENT

136       Each probe argument follows below syntax.
137
138           [NAME=]LOCALVAR|$retval|%REG|@SYMBOL[:TYPE]
139
140       NAME specifies the name of this argument (optional). You can use the
141       name of local variable, local data structure member (e.g. var→field,
142       var.field2), local array with fixed index (e.g. array[1], var→array[0],
143       var→pointer[2]), or kprobe-tracer argument format (e.g. $retval, %ax,
144       etc). Note that the name of this argument will be set as the last
145       member name if you specify a local data structure member (e.g. field2
146       for var→field1.field2.) $vars special argument is also available for
147       NAME, it is expanded to the local variables which can access at given
148       probe point. TYPE casts the type of this argument (optional). If
149       omitted, perf probe automatically set the type based on debuginfo. You
150       can specify string type only for the local variable or structure member
151       which is an array of or a pointer to char or unsigned char type.
152
153       On x86 systems %REG is always the short form of the register: for
154       example %AX. %RAX or %EAX is not valid.
155

LINE SYNTAX

157       Line range is described by following syntax.
158
159           "FUNC[@SRC][:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
160
161       FUNC specifies the function name of showing lines. RLN is the start
162       line number from function entry line, and RLN2 is the end line number.
163       As same as probe syntax, SRC means the source file path, ALN is start
164       line number, and ALN2 is end line number in the file. It is also
165       possible to specify how many lines to show by using NUM. Moreover,
166       FUNC@SRC combination is good for searching a specific function when
167       several functions share same name. So, "source.c:100-120" shows lines
168       between 100th to l20th in source.c file. And "func:10+20" shows 20
169       lines from 10th line of func function.
170

LAZY MATCHING

172           The lazy line matching is similar to glob matching but ignoring spaces in both of pattern and target. So this accepts wildcards(´*´, ´?´) and character classes(e.g. [a-z], [!A-Z]).
173
174       e.g. a=* can matches a=b, a = b, a == b and so on.
175
176       This provides some sort of flexibility and robustness to probe point
177       definitions against minor code changes. For example, actual 10th line
178       of schedule() can be moved easily by modifying schedule(), but the same
179       line matching rq=cpu_rq* may still exist in the function.)
180

FILTER PATTERN

182           The filter pattern is a glob matching pattern(s) to filter variables.
183           In addition, you can use "!" for specifying filter-out rule. You also can give several rules combined with "&" or "|", and fold those rules as one rule by using "(" ")".
184
185       e.g. With --filter "foo* | bar*", perf probe -V shows variables which
186       start with "foo" or "bar". With --filter "!foo* & *bar", perf probe -V
187       shows variables which don’t start with "foo" and end with "bar", like
188       "fizzbar". But "foobar" is filtered out.
189

EXAMPLES

191       Display which lines in schedule() can be probed:
192
193           ./perf probe --line schedule
194
195       Add a probe on schedule() function 12th line with recording cpu local
196       variable:
197
198           ./perf probe schedule:12 cpu
199           or
200           ./perf probe --add=´schedule:12 cpu´
201
202           this will add one or more probes which has the name start with "schedule".
203
204           Add probes on lines in schedule() function which calls update_rq_clock().
205
206           ./perf probe ´schedule;update_rq_clock*´
207           or
208           ./perf probe --add=´schedule;update_rq_clock*´
209
210       Delete all probes on schedule().
211
212           ./perf probe --del=´schedule*´
213
214       Add probes at zfree() function on /bin/zsh
215
216           ./perf probe -x /bin/zsh zfree or ./perf probe /bin/zsh zfree
217
218       Add probes at malloc() function on libc
219
220           ./perf probe -x /lib/libc.so.6 malloc or ./perf probe /lib/libc.so.6 malloc
221

SEE ALSO

223       perf-trace(1), perf-record(1)
224
225
226
227perf                              06/18/2019                     PERF-PROBE(1)
Impressum