blob: 13806d782af6b1c823d2886c73ad7acee6305148 [file] [log] [blame]
John Kacurdd68ada2009-09-24 18:02:49 +02001#ifndef __PERF_SORT_H
2#define __PERF_SORT_H
3#include "../builtin.h"
4
5#include "util.h"
6
7#include "color.h"
8#include <linux/list.h>
9#include "cache.h"
10#include <linux/rbtree.h>
11#include "symbol.h"
12#include "string.h"
13#include "callchain.h"
14#include "strlist.h"
15#include "values.h"
16
17#include "../perf.h"
18#include "debug.h"
19#include "header.h"
20
21#include "parse-options.h"
22#include "parse-events.h"
23
24#include "thread.h"
25#include "sort.h"
26
27extern regex_t parent_regex;
28extern char *sort_order;
29extern char default_parent_pattern[];
30extern char *parent_pattern;
31extern char default_sort_order[];
32extern int sort__need_collapse;
33extern int sort__has_parent;
34extern char *field_sep;
35extern struct sort_entry sort_comm;
36extern struct sort_entry sort_dso;
37extern struct sort_entry sort_sym;
38extern struct sort_entry sort_parent;
39extern unsigned int dsos__col_width;
40extern unsigned int comms__col_width;
41extern unsigned int threads__col_width;
42
43struct hist_entry {
44 struct rb_node rb_node;
Arnaldo Carvalho de Melo439d4732009-10-02 03:29:58 -030045 u64 count;
John Kacurdd68ada2009-09-24 18:02:49 +020046 struct thread *thread;
47 struct map *map;
John Kacurdd68ada2009-09-24 18:02:49 +020048 struct symbol *sym;
John Kacurdd68ada2009-09-24 18:02:49 +020049 u64 ip;
50 char level;
Arnaldo Carvalho de Melo439d4732009-10-02 03:29:58 -030051 struct symbol *parent;
John Kacurdd68ada2009-09-24 18:02:49 +020052 struct callchain_node callchain;
53 struct rb_root sorted_chain;
John Kacurdd68ada2009-09-24 18:02:49 +020054};
55
56/*
57 * configurable sorting bits
58 */
59
60struct sort_entry {
61 struct list_head list;
62
63 const char *header;
64
65 int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
66 int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
67 size_t (*print)(FILE *fp, struct hist_entry *, unsigned int width);
68 unsigned int *width;
69 bool elide;
70};
71
72extern struct sort_entry sort_thread;
73extern struct list_head hist_entry__sort_list;
74
75extern int repsep_fprintf(FILE *fp, const char *fmt, ...);
76extern size_t sort__thread_print(FILE *, struct hist_entry *, unsigned int);
77extern size_t sort__comm_print(FILE *, struct hist_entry *, unsigned int);
78extern size_t sort__dso_print(FILE *, struct hist_entry *, unsigned int);
79extern size_t sort__sym_print(FILE *, struct hist_entry *, unsigned int __used);
80extern int64_t cmp_null(void *, void *);
81extern int64_t sort__thread_cmp(struct hist_entry *, struct hist_entry *);
82extern int64_t sort__comm_cmp(struct hist_entry *, struct hist_entry *);
83extern int64_t sort__comm_collapse(struct hist_entry *, struct hist_entry *);
84extern int64_t sort__dso_cmp(struct hist_entry *, struct hist_entry *);
85extern int64_t sort__sym_cmp(struct hist_entry *, struct hist_entry *);
86extern int64_t sort__parent_cmp(struct hist_entry *, struct hist_entry *);
87extern size_t sort__parent_print(FILE *, struct hist_entry *, unsigned int);
88extern int sort_dimension__add(const char *);
89
90#endif /* __PERF_SORT_H */