blob: 1c5f93ac5ab72767b7e059a5f0ed180ae0609b6f [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 Melo1c02c4d2010-05-10 13:04:11 -030014struct events_stats {
15 u64 total;
16 u64 lost;
17};
18
19struct hists {
20 struct rb_node rb_node;
21 struct rb_root entries;
Arnaldo Carvalho de Melofefb0b92010-05-10 13:57:51 -030022 u64 nr_entries;
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030023 struct events_stats stats;
24 u64 config;
25 u64 event_stream;
26 u32 type;
Arnaldo Carvalho de Melofefb0b92010-05-10 13:57:51 -030027 u32 max_sym_namelen;
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030028};
29
30struct hist_entry *__hists__add_entry(struct hists *self,
31 struct addr_location *al,
32 struct symbol *parent, u64 count);
John Kacur3d1d07e2009-09-28 15:32:55 +020033extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
34extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030035int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
36 bool show_displacement, long displacement, FILE *fp,
37 u64 total);
38int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
39 struct hists *pair_hists, bool show_displacement,
40 long displacement, bool color, u64 total);
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -020041void hist_entry__free(struct hist_entry *);
42
Arnaldo Carvalho de Melofefb0b92010-05-10 13:57:51 -030043void hists__output_resort(struct hists *self);
Arnaldo Carvalho de Melo1c02c4d2010-05-10 13:04:11 -030044void hists__collapse_resort(struct hists *self);
45size_t hists__fprintf(struct hists *self, struct hists *pair,
46 bool show_displacement, FILE *fp);
Arnaldo Carvalho de Melob09e0192010-05-11 11:10:15 -030047
48void hists__filter_by_dso(struct hists *self, const struct dso *dso);
49void hists__filter_by_thread(struct hists *self, const struct thread *thread);
50
51#ifdef NO_NEWT_SUPPORT
52static inline int hists__browse(struct hists self __used,
53 const char *helpline __used,
54 const char *input_name __used)
55{
56 return 0;
57}
58#else
59int hists__browse(struct hists *self, const char *helpline,
60 const char *input_name);
61#endif
John Kacur3d1d07e2009-09-28 15:32:55 +020062#endif /* __PERF_HIST_H */