perf_event_type

Values

ValueMeaning
PERF_RECORD_MMAP1

If perf_event_attr.sample_id_all is set then all event types will have the sample_type selected fields related to where/when (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU, IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed just after the perf_event_header and the fields already present for the existing fields, i.e. at the end of the payload. That way a newer perf.data file will be supported by older perf tools, with these new optional fields being ignored.

struct sample_id {
    { u32            pid, tid; } && PERF_SAMPLE_TID
    { u64            time;     } && PERF_SAMPLE_TIME
    { u64            id;       } && PERF_SAMPLE_ID
    { u64            stream_id;} && PERF_SAMPLE_STREAM_ID
    { u32            cpu, res; } && PERF_SAMPLE_CPU
   { u64            id;      } && PERF_SAMPLE_IDENTIFIER
} && perf_event_attr::sample_id_all

Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. The advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed relative to header.size.

PERF_RECORD_LOST2
struct {
   struct perf_event_header    header;
   u64                id;
   u64                lost;
    struct sample_id        sample_id;
};
PERF_RECORD_COMM3
struct {
   struct perf_event_header    header;

   u32                pid, tid;
   char                comm[];
    struct sample_id        sample_id;
};
PERF_RECORD_EXIT4
struct {
   struct perf_event_header    header;
   u32                pid, ppid;
   u32                tid, ptid;
   u64                time;
    struct sample_id        sample_id;
};
PERF_RECORD_THROTTLE5
struct {
   struct perf_event_header    header;
   u64                time;
   u64                id;
   u64                stream_id;
   struct sample_id        sample_id;
};
PERF_RECORD_UNTHROTTLE6
PERF_RECORD_FORK7
struct {
   struct perf_event_header    header;
   u32                pid, ppid;
   u32                tid, ptid;
   u64                time;
    struct sample_id        sample_id;
};
PERF_RECORD_READ8
struct {
   struct perf_event_header    header;
   u32                pid, tid;

   struct read_format        values;
    struct sample_id        sample_id;
};
PERF_RECORD_SAMPLE9
1 struct {
2    struct perf_event_header    header;
3 
4    #
5    # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID.
6    # The advantage of PERF_SAMPLE_IDENTIFIER is that its position
7    # is fixed relative to header.
8    #
9 
10    { u64            id;      } && PERF_SAMPLE_IDENTIFIER
11    { u64            ip;      } && PERF_SAMPLE_IP
12    { u32            pid, tid; } && PERF_SAMPLE_TID
13    { u64            time;     } && PERF_SAMPLE_TIME
14    { u64            addr;     } && PERF_SAMPLE_ADDR
15    { u64            id;      } && PERF_SAMPLE_ID
16    { u64            stream_id;} && PERF_SAMPLE_STREAM_ID
17    { u32            cpu, res; } && PERF_SAMPLE_CPU
18    { u64            period;   } && PERF_SAMPLE_PERIOD
19 
20    { struct read_format    values;      } && PERF_SAMPLE_READ
21 
22    { u64            nr,
23      u64            ips[nr];  } && PERF_SAMPLE_CALLCHAIN
24 
25    #
26    # The RAW record below is opaque data wrt the ABI
27    #
28    # That is, the ABI doesn make any promises wrt to
29    # the stability of its content, it may vary depending
30    # on event, hardware, kernel version and phase of
31    # the moon.
32    #
33    # In other words, PERF_SAMPLE_RAW contents are not an ABI.
34    #
35 
36    { u32            size;
37      char                  data[size];}&& PERF_SAMPLE_RAW
38 
39    { u64                   nr;
40        { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
41 
42     { u64            abi; # enum perf_sample_regs_abi
43       u64            regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
44 
45     { u64            size;
46       char            data[size];
47       u64            dyn_size; } && PERF_SAMPLE_STACK_USER
48 
49    { u64            weight;   } && PERF_SAMPLE_WEIGHT
50    { u64            data_src; } && PERF_SAMPLE_DATA_SRC
51    { u64            transaction; } && PERF_SAMPLE_TRANSACTION
52    { u64            abi; # enum perf_sample_regs_abi
53      u64            regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR
54    { u64            phys_addr;} && PERF_SAMPLE_PHYS_ADDR
55 };
PERF_RECORD_MMAP210
The MMAP2 records are an augmented version of MMAP, they add
maj, min, ino numbers to be used to uniquely identify each mapping

struct {
   struct perf_event_header    header;

   u32                pid, tid;
   u64                addr;
   u64                len;
   u64                pgoff;
   u32                maj;
   u32                min;
   u64                ino;
   u64                ino_generation;
   u32                prot, flags;
   char                filename[];
    struct sample_id        sample_id;
};
PERF_RECORD_AUX11

Records that new data landed in the AUX buffer part.

struct {
    struct perf_event_header    header;

    u64                aux_offset;
    u64                aux_size;
   u64                flags;
    struct sample_id        sample_id;
};
PERF_RECORD_ITRACE_START12
Indicates that instruction trace has started

struct {
   struct perf_event_header    header;
   u32                pid;
   u32                tid;
};
PERF_RECORD_LOST_SAMPLES13

Records the dropped/lost sample number.

struct {
   struct perf_event_header    header;

   u64                lost;
   struct sample_id        sample_id;
};
PERF_RECORD_SWITCH14

Records a context switch in or out (flagged by PERF_RECORD_MISC_SWITCH_OUT). See also PERF_RECORD_SWITCH_CPU_WIDE.

struct {
   struct perf_event_header    header;
   struct sample_id        sample_id;
};
PERF_RECORD_SWITCH_CPU_WIDE15

CPU-wide version of PERF_RECORD_SWITCH with next_prev_pid and next_prev_tid that are the next (switching out) or previous (switching in) pid/tid.

struct {
   struct perf_event_header    header;
   u32                next_prev_pid;
   u32                next_prev_tid;
   struct sample_id        sample_id;
};
PERF_RECORD_NAMESPACES16
struct {
   struct perf_event_header    header;
   u32                pid;
   u32                tid;
   u64                nr_namespaces;
   { u64                dev, inode; } [nr_namespaces];
   struct sample_id        sample_id;
};
PERF_RECORD_MAX17

Meta