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

NAME

6       perf-record - Run a command and record its profile into perf.data
7

SYNOPSIS

9       perf record [-e <EVENT> | --event=EVENT] [-a] <command>
10       perf record [-e <EVENT> | --event=EVENT] [-a] — <command> [<options>]
11

DESCRIPTION

13       This command runs a command and gathers a performance counter profile
14       from it, into perf.data - without displaying anything.
15
16       This file can then be inspected later on, using perf report.
17

OPTIONS

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

SEE ALSO

675       perf-stat(1), perf-list(1), perf-intel-pt(1)
676
677
678
679perf                              03/30/2021                    PERF-RECORD(1)
Impressum