aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/hist.h')
-rw-r--r--tools/perf/util/hist.h59
1 files changed, 41 insertions, 18 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 3beb97c4d822..ff6f9d56ea41 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -2,6 +2,7 @@
2#define __PERF_HIST_H 2#define __PERF_HIST_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <pthread.h>
5#include "callchain.h" 6#include "callchain.h"
6 7
7extern struct callchain_param callchain_param; 8extern struct callchain_param callchain_param;
@@ -27,6 +28,7 @@ struct events_stats {
27 u64 total_lost; 28 u64 total_lost;
28 u64 total_invalid_chains; 29 u64 total_invalid_chains;
29 u32 nr_events[PERF_RECORD_HEADER_MAX]; 30 u32 nr_events[PERF_RECORD_HEADER_MAX];
31 u32 nr_lost_warned;
30 u32 nr_unknown_events; 32 u32 nr_unknown_events;
31 u32 nr_invalid_chains; 33 u32 nr_invalid_chains;
32 u32 nr_unknown_id; 34 u32 nr_unknown_id;
@@ -42,9 +44,18 @@ enum hist_column {
42 HISTC_NR_COLS, /* Last entry */ 44 HISTC_NR_COLS, /* Last entry */
43}; 45};
44 46
47struct thread;
48struct dso;
49
45struct hists { 50struct hists {
51 struct rb_root entries_in_array[2];
52 struct rb_root *entries_in;
46 struct rb_root entries; 53 struct rb_root entries;
54 struct rb_root entries_collapsed;
47 u64 nr_entries; 55 u64 nr_entries;
56 const struct thread *thread_filter;
57 const struct dso *dso_filter;
58 pthread_mutex_t lock;
48 struct events_stats stats; 59 struct events_stats stats;
49 u64 event_stream; 60 u64 event_stream;
50 u16 col_len[HISTC_NR_COLS]; 61 u16 col_len[HISTC_NR_COLS];
@@ -57,29 +68,35 @@ struct hist_entry *__hists__add_entry(struct hists *self,
57 struct symbol *parent, u64 period); 68 struct symbol *parent, u64 period);
58extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *); 69extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
59extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *); 70extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
60int hist_entry__fprintf(struct hist_entry *self, struct hists *hists, 71int hist_entry__fprintf(struct hist_entry *he, size_t size, struct hists *hists,
61 struct hists *pair_hists, bool show_displacement, 72 struct hists *pair_hists, bool show_displacement,
62 long displacement, FILE *fp, u64 total); 73 long displacement, FILE *fp, u64 session_total);
63int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size, 74int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
64 struct hists *hists, struct hists *pair_hists, 75 struct hists *hists);
65 bool show_displacement, long displacement,
66 bool color, u64 total);
67void hist_entry__free(struct hist_entry *); 76void hist_entry__free(struct hist_entry *);
68 77
69void hists__output_resort(struct hists *self); 78void hists__output_resort(struct hists *self);
79void hists__output_resort_threaded(struct hists *hists);
70void hists__collapse_resort(struct hists *self); 80void hists__collapse_resort(struct hists *self);
81void hists__collapse_resort_threaded(struct hists *hists);
82
83void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel);
84void hists__decay_entries_threaded(struct hists *hists, bool zap_user,
85 bool zap_kernel);
86void hists__output_recalc_col_len(struct hists *hists, int max_rows);
71 87
72void hists__inc_nr_events(struct hists *self, u32 type); 88void hists__inc_nr_events(struct hists *self, u32 type);
73size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); 89size_t hists__fprintf_nr_events(struct hists *self, FILE *fp);
74 90
75size_t hists__fprintf(struct hists *self, struct hists *pair, 91size_t hists__fprintf(struct hists *self, struct hists *pair,
76 bool show_displacement, FILE *fp); 92 bool show_displacement, bool show_header,
93 int max_rows, int max_cols, FILE *fp);
77 94
78int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); 95int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr);
79int hist_entry__annotate(struct hist_entry *self, size_t privsize); 96int hist_entry__annotate(struct hist_entry *self, size_t privsize);
80 97
81void hists__filter_by_dso(struct hists *self, const struct dso *dso); 98void hists__filter_by_dso(struct hists *hists);
82void hists__filter_by_thread(struct hists *self, const struct thread *thread); 99void hists__filter_by_thread(struct hists *hists);
83 100
84u16 hists__col_len(struct hists *self, enum hist_column col); 101u16 hists__col_len(struct hists *self, enum hist_column col);
85void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); 102void hists__set_col_len(struct hists *self, enum hist_column col, u16 len);
@@ -90,26 +107,32 @@ struct perf_evlist;
90#ifdef NO_NEWT_SUPPORT 107#ifdef NO_NEWT_SUPPORT
91static inline 108static inline
92int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used, 109int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used,
93 const char *help __used) 110 const char *help __used,
111 void(*timer)(void *arg) __used,
112 void *arg __used,
113 int refresh __used)
94{ 114{
95 return 0; 115 return 0;
96} 116}
97 117
98static inline int hist_entry__tui_annotate(struct hist_entry *self __used, 118static inline int hist_entry__tui_annotate(struct hist_entry *self __used,
99 int evidx __used) 119 int evidx __used,
120 void(*timer)(void *arg) __used,
121 void *arg __used,
122 int delay_secs __used)
100{ 123{
101 return 0; 124 return 0;
102} 125}
103#define KEY_LEFT -1 126#define K_LEFT -1
104#define KEY_RIGHT -2 127#define K_RIGHT -2
105#else 128#else
106#include <newt.h> 129#include "ui/keysyms.h"
107int hist_entry__tui_annotate(struct hist_entry *self, int evidx); 130int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
108 131 void(*timer)(void *arg), void *arg, int delay_secs);
109#define KEY_LEFT NEWT_KEY_LEFT
110#define KEY_RIGHT NEWT_KEY_RIGHT
111 132
112int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help); 133int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
134 void(*timer)(void *arg), void *arg,
135 int refresh);
113#endif 136#endif
114 137
115unsigned int hists__sort_list_width(struct hists *self); 138unsigned int hists__sort_list_width(struct hists *self);