1 #ifndef PERF_UTIL_BPF_SKEL_SAMPLE_FILTER_H 2 #define PERF_UTIL_BPF_SKEL_SAMPLE_FILTER_H 3 4 #define MAX_FILTERS 64 5 #define MAX_IDX_HASH (16 * 1024) 6 #define MAX_EVT_HASH (1024 * 1024) 7 8 /* supported filter operations */ 9 enum perf_bpf_filter_op { 10 PBF_OP_EQ, 11 PBF_OP_NEQ, 12 PBF_OP_GT, 13 PBF_OP_GE, 14 PBF_OP_LT, 15 PBF_OP_LE, 16 PBF_OP_AND, 17 PBF_OP_GROUP_BEGIN, 18 PBF_OP_GROUP_END, 19 PBF_OP_DONE, 20 }; 21 22 enum perf_bpf_filter_term { 23 /* No term is in use. */ 24 PBF_TERM_NONE = 0, 25 /* Terms that correspond to PERF_SAMPLE_xx values. */ 26 PBF_TERM_SAMPLE_START = PBF_TERM_NONE + 1, 27 PBF_TERM_IP = PBF_TERM_SAMPLE_START + 0, /* SAMPLE_IP = 1U << 0 */ 28 PBF_TERM_TID = PBF_TERM_SAMPLE_START + 1, /* SAMPLE_TID = 1U << 1 */ 29 PBF_TERM_TIME = PBF_TERM_SAMPLE_START + 2, /* SAMPLE_TIME = 1U << 2 */ 30 PBF_TERM_ADDR = PBF_TERM_SAMPLE_START + 3, /* SAMPLE_ADDR = 1U << 3 */ 31 __PBF_UNUSED_TERM4 = PBF_TERM_SAMPLE_START + 4, /* SAMPLE_READ = 1U << 4 */ 32 __PBF_UNUSED_TERM5 = PBF_TERM_SAMPLE_START + 5, /* SAMPLE_CALLCHAIN = 1U << 5 */ 33 PBF_TERM_ID = PBF_TERM_SAMPLE_START + 6, /* SAMPLE_ID = 1U << 6 */ 34 PBF_TERM_CPU = PBF_TERM_SAMPLE_START + 7, /* SAMPLE_CPU = 1U << 7 */ 35 PBF_TERM_PERIOD = PBF_TERM_SAMPLE_START + 8, /* SAMPLE_PERIOD = 1U << 8 */ 36 __PBF_UNUSED_TERM9 = PBF_TERM_SAMPLE_START + 9, /* SAMPLE_STREAM_ID = 1U << 9 */ 37 __PBF_UNUSED_TERM10 = PBF_TERM_SAMPLE_START + 10, /* SAMPLE_RAW = 1U << 10 */ 38 __PBF_UNUSED_TERM11 = PBF_TERM_SAMPLE_START + 11, /* SAMPLE_BRANCH_STACK = 1U << 11 */ 39 __PBF_UNUSED_TERM12 = PBF_TERM_SAMPLE_START + 12, /* SAMPLE_REGS_USER = 1U << 12 */ 40 __PBF_UNUSED_TERM13 = PBF_TERM_SAMPLE_START + 13, /* SAMPLE_STACK_USER = 1U << 13 */ 41 PBF_TERM_WEIGHT = PBF_TERM_SAMPLE_START + 14, /* SAMPLE_WEIGHT = 1U << 14 */ 42 PBF_TERM_DATA_SRC = PBF_TERM_SAMPLE_START + 15, /* SAMPLE_DATA_SRC = 1U << 15 */ 43 __PBF_UNUSED_TERM16 = PBF_TERM_SAMPLE_START + 16, /* SAMPLE_IDENTIFIER = 1U << 16 */ 44 PBF_TERM_TRANSACTION = PBF_TERM_SAMPLE_START + 17, /* SAMPLE_TRANSACTION = 1U << 17 */ 45 __PBF_UNUSED_TERM18 = PBF_TERM_SAMPLE_START + 18, /* SAMPLE_REGS_INTR = 1U << 18 */ 46 PBF_TERM_PHYS_ADDR = PBF_TERM_SAMPLE_START + 19, /* SAMPLE_PHYS_ADDR = 1U << 19 */ 47 __PBF_UNUSED_TERM20 = PBF_TERM_SAMPLE_START + 20, /* SAMPLE_AUX = 1U << 20 */ 48 PBF_TERM_CGROUP = PBF_TERM_SAMPLE_START + 21, /* SAMPLE_CGROUP = 1U << 21 */ 49 PBF_TERM_DATA_PAGE_SIZE = PBF_TERM_SAMPLE_START + 22, /* SAMPLE_DATA_PAGE_SIZE = 1U << 22 */ 50 PBF_TERM_CODE_PAGE_SIZE = PBF_TERM_SAMPLE_START + 23, /* SAMPLE_CODE_PAGE_SIZE = 1U << 23 */ 51 PBF_TERM_WEIGHT_STRUCT = PBF_TERM_SAMPLE_START + 24, /* SAMPLE_WEIGHT_STRUCT = 1U << 24 */ 52 PBF_TERM_SAMPLE_END = PBF_TERM_WEIGHT_STRUCT, 53 /* Terms computed from BPF helpers. */ 54 PBF_TERM_UID, 55 PBF_TERM_GID, 56 }; 57 58 /* BPF map entry for filtering */ 59 struct perf_bpf_filter_entry { 60 enum perf_bpf_filter_op op; 61 __u32 part; /* sub-sample type info when it has multiple values */ 62 enum perf_bpf_filter_term term; 63 __u64 value; 64 }; 65 66 struct idx_hash_key { 67 __u64 evt_id; 68 __u32 tgid; 69 __u32 reserved; 70 }; 71 72 #endif /* PERF_UTIL_BPF_SKEL_SAMPLE_FILTER_H */ 73