2 #define _PERF_BRANCH_H 1
4 * The linux/stddef.h isn't need here, but is needed for __always_inline used
5 * in files included from uapi/linux/perf_event.h such as
6 * /usr/include/linux/swab.h and /usr/include/linux/byteorder/little_endian.h,
7 * detected in at least musl libc, used in Alpine Linux. -acme
11 #include <linux/compiler.h>
12 #include <linux/stddef.h>
13 #include <linux/perf_event.h>
14 #include <linux/types.h>
33 struct addr_map_symbol from;
34 struct addr_map_symbol to;
35 struct branch_flags flags;
43 struct branch_flags flags;
49 struct branch_entry entries[];
53 * The hw_idx is only available when PERF_SAMPLE_BRANCH_HW_INDEX is applied.
54 * Otherwise, the output format of a sample with branch stack is
55 * struct branch_stack {
57 * struct branch_entry entries[0];
59 * Check whether the hw_idx is available,
60 * and return the corresponding pointer of entries[0].
62 static inline struct branch_entry *perf_sample__branch_entries(struct perf_sample *sample)
64 u64 *entry = (u64 *)sample->branch_stack;
67 if (sample->no_hw_idx)
68 return (struct branch_entry *)entry;
69 return (struct branch_entry *)(++entry);
72 struct branch_type_stat {
74 u64 counts[PERF_BR_MAX];
81 void branch_type_count(struct branch_type_stat *st, struct branch_flags *flags,
84 const char *branch_type_name(int type);
85 void branch_type_stat_display(FILE *fp, struct branch_type_stat *st);
86 int branch_type_str(struct branch_type_stat *st, char *bf, int bfsize);
88 #endif /* _PERF_BRANCH_H */