History

perf: Add AUX area to ring buffer for raw data streams

This patch introduces "AUX space" in the perf mmap buffer, intended for exporting high bandwidth data streams to userspace, such as instruction flow traces. AUX space is a ring buffer, defined by aux_{offset,size} fields in the user_page structure, and read/write pointers aux_{head,tail}, which abide by the same rules as data_* counterparts of the main perf buffer. In order to allocate/mmap AUX, userspace needs to set up aux_offset to such an offset that will be greater than data_offset+data_size and aux_size to be the desired buffer size. Both need to be page aligned. Then, same aux_offset and aux_size should be passed to mmap() call and if everything adds up, you should have an AUX buffer as a result. Pages that are mapped into this buffer also come out of user's mlock rlimit plus perf_event_mlock_kb allowance.

Peter Zijlstra committed 11 years ago

Commit 45bfb2e1 parent e8c6dea5 files · +265 −29Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/perf_event.h+16−0
@@ -530,6 +530,22 @@ struct perf_event_mmap_page { · 529 unmodified lines
530530 __u64 data_tail; /* user-space written tail */
531531 __u64 data_offset; /* where the buffer starts */
532532 __u64 data_size; /* data buffer size */
533+
534+ /*
535+ * AUX area is defined by aux_{offset,size} fields that should be set
536+ * by the userspace, so that
537+ *
538+ * aux_offset >= data_offset + data_size
539+ *
540+ * prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
541+ *
542+ * Ring buffer pointers aux_{head,tail} have the same semantics as
543+ * data_{head,tail} and same ordering rules apply.
544+ */
545+ __u64 aux_head;
546+ __u64 aux_tail;
547+ __u64 aux_offset;
548+ __u64 aux_size;
533549 };
534550
535551 #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t