perf_event_mmap_page

Structure of the page that can be mapped via mmap

Members

Unions

__anonymous
union __anonymous

Variables

__reserved
ubyte[948] __reserved;

* Hole for extension of the self monitor capabilities *//** align to 1k.

aux_head
ulong aux_head;

AUX area is defined by aux_{offset,size} fields that should be set by the userspace, so that

aux_offset
ulong aux_offset;
aux_size
ulong aux_size;
aux_tail
ulong aux_tail;
compat_version
uint compat_version;

lowest version this is compat with

data_head
ulong data_head;

* Control data for the mmap() data buffer. * * User-space reading the @data_head value should issue an smp_rmb(), * after reading this value. * * When the mapping is PROT_WRITE the @data_tail value should be * written by userspace to reflect the last read data, after issueing * an smp_mb() to separate the data read from the ->data_tail store. * In this case the kernel will not over-write unread data. * * See perf_output_put_handle() for the data ordering. * * data_{offset,size} indicate the location and size of the perf record * buffer within the mmapped area. *//** head in the data section

data_offset
ulong data_offset;

where the buffer starts

data_size
ulong data_size;

data buffer size

data_tail
ulong data_tail;

user-space written tail

index
uint index;

hardware event identifier

lock
uint lock;

* Bits needed to read the hw events in user-space. * --- * u32 seq, time_mult, time_shift, index, width; * u64 count, enabled, running; * u64 cyc, time_offset; * s64 pmc = 0; * * do { * seq = pc->lock; * barrier() * * enabled = pc->time_enabled; * running = pc->time_running; * * if (pc->cap_usr_time && enabled != running) { * cyc = rdtsc(); * time_offset = pc->time_offset; * time_mult = pc->time_mult; * time_shift = pc->time_shift; * } * * index = pc->index; * count = pc->offset; * if (pc->cap_user_rdpmc && index) { * width = pc->pmc_width; * pmc = rdpmc(index - 1); * } * * barrier(); * } while (pc->lock != seq); * --- * NOTE: for obvious reason this only works on self-monitoring * processes. *//** seqlock for synchronization

offset
long offset;

add to hardware event value

pmc_width
ushort pmc_width;

If cap_user_rdpmc this field provides the bit-width of the value read using the rdpmc() or equivalent instruction. This can be used to sign extend the result like:

size
uint size;

Header size up to __reserved[] fields.

time_enabled
ulong time_enabled;

time event active

time_mult
uint time_mult;
time_offset
ulong time_offset;
time_running
ulong time_running;

time event on cpu

time_shift
ushort time_shift;

If cap_usr_time the below fields can be used to compute the time delta since time_enabled (in ns) using rdtsc or similar.

time_zero
ulong time_zero;

If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated from sample timestamps.

version_
uint version_;

version number of this structure

Meta