| .. | .. |
|---|
| 2 | 2 | #ifndef __PERF_CALLCHAIN_H |
|---|
| 3 | 3 | #define __PERF_CALLCHAIN_H |
|---|
| 4 | 4 | |
|---|
| 5 | | -#include "../perf.h" |
|---|
| 6 | 5 | #include <linux/list.h> |
|---|
| 7 | 6 | #include <linux/rbtree.h> |
|---|
| 8 | | -#include "event.h" |
|---|
| 9 | | -#include "map.h" |
|---|
| 10 | | -#include "symbol.h" |
|---|
| 7 | +#include "map_symbol.h" |
|---|
| 11 | 8 | #include "branch.h" |
|---|
| 9 | + |
|---|
| 10 | +struct addr_location; |
|---|
| 11 | +struct evsel; |
|---|
| 12 | +struct ip_callchain; |
|---|
| 13 | +struct map; |
|---|
| 14 | +struct perf_sample; |
|---|
| 15 | +struct thread; |
|---|
| 16 | +struct hists; |
|---|
| 12 | 17 | |
|---|
| 13 | 18 | #define HELP_PAD "\t\t\t\t" |
|---|
| 14 | 19 | |
|---|
| .. | .. |
|---|
| 137 | 142 | */ |
|---|
| 138 | 143 | struct callchain_cursor_node { |
|---|
| 139 | 144 | u64 ip; |
|---|
| 140 | | - struct map *map; |
|---|
| 141 | | - struct symbol *sym; |
|---|
| 145 | + struct map_symbol ms; |
|---|
| 142 | 146 | const char *srcline; |
|---|
| 147 | + /* Indicate valid cursor node for LBR stitch */ |
|---|
| 148 | + bool valid; |
|---|
| 149 | + |
|---|
| 143 | 150 | bool branch; |
|---|
| 144 | 151 | struct branch_flags branch_flags; |
|---|
| 145 | 152 | u64 branch_from; |
|---|
| 146 | 153 | int nr_loop_iter; |
|---|
| 147 | 154 | u64 iter_cycles; |
|---|
| 148 | 155 | struct callchain_cursor_node *next; |
|---|
| 156 | +}; |
|---|
| 157 | + |
|---|
| 158 | +struct stitch_list { |
|---|
| 159 | + struct list_head node; |
|---|
| 160 | + struct callchain_cursor_node cursor; |
|---|
| 149 | 161 | }; |
|---|
| 150 | 162 | |
|---|
| 151 | 163 | struct callchain_cursor { |
|---|
| .. | .. |
|---|
| 188 | 200 | int callchain_merge(struct callchain_cursor *cursor, |
|---|
| 189 | 201 | struct callchain_root *dst, struct callchain_root *src); |
|---|
| 190 | 202 | |
|---|
| 191 | | -/* |
|---|
| 192 | | - * Initialize a cursor before adding entries inside, but keep |
|---|
| 193 | | - * the previously allocated entries as a cache. |
|---|
| 194 | | - */ |
|---|
| 195 | | -static inline void callchain_cursor_reset(struct callchain_cursor *cursor) |
|---|
| 196 | | -{ |
|---|
| 197 | | - struct callchain_cursor_node *node; |
|---|
| 198 | | - |
|---|
| 199 | | - cursor->nr = 0; |
|---|
| 200 | | - cursor->last = &cursor->first; |
|---|
| 201 | | - |
|---|
| 202 | | - for (node = cursor->first; node != NULL; node = node->next) |
|---|
| 203 | | - map__zput(node->map); |
|---|
| 204 | | -} |
|---|
| 203 | +void callchain_cursor_reset(struct callchain_cursor *cursor); |
|---|
| 205 | 204 | |
|---|
| 206 | 205 | int callchain_cursor_append(struct callchain_cursor *cursor, u64 ip, |
|---|
| 207 | | - struct map *map, struct symbol *sym, |
|---|
| 206 | + struct map_symbol *ms, |
|---|
| 208 | 207 | bool branch, struct branch_flags *flags, |
|---|
| 209 | 208 | int nr_loop_iter, u64 iter_cycles, u64 branch_from, |
|---|
| 210 | 209 | const char *srcline); |
|---|
| .. | .. |
|---|
| 249 | 248 | |
|---|
| 250 | 249 | int sample__resolve_callchain(struct perf_sample *sample, |
|---|
| 251 | 250 | struct callchain_cursor *cursor, struct symbol **parent, |
|---|
| 252 | | - struct perf_evsel *evsel, struct addr_location *al, |
|---|
| 251 | + struct evsel *evsel, struct addr_location *al, |
|---|
| 253 | 252 | int max_stack); |
|---|
| 254 | 253 | int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample); |
|---|
| 255 | 254 | int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node, |
|---|
| .. | .. |
|---|
| 299 | 298 | u64 *branch_count, u64 *predicted_count, |
|---|
| 300 | 299 | u64 *abort_count, u64 *cycles_count); |
|---|
| 301 | 300 | |
|---|
| 301 | +void callchain_param_setup(u64 sample_type); |
|---|
| 302 | + |
|---|
| 303 | +bool callchain_cnode_matched(struct callchain_node *base_cnode, |
|---|
| 304 | + struct callchain_node *pair_cnode); |
|---|
| 305 | + |
|---|
| 306 | +u64 callchain_total_hits(struct hists *hists); |
|---|
| 307 | + |
|---|
| 308 | +s64 callchain_avg_cycles(struct callchain_node *cnode); |
|---|
| 309 | + |
|---|
| 302 | 310 | #endif /* __PERF_CALLCHAIN_H */ |
|---|