xref: /openbmc/linux/tools/perf/util/branch.h (revision b08918fb)
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_info {
20 	struct addr_map_symbol from;
21 	struct addr_map_symbol to;
22 	struct branch_flags    flags;
23 	char		       *srcline_from;
24 	char		       *srcline_to;
25 };
26 
27 struct branch_entry {
28 	u64			from;
29 	u64			to;
30 	struct branch_flags	flags;
31 };
32 
33 struct branch_stack {
34 	u64			nr;
35 	struct branch_entry	entries[0];
36 };
37 
38 struct branch_type_stat {
39 	bool	branch_to;
40 	u64	counts[PERF_BR_MAX];
41 	u64	cond_fwd;
42 	u64	cond_bwd;
43 	u64	cross_4k;
44 	u64	cross_2m;
45 };
46 
47 void branch_type_count(struct branch_type_stat *st, struct branch_flags *flags,
48 		       u64 from, u64 to);
49 
50 const char *branch_type_name(int type);
51 void branch_type_stat_display(FILE *fp, struct branch_type_stat *st);
52 int branch_type_str(struct branch_type_stat *st, char *bf, int bfsize);
53 
54 #endif /* _PERF_BRANCH_H */
55