Loading...
1perf-record(1)
2==============
3
4NAME
5----
6perf-record - Run a command and record its profile into perf.data
7
8SYNOPSIS
9--------
10[verse]
11'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>
12'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>]
13
14DESCRIPTION
15-----------
16This command runs a command and gathers a performance counter profile
17from it, into perf.data - without displaying anything.
18
19This file can then be inspected later on, using 'perf report'.
20
21
22OPTIONS
23-------
24<command>...::
25 Any command you can specify in a shell.
26
27-e::
28--event=::
29 Select the PMU event. Selection can be:
30
31 - a symbolic event name (use 'perf list' to list all events)
32
33 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
34 hexadecimal event descriptor.
35
36 - a hardware breakpoint event in the form of '\mem:addr[:access]'
37 where addr is the address in memory you want to break in.
38 Access is the memory access type (read, write, execute) it can
39 be passed as follows: '\mem:addr[:[r][w][x]]'.
40 If you want to profile read-write accesses in 0x1000, just set
41 'mem:0x1000:rw'.
42
43--filter=<filter>::
44 Event filter.
45
46-a::
47--all-cpus::
48 System-wide collection from all CPUs.
49
50-l::
51 Scale counter values.
52
53-p::
54--pid=::
55 Record events on existing process ID (comma separated list).
56
57-t::
58--tid=::
59 Record events on existing thread ID (comma separated list).
60 This option also disables inheritance by default. Enable it by adding
61 --inherit.
62
63-u::
64--uid=::
65 Record events in threads owned by uid. Name or number.
66
67-r::
68--realtime=::
69 Collect data with this RT SCHED_FIFO priority.
70
71--no-buffering::
72 Collect data without buffering.
73
74-c::
75--count=::
76 Event period to sample.
77
78-o::
79--output=::
80 Output file name.
81
82-i::
83--no-inherit::
84 Child tasks do not inherit counters.
85-F::
86--freq=::
87 Profile at this frequency.
88
89-m::
90--mmap-pages=::
91 Number of mmap data pages (must be a power of two) or size
92 specification with appended unit character - B/K/M/G. The
93 size is rounded up to have nearest pages power of two value.
94
95-g::
96 Enables call-graph (stack chain/backtrace) recording.
97
98--call-graph::
99 Setup and enable call-graph (stack chain/backtrace) recording,
100 implies -g.
101
102 Allows specifying "fp" (frame pointer) or "dwarf"
103 (DWARF's CFI - Call Frame Information) as the method to collect
104 the information used to show the call graphs.
105
106 In some systems, where binaries are build with gcc
107 --fomit-frame-pointer, using the "fp" method will produce bogus
108 call graphs, using "dwarf", if available (perf tools linked to
109 the libunwind library) should be used instead.
110
111-q::
112--quiet::
113 Don't print any message, useful for scripting.
114
115-v::
116--verbose::
117 Be more verbose (show counter open errors, etc).
118
119-s::
120--stat::
121 Per thread counts.
122
123-d::
124--data::
125 Sample addresses.
126
127-T::
128--timestamp::
129 Sample timestamps. Use it with 'perf report -D' to see the timestamps,
130 for instance.
131
132-n::
133--no-samples::
134 Don't sample.
135
136-R::
137--raw-samples::
138Collect raw sample records from all opened counters (default for tracepoint counters).
139
140-C::
141--cpu::
142Collect samples only on the list of CPUs provided. Multiple CPUs can be provided as a
143comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
144In per-thread mode with inheritance mode on (default), samples are captured only when
145the thread executes on the designated CPUs. Default is to monitor all CPUs.
146
147-N::
148--no-buildid-cache::
149Do not update the builid cache. This saves some overhead in situations
150where the information in the perf.data file (which includes buildids)
151is sufficient.
152
153-G name,...::
154--cgroup name,...::
155monitor only in the container (cgroup) called "name". This option is available only
156in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
157container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
158can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
159to first event, second cgroup to second event and so on. It is possible to provide
160an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
161corresponding events, i.e., they always refer to events defined earlier on the command
162line.
163
164-b::
165--branch-any::
166Enable taken branch stack sampling. Any type of taken branch may be sampled.
167This is a shortcut for --branch-filter any. See --branch-filter for more infos.
168
169-j::
170--branch-filter::
171Enable taken branch stack sampling. Each sample captures a series of consecutive
172taken branches. The number of branches captured with each sample depends on the
173underlying hardware, the type of branches of interest, and the executed code.
174It is possible to select the types of branches captured by enabling filters. The
175following filters are defined:
176
177 - any: any type of branches
178 - any_call: any function call or system call
179 - any_ret: any function return or system call return
180 - ind_call: any indirect branch
181 - u: only when the branch target is at the user level
182 - k: only when the branch target is in the kernel
183 - hv: only when the target is at the hypervisor level
184 - in_tx: only when the target is in a hardware transaction
185 - no_tx: only when the target is not in a hardware transaction
186 - abort_tx: only when the target is a hardware transaction abort
187
188+
189The option requires at least one branch type among any, any_call, any_ret, ind_call.
190The privilege levels may be omitted, in which case, the privilege levels of the associated
191event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege
192levels are subject to permissions. When sampling on multiple events, branch stack sampling
193is enabled for all the sampling events. The sampled branch type is the same for all events.
194The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
195Note that this feature may not be available on all processors.
196
197--weight::
198Enable weightened sampling. An additional weight is recorded per sample and can be
199displayed with the weight and local_weight sort keys. This currently works for TSX
200abort events and some memory events in precise mode on modern Intel CPUs.
201
202--transaction::
203Record transaction flags for transaction related events.
204
205--per-thread::
206Use per-thread mmaps. By default per-cpu mmaps are created. This option
207overrides that and uses per-thread mmaps. A side-effect of that is that
208inheritance is automatically disabled. --per-thread is ignored with a warning
209if combined with -a or -C options.
210
211-D::
212--delay=::
213After starting the program, wait msecs before measuring. This is useful to
214filter out the startup phase of the program, which is often very different.
215
216SEE ALSO
217--------
218linkperf:perf-stat[1], linkperf:perf-list[1]
1perf-record(1)
2==============
3
4NAME
5----
6perf-record - Run a command and record its profile into perf.data
7
8SYNOPSIS
9--------
10[verse]
11'perf record' [-e <EVENT> | --event=EVENT] [-a] <command>
12'perf record' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>]
13
14DESCRIPTION
15-----------
16This command runs a command and gathers a performance counter profile
17from it, into perf.data - without displaying anything.
18
19This file can then be inspected later on, using 'perf report'.
20
21
22OPTIONS
23-------
24<command>...::
25 Any command you can specify in a shell.
26
27-e::
28--event=::
29 Select the PMU event. Selection can be:
30
31 - a symbolic event name (use 'perf list' to list all events)
32
33 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
34 hexadecimal event descriptor.
35
36 - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where
37 'param1', 'param2', etc are defined as formats for the PMU in
38 /sys/bus/event_source/devices/<pmu>/format/*.
39
40 - a symbolically formed event like 'pmu/config=M,config1=N,config3=K/'
41
42 where M, N, K are numbers (in decimal, hex, octal format). Acceptable
43 values for each of 'config', 'config1' and 'config2' are defined by
44 corresponding entries in /sys/bus/event_source/devices/<pmu>/format/*
45 param1 and param2 are defined as formats for the PMU in:
46 /sys/bus/event_source/devices/<pmu>/format/*
47
48 There are also some parameters which are not defined in .../<pmu>/format/*.
49 These params can be used to overload default config values per event.
50 Here are some common parameters:
51 - 'period': Set event sampling period
52 - 'freq': Set event sampling frequency
53 - 'time': Disable/enable time stamping. Acceptable values are 1 for
54 enabling time stamping. 0 for disabling time stamping.
55 The default is 1.
56 - 'call-graph': Disable/enable callgraph. Acceptable str are "fp" for
57 FP mode, "dwarf" for DWARF mode, "lbr" for LBR mode and
58 "no" for disable callgraph.
59 - 'stack-size': user stack size for dwarf mode
60 - 'name' : User defined event name. Single quotes (') may be used to
61 escape symbols in the name from parsing by shell and tool
62 like this: name=\'CPU_CLK_UNHALTED.THREAD:cmask=0x1\'.
63 - 'aux-output': Generate AUX records instead of events. This requires
64 that an AUX area event is also provided.
65
66 See the linkperf:perf-list[1] man page for more parameters.
67
68 Note: If user explicitly sets options which conflict with the params,
69 the value set by the parameters will be overridden.
70
71 Also not defined in .../<pmu>/format/* are PMU driver specific
72 configuration parameters. Any configuration parameter preceded by
73 the letter '@' is not interpreted in user space and sent down directly
74 to the PMU driver. For example:
75
76 perf record -e some_event/@cfg1,@cfg2=config/ ...
77
78 will see 'cfg1' and 'cfg2=config' pushed to the PMU driver associated
79 with the event for further processing. There is no restriction on
80 what the configuration parameters are, as long as their semantic is
81 understood and supported by the PMU driver.
82
83 - a hardware breakpoint event in the form of '\mem:addr[/len][:access]'
84 where addr is the address in memory you want to break in.
85 Access is the memory access type (read, write, execute) it can
86 be passed as follows: '\mem:addr[:[r][w][x]]'. len is the range,
87 number of bytes from specified addr, which the breakpoint will cover.
88 If you want to profile read-write accesses in 0x1000, just set
89 'mem:0x1000:rw'.
90 If you want to profile write accesses in [0x1000~1008), just set
91 'mem:0x1000/8:w'.
92
93 - a BPF source file (ending in .c) or a precompiled object file (ending
94 in .o) selects one or more BPF events.
95 The BPF program can attach to various perf events based on the ELF section
96 names.
97
98 When processing a '.c' file, perf searches an installed LLVM to compile it
99 into an object file first. Optional clang options can be passed via the
100 '--clang-opt' command line option, e.g.:
101
102 perf record --clang-opt "-DLINUX_VERSION_CODE=0x50000" \
103 -e tests/bpf-script-example.c
104
105 Note: '--clang-opt' must be placed before '--event/-e'.
106
107 - a group of events surrounded by a pair of brace ("{event1,event2,...}").
108 Each event is separated by commas and the group should be quoted to
109 prevent the shell interpretation. You also need to use --group on
110 "perf report" to view group events together.
111
112--filter=<filter>::
113 Event filter. This option should follow an event selector (-e) which
114 selects either tracepoint event(s) or a hardware trace PMU
115 (e.g. Intel PT or CoreSight).
116
117 - tracepoint filters
118
119 In the case of tracepoints, multiple '--filter' options are combined
120 using '&&'.
121
122 - address filters
123
124 A hardware trace PMU advertises its ability to accept a number of
125 address filters by specifying a non-zero value in
126 /sys/bus/event_source/devices/<pmu>/nr_addr_filters.
127
128 Address filters have the format:
129
130 filter|start|stop|tracestop <start> [/ <size>] [@<file name>]
131
132 Where:
133 - 'filter': defines a region that will be traced.
134 - 'start': defines an address at which tracing will begin.
135 - 'stop': defines an address at which tracing will stop.
136 - 'tracestop': defines a region in which tracing will stop.
137
138 <file name> is the name of the object file, <start> is the offset to the
139 code to trace in that file, and <size> is the size of the region to
140 trace. 'start' and 'stop' filters need not specify a <size>.
141
142 If no object file is specified then the kernel is assumed, in which case
143 the start address must be a current kernel memory address.
144
145 <start> can also be specified by providing the name of a symbol. If the
146 symbol name is not unique, it can be disambiguated by inserting #n where
147 'n' selects the n'th symbol in address order. Alternately #0, #g or #G
148 select only a global symbol. <size> can also be specified by providing
149 the name of a symbol, in which case the size is calculated to the end
150 of that symbol. For 'filter' and 'tracestop' filters, if <size> is
151 omitted and <start> is a symbol, then the size is calculated to the end
152 of that symbol.
153
154 If <size> is omitted and <start> is '*', then the start and size will
155 be calculated from the first and last symbols, i.e. to trace the whole
156 file.
157
158 If symbol names (or '*') are provided, they must be surrounded by white
159 space.
160
161 The filter passed to the kernel is not necessarily the same as entered.
162 To see the filter that is passed, use the -v option.
163
164 The kernel may not be able to configure a trace region if it is not
165 within a single mapping. MMAP events (or /proc/<pid>/maps) can be
166 examined to determine if that is a possibility.
167
168 Multiple filters can be separated with space or comma.
169
170--exclude-perf::
171 Don't record events issued by perf itself. This option should follow
172 an event selector (-e) which selects tracepoint event(s). It adds a
173 filter expression 'common_pid != $PERFPID' to filters. If other
174 '--filter' exists, the new filter expression will be combined with
175 them by '&&'.
176
177-a::
178--all-cpus::
179 System-wide collection from all CPUs (default if no target is specified).
180
181-p::
182--pid=::
183 Record events on existing process ID (comma separated list).
184
185-t::
186--tid=::
187 Record events on existing thread ID (comma separated list).
188 This option also disables inheritance by default. Enable it by adding
189 --inherit.
190
191-u::
192--uid=::
193 Record events in threads owned by uid. Name or number.
194
195-r::
196--realtime=::
197 Collect data with this RT SCHED_FIFO priority.
198
199--no-buffering::
200 Collect data without buffering.
201
202-c::
203--count=::
204 Event period to sample.
205
206-o::
207--output=::
208 Output file name.
209
210-i::
211--no-inherit::
212 Child tasks do not inherit counters.
213
214-F::
215--freq=::
216 Profile at this frequency. Use 'max' to use the currently maximum
217 allowed frequency, i.e. the value in the kernel.perf_event_max_sample_rate
218 sysctl. Will throttle down to the currently maximum allowed frequency.
219 See --strict-freq.
220
221--strict-freq::
222 Fail if the specified frequency can't be used.
223
224-m::
225--mmap-pages=::
226 Number of mmap data pages (must be a power of two) or size
227 specification with appended unit character - B/K/M/G. The
228 size is rounded up to have nearest pages power of two value.
229 Also, by adding a comma, the number of mmap pages for AUX
230 area tracing can be specified.
231
232--group::
233 Put all events in a single event group. This precedes the --event
234 option and remains only for backward compatibility. See --event.
235
236-g::
237 Enables call-graph (stack chain/backtrace) recording.
238
239--call-graph::
240 Setup and enable call-graph (stack chain/backtrace) recording,
241 implies -g. Default is "fp".
242
243 Allows specifying "fp" (frame pointer) or "dwarf"
244 (DWARF's CFI - Call Frame Information) or "lbr"
245 (Hardware Last Branch Record facility) as the method to collect
246 the information used to show the call graphs.
247
248 In some systems, where binaries are build with gcc
249 --fomit-frame-pointer, using the "fp" method will produce bogus
250 call graphs, using "dwarf", if available (perf tools linked to
251 the libunwind or libdw library) should be used instead.
252 Using the "lbr" method doesn't require any compiler options. It
253 will produce call graphs from the hardware LBR registers. The
254 main limitation is that it is only available on new Intel
255 platforms, such as Haswell. It can only get user call chain. It
256 doesn't work with branch stack sampling at the same time.
257
258 When "dwarf" recording is used, perf also records (user) stack dump
259 when sampled. Default size of the stack dump is 8192 (bytes).
260 User can change the size by passing the size after comma like
261 "--call-graph dwarf,4096".
262
263-q::
264--quiet::
265 Don't print any message, useful for scripting.
266
267-v::
268--verbose::
269 Be more verbose (show counter open errors, etc).
270
271-s::
272--stat::
273 Record per-thread event counts. Use it with 'perf report -T' to see
274 the values.
275
276-d::
277--data::
278 Record the sample virtual addresses.
279
280--phys-data::
281 Record the sample physical addresses.
282
283-T::
284--timestamp::
285 Record the sample timestamps. Use it with 'perf report -D' to see the
286 timestamps, for instance.
287
288-P::
289--period::
290 Record the sample period.
291
292--sample-cpu::
293 Record the sample cpu.
294
295-n::
296--no-samples::
297 Don't sample.
298
299-R::
300--raw-samples::
301Collect raw sample records from all opened counters (default for tracepoint counters).
302
303-C::
304--cpu::
305Collect samples only on the list of CPUs provided. Multiple CPUs can be provided as a
306comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
307In per-thread mode with inheritance mode on (default), samples are captured only when
308the thread executes on the designated CPUs. Default is to monitor all CPUs.
309
310-B::
311--no-buildid::
312Do not save the build ids of binaries in the perf.data files. This skips
313post processing after recording, which sometimes makes the final step in
314the recording process to take a long time, as it needs to process all
315events looking for mmap records. The downside is that it can misresolve
316symbols if the workload binaries used when recording get locally rebuilt
317or upgraded, because the only key available in this case is the
318pathname. You can also set the "record.build-id" config variable to
319'skip to have this behaviour permanently.
320
321-N::
322--no-buildid-cache::
323Do not update the buildid cache. This saves some overhead in situations
324where the information in the perf.data file (which includes buildids)
325is sufficient. You can also set the "record.build-id" config variable to
326'no-cache' to have the same effect.
327
328-G name,...::
329--cgroup name,...::
330monitor only in the container (cgroup) called "name". This option is available only
331in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
332container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
333can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
334to first event, second cgroup to second event and so on. It is possible to provide
335an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
336corresponding events, i.e., they always refer to events defined earlier on the command
337line. If the user wants to track multiple events for a specific cgroup, the user can
338use '-e e1 -e e2 -G foo,foo' or just use '-e e1 -e e2 -G foo'.
339
340If wanting to monitor, say, 'cycles' for a cgroup and also for system wide, this
341command line can be used: 'perf stat -e cycles -G cgroup_name -a -e cycles'.
342
343-b::
344--branch-any::
345Enable taken branch stack sampling. Any type of taken branch may be sampled.
346This is a shortcut for --branch-filter any. See --branch-filter for more infos.
347
348-j::
349--branch-filter::
350Enable taken branch stack sampling. Each sample captures a series of consecutive
351taken branches. The number of branches captured with each sample depends on the
352underlying hardware, the type of branches of interest, and the executed code.
353It is possible to select the types of branches captured by enabling filters. The
354following filters are defined:
355
356 - any: any type of branches
357 - any_call: any function call or system call
358 - any_ret: any function return or system call return
359 - ind_call: any indirect branch
360 - call: direct calls, including far (to/from kernel) calls
361 - u: only when the branch target is at the user level
362 - k: only when the branch target is in the kernel
363 - hv: only when the target is at the hypervisor level
364 - in_tx: only when the target is in a hardware transaction
365 - no_tx: only when the target is not in a hardware transaction
366 - abort_tx: only when the target is a hardware transaction abort
367 - cond: conditional branches
368 - save_type: save branch type during sampling in case binary is not available later
369
370+
371The option requires at least one branch type among any, any_call, any_ret, ind_call, cond.
372The privilege levels may be omitted, in which case, the privilege levels of the associated
373event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege
374levels are subject to permissions. When sampling on multiple events, branch stack sampling
375is enabled for all the sampling events. The sampled branch type is the same for all events.
376The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
377Note that this feature may not be available on all processors.
378
379--weight::
380Enable weightened sampling. An additional weight is recorded per sample and can be
381displayed with the weight and local_weight sort keys. This currently works for TSX
382abort events and some memory events in precise mode on modern Intel CPUs.
383
384--namespaces::
385Record events of type PERF_RECORD_NAMESPACES.
386
387--transaction::
388Record transaction flags for transaction related events.
389
390--per-thread::
391Use per-thread mmaps. By default per-cpu mmaps are created. This option
392overrides that and uses per-thread mmaps. A side-effect of that is that
393inheritance is automatically disabled. --per-thread is ignored with a warning
394if combined with -a or -C options.
395
396-D::
397--delay=::
398After starting the program, wait msecs before measuring. This is useful to
399filter out the startup phase of the program, which is often very different.
400
401-I::
402--intr-regs::
403Capture machine state (registers) at interrupt, i.e., on counter overflows for
404each sample. List of captured registers depends on the architecture. This option
405is off by default. It is possible to select the registers to sample using their
406symbolic names, e.g. on x86, ax, si. To list the available registers use
407--intr-regs=\?. To name registers, pass a comma separated list such as
408--intr-regs=ax,bx. The list of register is architecture dependent.
409
410--user-regs::
411Similar to -I, but capture user registers at sample time. To list the available
412user registers use --user-regs=\?.
413
414--running-time::
415Record running and enabled time for read events (:S)
416
417-k::
418--clockid::
419Sets the clock id to use for the various time fields in the perf_event_type
420records. See clock_gettime(). In particular CLOCK_MONOTONIC and
421CLOCK_MONOTONIC_RAW are supported, some events might also allow
422CLOCK_BOOTTIME, CLOCK_REALTIME and CLOCK_TAI.
423
424-S::
425--snapshot::
426Select AUX area tracing Snapshot Mode. This option is valid only with an
427AUX area tracing event. Optionally, certain snapshot capturing parameters
428can be specified in a string that follows this option:
429 'e': take one last snapshot on exit; guarantees that there is at least one
430 snapshot in the output file;
431 <size>: if the PMU supports this, specify the desired snapshot size.
432
433In Snapshot Mode trace data is captured only when signal SIGUSR2 is received
434and on exit if the above 'e' option is given.
435
436--proc-map-timeout::
437When processing pre-existing threads /proc/XXX/mmap, it may take a long time,
438because the file may be huge. A time out is needed in such cases.
439This option sets the time out limit. The default value is 500 ms.
440
441--switch-events::
442Record context switch events i.e. events of type PERF_RECORD_SWITCH or
443PERF_RECORD_SWITCH_CPU_WIDE.
444
445--clang-path=PATH::
446Path to clang binary to use for compiling BPF scriptlets.
447(enabled when BPF support is on)
448
449--clang-opt=OPTIONS::
450Options passed to clang when compiling BPF scriptlets.
451(enabled when BPF support is on)
452
453--vmlinux=PATH::
454Specify vmlinux path which has debuginfo.
455(enabled when BPF prologue is on)
456
457--buildid-all::
458Record build-id of all DSOs regardless whether it's actually hit or not.
459
460--aio[=n]::
461Use <n> control blocks in asynchronous (Posix AIO) trace writing mode (default: 1, max: 4).
462Asynchronous mode is supported only when linking Perf tool with libc library
463providing implementation for Posix AIO API.
464
465--affinity=mode::
466Set affinity mask of trace reading thread according to the policy defined by 'mode' value:
467 node - thread affinity mask is set to NUMA node cpu mask of the processed mmap buffer
468 cpu - thread affinity mask is set to cpu of the processed mmap buffer
469
470--mmap-flush=number::
471
472Specify minimal number of bytes that is extracted from mmap data pages and
473processed for output. One can specify the number using B/K/M/G suffixes.
474
475The maximal allowed value is a quarter of the size of mmaped data pages.
476
477The default option value is 1 byte which means that every time that the output
478writing thread finds some new data in the mmaped buffer the data is extracted,
479possibly compressed (-z) and written to the output, perf.data or pipe.
480
481Larger data chunks are compressed more effectively in comparison to smaller
482chunks so extraction of larger chunks from the mmap data pages is preferable
483from the perspective of output size reduction.
484
485Also at some cases executing less output write syscalls with bigger data size
486can take less time than executing more output write syscalls with smaller data
487size thus lowering runtime profiling overhead.
488
489-z::
490--compression-level[=n]::
491Produce compressed trace using specified level n (default: 1 - fastest compression,
49222 - smallest trace)
493
494--all-kernel::
495Configure all used events to run in kernel space.
496
497--all-user::
498Configure all used events to run in user space.
499
500--kernel-callchains::
501Collect callchains only from kernel space. I.e. this option sets
502perf_event_attr.exclude_callchain_user to 1.
503
504--user-callchains::
505Collect callchains only from user space. I.e. this option sets
506perf_event_attr.exclude_callchain_kernel to 1.
507
508Don't use both --kernel-callchains and --user-callchains at the same time or no
509callchains will be collected.
510
511--timestamp-filename
512Append timestamp to output file name.
513
514--timestamp-boundary::
515Record timestamp boundary (time of first/last samples).
516
517--switch-output[=mode]::
518Generate multiple perf.data files, timestamp prefixed, switching to a new one
519based on 'mode' value:
520 "signal" - when receiving a SIGUSR2 (default value) or
521 <size> - when reaching the size threshold, size is expected to
522 be a number with appended unit character - B/K/M/G
523 <time> - when reaching the time threshold, size is expected to
524 be a number with appended unit character - s/m/h/d
525
526 Note: the precision of the size threshold hugely depends
527 on your configuration - the number and size of your ring
528 buffers (-m). It is generally more precise for higher sizes
529 (like >5M), for lower values expect different sizes.
530
531A possible use case is to, given an external event, slice the perf.data file
532that gets then processed, possibly via a perf script, to decide if that
533particular perf.data snapshot should be kept or not.
534
535Implies --timestamp-filename, --no-buildid and --no-buildid-cache.
536The reason for the latter two is to reduce the data file switching
537overhead. You can still switch them on with:
538
539 --switch-output --no-no-buildid --no-no-buildid-cache
540
541--switch-max-files=N::
542
543When rotating perf.data with --switch-output, only keep N files.
544
545--dry-run::
546Parse options then exit. --dry-run can be used to detect errors in cmdline
547options.
548
549'perf record --dry-run -e' can act as a BPF script compiler if llvm.dump-obj
550in config file is set to true.
551
552--tail-synthesize::
553Instead of collecting non-sample events (for example, fork, comm, mmap) at
554the beginning of record, collect them during finalizing an output file.
555The collected non-sample events reflects the status of the system when
556record is finished.
557
558--overwrite::
559Makes all events use an overwritable ring buffer. An overwritable ring
560buffer works like a flight recorder: when it gets full, the kernel will
561overwrite the oldest records, that thus will never make it to the
562perf.data file.
563
564When '--overwrite' and '--switch-output' are used perf records and drops
565events until it receives a signal, meaning that something unusual was
566detected that warrants taking a snapshot of the most current events,
567those fitting in the ring buffer at that moment.
568
569'overwrite' attribute can also be set or canceled for an event using
570config terms. For example: 'cycles/overwrite/' and 'instructions/no-overwrite/'.
571
572Implies --tail-synthesize.
573
574SEE ALSO
575--------
576linkperf:perf-stat[1], linkperf:perf-list[1]