.. | .. |
---|
1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 2 | #ifndef __PERF_SORT_H |
---|
3 | 3 | #define __PERF_SORT_H |
---|
4 | | -#include "../builtin.h" |
---|
5 | | - |
---|
6 | 4 | #include <regex.h> |
---|
7 | | - |
---|
8 | | -#include "color.h" |
---|
| 5 | +#include <stdbool.h> |
---|
9 | 6 | #include <linux/list.h> |
---|
10 | | -#include "cache.h" |
---|
11 | 7 | #include <linux/rbtree.h> |
---|
12 | | -#include "symbol.h" |
---|
13 | | -#include "string.h" |
---|
| 8 | +#include "map_symbol.h" |
---|
| 9 | +#include "symbol_conf.h" |
---|
14 | 10 | #include "callchain.h" |
---|
15 | 11 | #include "values.h" |
---|
16 | | - |
---|
17 | | -#include "../perf.h" |
---|
18 | | -#include "debug.h" |
---|
19 | | -#include "header.h" |
---|
20 | | - |
---|
21 | | -#include <subcmd/parse-options.h> |
---|
22 | | -#include "parse-events.h" |
---|
23 | 12 | #include "hist.h" |
---|
24 | | -#include "srcline.h" |
---|
| 13 | +#include "stat.h" |
---|
| 14 | +#include "spark.h" |
---|
25 | 15 | |
---|
| 16 | +struct option; |
---|
26 | 17 | struct thread; |
---|
27 | 18 | |
---|
28 | 19 | extern regex_t parent_regex; |
---|
.. | .. |
---|
45 | 36 | extern struct sort_entry sort_srcline; |
---|
46 | 37 | extern enum sort_type sort__first_dimension; |
---|
47 | 38 | extern const char default_mem_sort_order[]; |
---|
| 39 | + |
---|
| 40 | +struct res_sample { |
---|
| 41 | + u64 time; |
---|
| 42 | + int cpu; |
---|
| 43 | + int tid; |
---|
| 44 | +}; |
---|
48 | 45 | |
---|
49 | 46 | struct he_stat { |
---|
50 | 47 | u64 period; |
---|
.. | .. |
---|
72 | 69 | |
---|
73 | 70 | /* HISTC_WEIGHTED_DIFF */ |
---|
74 | 71 | s64 wdiff; |
---|
| 72 | + |
---|
| 73 | + /* PERF_HPP_DIFF__CYCLES */ |
---|
| 74 | + s64 cycles; |
---|
75 | 75 | }; |
---|
| 76 | + struct stats stats; |
---|
| 77 | + unsigned long svals[NUM_SPARKS]; |
---|
76 | 78 | }; |
---|
77 | 79 | |
---|
78 | 80 | struct hist_entry_ops { |
---|
.. | .. |
---|
99 | 101 | struct thread *thread; |
---|
100 | 102 | struct comm *comm; |
---|
101 | 103 | struct namespace_id cgroup_id; |
---|
| 104 | + u64 cgroup; |
---|
102 | 105 | u64 ip; |
---|
103 | 106 | u64 transaction; |
---|
104 | 107 | s32 socket; |
---|
.. | .. |
---|
134 | 137 | char *srcfile; |
---|
135 | 138 | struct symbol *parent; |
---|
136 | 139 | struct branch_info *branch_info; |
---|
| 140 | + long time; |
---|
137 | 141 | struct hists *hists; |
---|
138 | 142 | struct mem_info *mem_info; |
---|
| 143 | + struct block_info *block_info; |
---|
139 | 144 | void *raw_data; |
---|
140 | 145 | u32 raw_size; |
---|
| 146 | + int num_res; |
---|
| 147 | + struct res_sample *res_samples; |
---|
141 | 148 | void *trace_output; |
---|
142 | 149 | struct perf_hpp_list *hpp_list; |
---|
143 | 150 | struct hist_entry *parent_he; |
---|
.. | .. |
---|
145 | 152 | union { |
---|
146 | 153 | /* this is for hierarchical entry structure */ |
---|
147 | 154 | struct { |
---|
148 | | - struct rb_root hroot_in; |
---|
149 | | - struct rb_root hroot_out; |
---|
| 155 | + struct rb_root_cached hroot_in; |
---|
| 156 | + struct rb_root_cached hroot_out; |
---|
150 | 157 | }; /* non-leaf entries */ |
---|
151 | 158 | struct rb_root sorted_chain; /* leaf entry has callchains */ |
---|
152 | 159 | }; |
---|
.. | .. |
---|
157 | 164 | { |
---|
158 | 165 | return he->callchain_size != 0; |
---|
159 | 166 | } |
---|
| 167 | + |
---|
| 168 | +int hist_entry__sym_snprintf(struct hist_entry *he, char *bf, size_t size, unsigned int width); |
---|
160 | 169 | |
---|
161 | 170 | static inline bool hist_entry__has_pairs(struct hist_entry *he) |
---|
162 | 171 | { |
---|
.. | .. |
---|
190 | 199 | return period * 100.0 / total_period; |
---|
191 | 200 | } |
---|
192 | 201 | |
---|
193 | | -static inline u64 cl_address(u64 address) |
---|
194 | | -{ |
---|
195 | | - /* return the cacheline of the address */ |
---|
196 | | - return (address & ~(cacheline_size() - 1)); |
---|
197 | | -} |
---|
198 | | - |
---|
199 | | -static inline u64 cl_offset(u64 address) |
---|
200 | | -{ |
---|
201 | | - /* return the cacheline of the address */ |
---|
202 | | - return (address & (cacheline_size() - 1)); |
---|
203 | | -} |
---|
204 | | - |
---|
205 | 202 | enum sort_mode { |
---|
206 | 203 | SORT_MODE__NORMAL, |
---|
207 | 204 | SORT_MODE__BRANCH, |
---|
.. | .. |
---|
228 | 225 | SORT_TRACE, |
---|
229 | 226 | SORT_SYM_SIZE, |
---|
230 | 227 | SORT_DSO_SIZE, |
---|
| 228 | + SORT_CGROUP, |
---|
231 | 229 | SORT_CGROUP_ID, |
---|
| 230 | + SORT_SYM_IPC_NULL, |
---|
| 231 | + SORT_TIME, |
---|
232 | 232 | |
---|
233 | 233 | /* branch stack specific sort keys */ |
---|
234 | 234 | __SORT_BRANCH_STACK, |
---|
.. | .. |
---|
242 | 242 | SORT_CYCLES, |
---|
243 | 243 | SORT_SRCLINE_FROM, |
---|
244 | 244 | SORT_SRCLINE_TO, |
---|
| 245 | + SORT_SYM_IPC, |
---|
245 | 246 | |
---|
246 | 247 | /* memory mode specific sort keys */ |
---|
247 | 248 | __SORT_MEMORY_MODE, |
---|
.. | .. |
---|
272 | 273 | u8 se_width_idx; |
---|
273 | 274 | }; |
---|
274 | 275 | |
---|
| 276 | +struct block_hist { |
---|
| 277 | + struct hists block_hists; |
---|
| 278 | + struct perf_hpp_list block_list; |
---|
| 279 | + struct perf_hpp_fmt block_fmt; |
---|
| 280 | + int block_idx; |
---|
| 281 | + bool valid; |
---|
| 282 | + struct hist_entry he; |
---|
| 283 | +}; |
---|
| 284 | + |
---|
275 | 285 | extern struct sort_entry sort_thread; |
---|
276 | 286 | extern struct list_head hist_entry__sort_list; |
---|
277 | 287 | |
---|
278 | | -struct perf_evlist; |
---|
| 288 | +struct evlist; |
---|
279 | 289 | struct tep_handle; |
---|
280 | | -int setup_sorting(struct perf_evlist *evlist); |
---|
| 290 | +int setup_sorting(struct evlist *evlist); |
---|
281 | 291 | int setup_output_field(void); |
---|
282 | 292 | void reset_output_field(void); |
---|
283 | 293 | void sort__setup_elide(FILE *fp); |
---|
284 | 294 | void perf_hpp__set_elide(int idx, bool elide); |
---|
| 295 | + |
---|
| 296 | +char *sort_help(const char *prefix); |
---|
285 | 297 | |
---|
286 | 298 | int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset); |
---|
287 | 299 | |
---|
.. | .. |
---|
290 | 302 | int hpp_dimension__add_output(unsigned col); |
---|
291 | 303 | void reset_dimensions(void); |
---|
292 | 304 | int sort_dimension__add(struct perf_hpp_list *list, const char *tok, |
---|
293 | | - struct perf_evlist *evlist, |
---|
| 305 | + struct evlist *evlist, |
---|
294 | 306 | int level); |
---|
295 | 307 | int output_field_add(struct perf_hpp_list *list, char *tok); |
---|
296 | 308 | int64_t |
---|
.. | .. |
---|
299 | 311 | sort__daddr_cmp(struct hist_entry *left, struct hist_entry *right); |
---|
300 | 312 | int64_t |
---|
301 | 313 | sort__dcacheline_cmp(struct hist_entry *left, struct hist_entry *right); |
---|
| 314 | +int64_t |
---|
| 315 | +_sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r); |
---|
302 | 316 | char *hist_entry__srcline(struct hist_entry *he); |
---|
303 | 317 | #endif /* __PERF_SORT_H */ |
---|