• Home
  • Raw
  • Download

Lines Matching full:perf

4 Perf ring buffer
34 The ring buffer is a fundamental mechanism for data transfer. perf uses
41 challenging work. On the one hand, the kernel and perf tool in the user
47 This documentation dives into the details for perf ring buffer with two
48 parts: firstly it explains the perf ring buffer implementation, then the
72 Perf uses the same way to manage its ring buffer. In the implementation
84 the perf tool has the permission to update the tail pointer after consuming
100 Figure 2. Perf ring buffer
102 When using the ``perf record`` tool, we can specify the ring buffer size
106 to VMA area until the perf tool accesses the buffer from the user space.
108 space in the perf tool, a data abort exception for page fault is taken
110 (see ``perf_mmap_fault()``), thus the perf tool can continue to access
116 The perf profiles programs with different modes: default mode, per thread
124 Usually we execute ``perf record`` command followed by a profiling program
127 perf record test_program
130 perf tool applies the default mode on the perf event. It maps all the
131 CPUs in the system and the profiled program's PID on the perf event, and
133 the events. As a result, the perf event is attributed as::
140 buffers. As shown below, the perf tool allocates individual ring buffer
144 threads in the system. The perf samples are exclusively collected for
198 By specifying option ``--per-thread`` in perf command, e.g.
202 perf record --per-thread test_program
204 The perf event doesn't map to any CPUs and is only bound to the
205 profiled process, thus, the perf event's attributions are::
250 When perf runs in per-thread mode, a ring buffer is allocated for the
252 thread *T1* is running, the perf events will be recorded into the ring
260 example the below perf command receives option ``-C 0,2``::
262 perf record -C 0,2 test_program
264 It maps the perf event to CPUs 0 and 2, and the event is not associated to any
265 PID. Thus the perf event attributions are set as::
271 This results in the session of ``perf record`` will sample all threads on CPU0
319 By using option ``–a`` or ``––all–cpus``, perf collects samples on all CPUs
322 perf record -a test_program
324 Similar to the per-CPU mode, the perf event doesn't bind to any PID, and
392 into the ring buffer; the perf command in user space consumes the
397 The perf process polls on the PMU events and sleeps when no events are
402 kernel wakes up the perf process to read samples from the ring buffer.
406 Perf
429 After the perf process is woken up, it starts to check the ring buffers
432 perf process is able to run on any CPU, this leads to the ring buffer
443 the reversed direction. The perf tool determines the writing direction.
449 ``PROT_READ | PROT_WRITE``. With the write permission, the perf tool
452 the current data, the perf tool can easily know where read out the data
460 direction and mapping characteristics. The perf tool employs two of these
488 the ``data_head`` keeps the position of current data, the perf always
503 perf tool can see the latest value.
517 In the user space, the perf tool utilizes the ``perf_event_mmap_page``
524 Similar to the kernel, the perf tool in the user space first reads out
536 sequence for memory accessing perf ring buffer, memory barriers are
558 writing the pointer ``data_tail``, perf tool first consumes samples and then
620 buffer, the perf tool invokes a second syscall in the
630 perf record -a -e cycles -e cs_etm/@tmc_etr0/ -- sleep 2
638 are allocated in pairs. The perf in default mode allocates the regular
642 in the system. For per-thread mode, the perf tool allocates only one
644 the per-CPU mode, the perf allocates two kinds of ring buffers for
753 the perf file. When the perf tool copies the trace data from AUX ring
754 buffer to the perf data file, it synthesizes a ``PERF_RECORD_AUXTRACE``
755 event which is not a kernel ABI, it's defined by the perf tool to describe
756 which portion of data in the AUX ring buffer is saved. Afterwards, the perf
757 tool reads out the AUX trace data from the perf file based on the
764 Perf supports snapshot mode for AUX ring buffer, in this mode, users
769 perf record -e cs_etm/@tmc_etr0/u -S -a program &
779 During free run mode the perf doesn't record any of the AUX events and
782 - Once the perf tool receives the *USR2* signal, it triggers the callback
788 - Then perf tool takes a snapshot, ``record__read_auxtrace_snapshot()``
790 into perf data file;
795 The perf only accesses the head pointer ``perf_event_mmap_page::aux_head``