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