hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/tools/perf/util/callchain.h
....@@ -2,13 +2,18 @@
22 #ifndef __PERF_CALLCHAIN_H
33 #define __PERF_CALLCHAIN_H
44
5
-#include "../perf.h"
65 #include <linux/list.h>
76 #include <linux/rbtree.h>
8
-#include "event.h"
9
-#include "map.h"
10
-#include "symbol.h"
7
+#include "map_symbol.h"
118 #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;
1217
1318 #define HELP_PAD "\t\t\t\t"
1419
....@@ -137,15 +142,22 @@
137142 */
138143 struct callchain_cursor_node {
139144 u64 ip;
140
- struct map *map;
141
- struct symbol *sym;
145
+ struct map_symbol ms;
142146 const char *srcline;
147
+ /* Indicate valid cursor node for LBR stitch */
148
+ bool valid;
149
+
143150 bool branch;
144151 struct branch_flags branch_flags;
145152 u64 branch_from;
146153 int nr_loop_iter;
147154 u64 iter_cycles;
148155 struct callchain_cursor_node *next;
156
+};
157
+
158
+struct stitch_list {
159
+ struct list_head node;
160
+ struct callchain_cursor_node cursor;
149161 };
150162
151163 struct callchain_cursor {
....@@ -188,23 +200,10 @@
188200 int callchain_merge(struct callchain_cursor *cursor,
189201 struct callchain_root *dst, struct callchain_root *src);
190202
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);
205204
206205 int callchain_cursor_append(struct callchain_cursor *cursor, u64 ip,
207
- struct map *map, struct symbol *sym,
206
+ struct map_symbol *ms,
208207 bool branch, struct branch_flags *flags,
209208 int nr_loop_iter, u64 iter_cycles, u64 branch_from,
210209 const char *srcline);
....@@ -249,7 +248,7 @@
249248
250249 int sample__resolve_callchain(struct perf_sample *sample,
251250 struct callchain_cursor *cursor, struct symbol **parent,
252
- struct perf_evsel *evsel, struct addr_location *al,
251
+ struct evsel *evsel, struct addr_location *al,
253252 int max_stack);
254253 int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample);
255254 int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node,
....@@ -299,4 +298,13 @@
299298 u64 *branch_count, u64 *predicted_count,
300299 u64 *abort_count, u64 *cycles_count);
301300
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
+
302310 #endif /* __PERF_CALLCHAIN_H */