hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/tools/perf/util/sort.h
....@@ -1,28 +1,19 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #ifndef __PERF_SORT_H
33 #define __PERF_SORT_H
4
-#include "../builtin.h"
5
-
64 #include <regex.h>
7
-
8
-#include "color.h"
5
+#include <stdbool.h>
96 #include <linux/list.h>
10
-#include "cache.h"
117 #include <linux/rbtree.h>
12
-#include "symbol.h"
13
-#include "string.h"
8
+#include "map_symbol.h"
9
+#include "symbol_conf.h"
1410 #include "callchain.h"
1511 #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"
2312 #include "hist.h"
24
-#include "srcline.h"
13
+#include "stat.h"
14
+#include "spark.h"
2515
16
+struct option;
2617 struct thread;
2718
2819 extern regex_t parent_regex;
....@@ -45,6 +36,12 @@
4536 extern struct sort_entry sort_srcline;
4637 extern enum sort_type sort__first_dimension;
4738 extern const char default_mem_sort_order[];
39
+
40
+struct res_sample {
41
+ u64 time;
42
+ int cpu;
43
+ int tid;
44
+};
4845
4946 struct he_stat {
5047 u64 period;
....@@ -72,7 +69,12 @@
7269
7370 /* HISTC_WEIGHTED_DIFF */
7471 s64 wdiff;
72
+
73
+ /* PERF_HPP_DIFF__CYCLES */
74
+ s64 cycles;
7575 };
76
+ struct stats stats;
77
+ unsigned long svals[NUM_SPARKS];
7678 };
7779
7880 struct hist_entry_ops {
....@@ -99,6 +101,7 @@
99101 struct thread *thread;
100102 struct comm *comm;
101103 struct namespace_id cgroup_id;
104
+ u64 cgroup;
102105 u64 ip;
103106 u64 transaction;
104107 s32 socket;
....@@ -134,10 +137,14 @@
134137 char *srcfile;
135138 struct symbol *parent;
136139 struct branch_info *branch_info;
140
+ long time;
137141 struct hists *hists;
138142 struct mem_info *mem_info;
143
+ struct block_info *block_info;
139144 void *raw_data;
140145 u32 raw_size;
146
+ int num_res;
147
+ struct res_sample *res_samples;
141148 void *trace_output;
142149 struct perf_hpp_list *hpp_list;
143150 struct hist_entry *parent_he;
....@@ -145,8 +152,8 @@
145152 union {
146153 /* this is for hierarchical entry structure */
147154 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;
150157 }; /* non-leaf entries */
151158 struct rb_root sorted_chain; /* leaf entry has callchains */
152159 };
....@@ -157,6 +164,8 @@
157164 {
158165 return he->callchain_size != 0;
159166 }
167
+
168
+int hist_entry__sym_snprintf(struct hist_entry *he, char *bf, size_t size, unsigned int width);
160169
161170 static inline bool hist_entry__has_pairs(struct hist_entry *he)
162171 {
....@@ -190,18 +199,6 @@
190199 return period * 100.0 / total_period;
191200 }
192201
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
-
205202 enum sort_mode {
206203 SORT_MODE__NORMAL,
207204 SORT_MODE__BRANCH,
....@@ -228,7 +225,10 @@
228225 SORT_TRACE,
229226 SORT_SYM_SIZE,
230227 SORT_DSO_SIZE,
228
+ SORT_CGROUP,
231229 SORT_CGROUP_ID,
230
+ SORT_SYM_IPC_NULL,
231
+ SORT_TIME,
232232
233233 /* branch stack specific sort keys */
234234 __SORT_BRANCH_STACK,
....@@ -242,6 +242,7 @@
242242 SORT_CYCLES,
243243 SORT_SRCLINE_FROM,
244244 SORT_SRCLINE_TO,
245
+ SORT_SYM_IPC,
245246
246247 /* memory mode specific sort keys */
247248 __SORT_MEMORY_MODE,
....@@ -272,16 +273,27 @@
272273 u8 se_width_idx;
273274 };
274275
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
+
275285 extern struct sort_entry sort_thread;
276286 extern struct list_head hist_entry__sort_list;
277287
278
-struct perf_evlist;
288
+struct evlist;
279289 struct tep_handle;
280
-int setup_sorting(struct perf_evlist *evlist);
290
+int setup_sorting(struct evlist *evlist);
281291 int setup_output_field(void);
282292 void reset_output_field(void);
283293 void sort__setup_elide(FILE *fp);
284294 void perf_hpp__set_elide(int idx, bool elide);
295
+
296
+char *sort_help(const char *prefix);
285297
286298 int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset);
287299
....@@ -290,7 +302,7 @@
290302 int hpp_dimension__add_output(unsigned col);
291303 void reset_dimensions(void);
292304 int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
293
- struct perf_evlist *evlist,
305
+ struct evlist *evlist,
294306 int level);
295307 int output_field_add(struct perf_hpp_list *list, char *tok);
296308 int64_t
....@@ -299,5 +311,7 @@
299311 sort__daddr_cmp(struct hist_entry *left, struct hist_entry *right);
300312 int64_t
301313 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);
302316 char *hist_entry__srcline(struct hist_entry *he);
303317 #endif /* __PERF_SORT_H */