diff options
Diffstat (limited to 'tools/perf/util/hist.h')
-rw-r--r-- | tools/perf/util/hist.h | 61 |
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 | ||
7 | extern struct callchain_param callchain_param; | 8 | extern 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 | ||
46 | struct thread; | ||
47 | struct dso; | ||
48 | |||
45 | struct hists { | 49 | struct 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 | ||
65 | void hists__init(struct hists *hists); | ||
66 | |||
55 | struct hist_entry *__hists__add_entry(struct hists *self, | 67 | struct 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); |
58 | extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *); | 70 | extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *); |
59 | extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *); | 71 | extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *); |
60 | int hist_entry__fprintf(struct hist_entry *self, struct hists *hists, | 72 | int 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); |
63 | int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size, | 75 | int 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); | ||
67 | void hist_entry__free(struct hist_entry *); | 77 | void hist_entry__free(struct hist_entry *); |
68 | 78 | ||
69 | void hists__output_resort(struct hists *self); | 79 | void hists__output_resort(struct hists *self); |
80 | void hists__output_resort_threaded(struct hists *hists); | ||
70 | void hists__collapse_resort(struct hists *self); | 81 | void hists__collapse_resort(struct hists *self); |
82 | void hists__collapse_resort_threaded(struct hists *hists); | ||
83 | |||
84 | void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); | ||
85 | void hists__decay_entries_threaded(struct hists *hists, bool zap_user, | ||
86 | bool zap_kernel); | ||
87 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); | ||
71 | 88 | ||
72 | void hists__inc_nr_events(struct hists *self, u32 type); | 89 | void hists__inc_nr_events(struct hists *self, u32 type); |
73 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); | 90 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); |
74 | 91 | ||
75 | size_t hists__fprintf(struct hists *self, struct hists *pair, | 92 | size_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 | ||
78 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); | 96 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); |
79 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); | 97 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); |
80 | 98 | ||
81 | void hists__filter_by_dso(struct hists *self, const struct dso *dso); | 99 | void hists__filter_by_dso(struct hists *hists); |
82 | void hists__filter_by_thread(struct hists *self, const struct thread *thread); | 100 | void hists__filter_by_thread(struct hists *hists); |
83 | 101 | ||
84 | u16 hists__col_len(struct hists *self, enum hist_column col); | 102 | u16 hists__col_len(struct hists *self, enum hist_column col); |
85 | void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); | 103 | void 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 |
91 | static inline | 109 | static inline |
92 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used, | 110 | int 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 | ||
98 | static inline int hist_entry__tui_annotate(struct hist_entry *self __used, | 119 | static 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" |
107 | int hist_entry__tui_annotate(struct hist_entry *self, int evidx); | 132 | int 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 | ||
112 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help); | 135 | int 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 | ||
115 | unsigned int hists__sort_list_width(struct hists *self); | 140 | unsigned int hists__sort_list_width(struct hists *self); |