~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/sample.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __PERF_SAMPLE_H
  3 #define __PERF_SAMPLE_H
  4 
  5 #include <linux/perf_event.h>
  6 #include <linux/types.h>
  7 
  8 /* number of register is bound by the number of bits in regs_dump::mask (64) */
  9 #define PERF_SAMPLE_REGS_CACHE_SIZE (8 * sizeof(u64))
 10 
 11 struct regs_dump {
 12         u64 abi;
 13         u64 mask;
 14         u64 *regs;
 15 
 16         /* Cached values/mask filled by first register access. */
 17         u64 cache_regs[PERF_SAMPLE_REGS_CACHE_SIZE];
 18         u64 cache_mask;
 19 };
 20 
 21 struct stack_dump {
 22         u16 offset;
 23         u64 size;
 24         char *data;
 25 };
 26 
 27 struct sample_read_value {
 28         u64 value;
 29         u64 id;   /* only if PERF_FORMAT_ID */
 30         u64 lost; /* only if PERF_FORMAT_LOST */
 31 };
 32 
 33 struct sample_read {
 34         u64 time_enabled;
 35         u64 time_running;
 36         union {
 37                 struct {
 38                         u64 nr;
 39                         struct sample_read_value *values;
 40                 } group;
 41                 struct sample_read_value one;
 42         };
 43 };
 44 
 45 static inline size_t sample_read_value_size(u64 read_format)
 46 {
 47         /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
 48         if (read_format & PERF_FORMAT_LOST)
 49                 return sizeof(struct sample_read_value);
 50         else
 51                 return offsetof(struct sample_read_value, lost);
 52 }
 53 
 54 static inline struct sample_read_value *next_sample_read_value(struct sample_read_value *v, u64 read_format)
 55 {
 56         return (void *)v + sample_read_value_size(read_format);
 57 }
 58 
 59 #define sample_read_group__for_each(v, nr, rf) \
 60         for (int __i = 0; __i < (int)nr; v = next_sample_read_value(v, rf), __i++)
 61 
 62 #define MAX_INSN 16
 63 
 64 struct aux_sample {
 65         u64 size;
 66         void *data;
 67 };
 68 
 69 struct simd_flags {
 70         u64     arch:1, /* architecture (isa) */
 71                 pred:2; /* predication */
 72 };
 73 
 74 /* simd architecture flags */
 75 #define SIMD_OP_FLAGS_ARCH_SVE          0x01    /* ARM SVE */
 76 
 77 /* simd predicate flags */
 78 #define SIMD_OP_FLAGS_PRED_PARTIAL      0x01    /* partial predicate */
 79 #define SIMD_OP_FLAGS_PRED_EMPTY        0x02    /* empty predicate */
 80 
 81 struct perf_sample {
 82         u64 ip;
 83         u32 pid, tid;
 84         u64 time;
 85         u64 addr;
 86         u64 id;
 87         u64 stream_id;
 88         u64 period;
 89         u64 weight;
 90         u64 transaction;
 91         u64 insn_cnt;
 92         u64 cyc_cnt;
 93         u32 cpu;
 94         u32 raw_size;
 95         u64 data_src;
 96         u64 phys_addr;
 97         u64 data_page_size;
 98         u64 code_page_size;
 99         u64 cgroup;
100         u32 flags;
101         u32 machine_pid;
102         u32 vcpu;
103         u16 insn_len;
104         u8  cpumode;
105         u16 misc;
106         u16 ins_lat;
107         union {
108                 u16 p_stage_cyc;
109                 u16 retire_lat;
110         };
111         bool no_hw_idx;         /* No hw_idx collected in branch_stack */
112         char insn[MAX_INSN];
113         void *raw_data;
114         struct ip_callchain *callchain;
115         struct branch_stack *branch_stack;
116         u64 *branch_stack_cntr;
117         struct regs_dump  user_regs;
118         struct regs_dump  intr_regs;
119         struct stack_dump user_stack;
120         struct sample_read read;
121         struct aux_sample aux_sample;
122         struct simd_flags simd_flags;
123 };
124 
125 /*
126  * raw_data is always 4 bytes from an 8-byte boundary, so subtract 4 to get
127  * 8-byte alignment.
128  */
129 static inline void *perf_sample__synth_ptr(struct perf_sample *sample)
130 {
131         return sample->raw_data - 4;
132 }
133 
134 #endif /* __PERF_SAMPLE_H */
135 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php