blob: 0b4c8df914bd0e5e67509ef34481236a50b2d045 [file] [log] [blame]
John Kacur3d1d07e2009-09-28 15:32:55 +02001#ifndef __PERF_HIST_H
2#define __PERF_HIST_H
John Kacur3d1d07e2009-09-28 15:32:55 +02003
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -02004#include <linux/types.h>
John Kacur3d1d07e2009-09-28 15:32:55 +02005#include "callchain.h"
John Kacur3d1d07e2009-09-28 15:32:55 +02006
John Kacur3d1d07e2009-09-28 15:32:55 +02007extern struct callchain_param callchain_param;
John Kacur3d1d07e2009-09-28 15:32:55 +02008
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -02009struct hist_entry;
10struct addr_location;
11struct symbol;
Eric B Munsond403d0a2010-03-05 12:51:06 -030012struct rb_root;
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -020013
Arnaldo Carvalho de Meloef7b93a2010-05-11 23:18:06 -030014struct objdump_line {
15 struct list_head node;
16 s64 offset;
17 char *line;
18};
19
20void objdump_line__free(struct objdump_line *self);
21struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
22 struct objdump_line *pos);
23
24struct sym_hist {
25 u64 sum;
26 u64 ip[0];
27};
28
29struct sym_ext {
30 struct rb_node node;
31 double percent;
32 char *path;
33};
34
35struct sym_priv {
36 struct sym_hist *hist;
37 struct sym_ext *ext;
38};
39
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030040struct events_stats {
41 u64 total;
42 u64 lost;
43};
44
45struct hists {
46 struct rb_node rb_node;
47 struct rb_root entries;
Arnaldo Carvalho de Melofefb0b92010-05-10 13:57:51 -030048 u64 nr_entries;
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030049 struct events_stats stats;
50 u64 config;
51 u64 event_stream;
52 u32 type;
Arnaldo Carvalho de Melofefb0b92010-05-10 13:57:51 -030053 u32 max_sym_namelen;
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030054};
55
56struct hist_entry *__hists__add_entry(struct hists *self,
57 struct addr_location *al,
58 struct symbol *parent, u64 count);
John Kacur3d1d07e2009-09-28 15:32:55 +020059extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
60extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030061int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
62 bool show_displacement, long displacement, FILE *fp,
63 u64 total);
64int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
65 struct hists *pair_hists, bool show_displacement,
66 long displacement, bool color, u64 total);
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -020067void hist_entry__free(struct hist_entry *);
68
Arnaldo Carvalho de Melofefb0b92010-05-10 13:57:51 -030069void hists__output_resort(struct hists *self);
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030070void hists__collapse_resort(struct hists *self);
71size_t hists__fprintf(struct hists *self, struct hists *pair,
72 bool show_displacement, FILE *fp);
Arnaldo Carvalho de Melob09e0192010-05-11 11:10:15 -030073
Arnaldo Carvalho de Meloef7b93a2010-05-11 23:18:06 -030074int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip);
75int hist_entry__annotate(struct hist_entry *self, struct list_head *head);
76
Arnaldo Carvalho de Melob09e0192010-05-11 11:10:15 -030077void hists__filter_by_dso(struct hists *self, const struct dso *dso);
78void hists__filter_by_thread(struct hists *self, const struct thread *thread);
79
80#ifdef NO_NEWT_SUPPORT
Frederic Weisbecker8769e1c2010-05-13 19:22:58 +020081static inline int hists__browse(struct hists *self __used,
Arnaldo Carvalho de Melob09e0192010-05-11 11:10:15 -030082 const char *helpline __used,
83 const char *input_name __used)
84{
85 return 0;
86}
87#else
88int hists__browse(struct hists *self, const char *helpline,
89 const char *input_name);
90#endif
John Kacur3d1d07e2009-09-28 15:32:55 +020091#endif /* __PERF_HIST_H */