xref: /openbmc/linux/tools/perf/util/branch.h (revision 9a8f3203)
1 #ifndef _PERF_BRANCH_H
2 #define _PERF_BRANCH_H 1
3 
4 #include <stdio.h>
5 #include <stdint.h>
6 #include <linux/perf_event.h>
7 #include <linux/types.h>
8 
9 struct branch_flags {
10 	u64 mispred:1;
11 	u64 predicted:1;
12 	u64 in_tx:1;
13 	u64 abort:1;
14 	u64 cycles:16;
15 	u64 type:4;
16 	u64 reserved:40;
17 };
18 
19 struct branch_entry {
20 	u64			from;
21 	u64			to;
22 	struct branch_flags	flags;
23 };
24 
25 struct branch_stack {
26 	u64			nr;
27 	struct branch_entry	entries[0];
28 };
29 
30 struct branch_type_stat {
31 	bool	branch_to;
32 	u64	counts[PERF_BR_MAX];
33 	u64	cond_fwd;
34 	u64	cond_bwd;
35 	u64	cross_4k;
36 	u64	cross_2m;
37 };
38 
39 void branch_type_count(struct branch_type_stat *st, struct branch_flags *flags,
40 		       u64 from, u64 to);
41 
42 const char *branch_type_name(int type);
43 void branch_type_stat_display(FILE *fp, struct branch_type_stat *st);
44 int branch_type_str(struct branch_type_stat *st, char *bf, int bfsize);
45 
46 #endif /* _PERF_BRANCH_H */
47