1992c7e92SJin Yao #ifndef _PERF_BRANCH_H 2992c7e92SJin Yao #define _PERF_BRANCH_H 1 3992c7e92SJin Yao 4f1a397f3SArnaldo Carvalho de Melo #include <stdio.h> 5992c7e92SJin Yao #include <stdint.h> 6f1a397f3SArnaldo Carvalho de Melo #include <linux/perf_event.h> 7f1a397f3SArnaldo Carvalho de Melo #include <linux/types.h> 8f1a397f3SArnaldo Carvalho de Melo 9f1a397f3SArnaldo Carvalho de Melo struct branch_flags { 10f1a397f3SArnaldo Carvalho de Melo u64 mispred:1; 11f1a397f3SArnaldo Carvalho de Melo u64 predicted:1; 12f1a397f3SArnaldo Carvalho de Melo u64 in_tx:1; 13f1a397f3SArnaldo Carvalho de Melo u64 abort:1; 14f1a397f3SArnaldo Carvalho de Melo u64 cycles:16; 15f1a397f3SArnaldo Carvalho de Melo u64 type:4; 16f1a397f3SArnaldo Carvalho de Melo u64 reserved:40; 17f1a397f3SArnaldo Carvalho de Melo }; 18f1a397f3SArnaldo Carvalho de Melo 19*d3300a3cSArnaldo Carvalho de Melo struct branch_info { 20*d3300a3cSArnaldo Carvalho de Melo struct addr_map_symbol from; 21*d3300a3cSArnaldo Carvalho de Melo struct addr_map_symbol to; 22*d3300a3cSArnaldo Carvalho de Melo struct branch_flags flags; 23*d3300a3cSArnaldo Carvalho de Melo char *srcline_from; 24*d3300a3cSArnaldo Carvalho de Melo char *srcline_to; 25*d3300a3cSArnaldo Carvalho de Melo }; 26*d3300a3cSArnaldo Carvalho de Melo 27f1a397f3SArnaldo Carvalho de Melo struct branch_entry { 28f1a397f3SArnaldo Carvalho de Melo u64 from; 29f1a397f3SArnaldo Carvalho de Melo u64 to; 30f1a397f3SArnaldo Carvalho de Melo struct branch_flags flags; 31f1a397f3SArnaldo Carvalho de Melo }; 32f1a397f3SArnaldo Carvalho de Melo 33f1a397f3SArnaldo Carvalho de Melo struct branch_stack { 34f1a397f3SArnaldo Carvalho de Melo u64 nr; 35f1a397f3SArnaldo Carvalho de Melo struct branch_entry entries[0]; 36f1a397f3SArnaldo Carvalho de Melo }; 37992c7e92SJin Yao 38992c7e92SJin Yao struct branch_type_stat { 39a1a8bed3SJin Yao bool branch_to; 40992c7e92SJin Yao u64 counts[PERF_BR_MAX]; 41992c7e92SJin Yao u64 cond_fwd; 42992c7e92SJin Yao u64 cond_bwd; 43992c7e92SJin Yao u64 cross_4k; 44992c7e92SJin Yao u64 cross_2m; 45992c7e92SJin Yao }; 46992c7e92SJin Yao 47992c7e92SJin Yao void branch_type_count(struct branch_type_stat *st, struct branch_flags *flags, 48992c7e92SJin Yao u64 from, u64 to); 49992c7e92SJin Yao 50992c7e92SJin Yao const char *branch_type_name(int type); 51992c7e92SJin Yao void branch_type_stat_display(FILE *fp, struct branch_type_stat *st); 52992c7e92SJin Yao int branch_type_str(struct branch_type_stat *st, char *bf, int bfsize); 53992c7e92SJin Yao 54992c7e92SJin Yao #endif /* _PERF_BRANCH_H */ 55