diff options
Diffstat (limited to 'tools/perf/util/hist.h')
-rw-r--r-- | tools/perf/util/hist.h | 88 |
1 files changed, 38 insertions, 50 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 1329b6b6ffe6..b621347a1585 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <pthread.h> | 5 | #include <pthread.h> |
6 | #include "callchain.h" | 6 | #include "callchain.h" |
7 | #include "header.h" | 7 | #include "header.h" |
8 | #include "color.h" | ||
9 | #include "ui/progress.h" | ||
8 | 10 | ||
9 | extern struct callchain_param callchain_param; | 11 | extern struct callchain_param callchain_param; |
10 | 12 | ||
@@ -45,6 +47,8 @@ enum hist_column { | |||
45 | HISTC_CPU, | 47 | HISTC_CPU, |
46 | HISTC_SRCLINE, | 48 | HISTC_SRCLINE, |
47 | HISTC_MISPREDICT, | 49 | HISTC_MISPREDICT, |
50 | HISTC_IN_TX, | ||
51 | HISTC_ABORT, | ||
48 | HISTC_SYMBOL_FROM, | 52 | HISTC_SYMBOL_FROM, |
49 | HISTC_SYMBOL_TO, | 53 | HISTC_SYMBOL_TO, |
50 | HISTC_DSO_FROM, | 54 | HISTC_DSO_FROM, |
@@ -57,6 +61,7 @@ enum hist_column { | |||
57 | HISTC_MEM_TLB, | 61 | HISTC_MEM_TLB, |
58 | HISTC_MEM_LVL, | 62 | HISTC_MEM_LVL, |
59 | HISTC_MEM_SNOOP, | 63 | HISTC_MEM_SNOOP, |
64 | HISTC_TRANSACTION, | ||
60 | HISTC_NR_COLS, /* Last entry */ | 65 | HISTC_NR_COLS, /* Last entry */ |
61 | }; | 66 | }; |
62 | 67 | ||
@@ -79,54 +84,43 @@ struct hists { | |||
79 | u16 col_len[HISTC_NR_COLS]; | 84 | u16 col_len[HISTC_NR_COLS]; |
80 | }; | 85 | }; |
81 | 86 | ||
82 | struct hist_entry *__hists__add_entry(struct hists *self, | 87 | struct hist_entry *__hists__add_entry(struct hists *hists, |
83 | struct addr_location *al, | 88 | struct addr_location *al, |
84 | struct symbol *parent, u64 period, | 89 | struct symbol *parent, |
85 | u64 weight); | 90 | struct branch_info *bi, |
91 | struct mem_info *mi, u64 period, | ||
92 | u64 weight, u64 transaction); | ||
86 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); | 93 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); |
87 | int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); | 94 | int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); |
88 | int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size, | 95 | int hist_entry__transaction_len(void); |
96 | int hist_entry__sort_snprintf(struct hist_entry *he, char *bf, size_t size, | ||
89 | struct hists *hists); | 97 | struct hists *hists); |
90 | void hist_entry__free(struct hist_entry *); | 98 | void hist_entry__free(struct hist_entry *); |
91 | 99 | ||
92 | struct hist_entry *__hists__add_branch_entry(struct hists *self, | 100 | void hists__output_resort(struct hists *hists); |
93 | struct addr_location *al, | 101 | void hists__collapse_resort(struct hists *hists, struct ui_progress *prog); |
94 | struct symbol *sym_parent, | ||
95 | struct branch_info *bi, | ||
96 | u64 period, | ||
97 | u64 weight); | ||
98 | |||
99 | struct hist_entry *__hists__add_mem_entry(struct hists *self, | ||
100 | struct addr_location *al, | ||
101 | struct symbol *sym_parent, | ||
102 | struct mem_info *mi, | ||
103 | u64 period, | ||
104 | u64 weight); | ||
105 | |||
106 | void hists__output_resort(struct hists *self); | ||
107 | void hists__collapse_resort(struct hists *self); | ||
108 | 102 | ||
109 | void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); | 103 | void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); |
110 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); | 104 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); |
111 | 105 | ||
112 | void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h); | 106 | void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h); |
113 | void hists__inc_nr_events(struct hists *self, u32 type); | 107 | void hists__inc_nr_events(struct hists *hists, u32 type); |
114 | void events_stats__inc(struct events_stats *stats, u32 type); | 108 | void events_stats__inc(struct events_stats *stats, u32 type); |
115 | size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); | 109 | size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); |
116 | 110 | ||
117 | size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, | 111 | size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, |
118 | int max_cols, float min_pcnt, FILE *fp); | 112 | int max_cols, float min_pcnt, FILE *fp); |
119 | 113 | ||
120 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); | 114 | int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr); |
121 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); | 115 | int hist_entry__annotate(struct hist_entry *he, size_t privsize); |
122 | 116 | ||
123 | void hists__filter_by_dso(struct hists *hists); | 117 | void hists__filter_by_dso(struct hists *hists); |
124 | void hists__filter_by_thread(struct hists *hists); | 118 | void hists__filter_by_thread(struct hists *hists); |
125 | void hists__filter_by_symbol(struct hists *hists); | 119 | void hists__filter_by_symbol(struct hists *hists); |
126 | 120 | ||
127 | u16 hists__col_len(struct hists *self, enum hist_column col); | 121 | u16 hists__col_len(struct hists *hists, enum hist_column col); |
128 | void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); | 122 | void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len); |
129 | bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len); | 123 | bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len); |
130 | void hists__reset_col_len(struct hists *hists); | 124 | void hists__reset_col_len(struct hists *hists); |
131 | void hists__calc_col_len(struct hists *hists, struct hist_entry *he); | 125 | void hists__calc_col_len(struct hists *hists, struct hist_entry *he); |
132 | 126 | ||
@@ -175,6 +169,18 @@ void perf_hpp__init(void); | |||
175 | void perf_hpp__column_register(struct perf_hpp_fmt *format); | 169 | void perf_hpp__column_register(struct perf_hpp_fmt *format); |
176 | void perf_hpp__column_enable(unsigned col); | 170 | void perf_hpp__column_enable(unsigned col); |
177 | 171 | ||
172 | static inline size_t perf_hpp__use_color(void) | ||
173 | { | ||
174 | return !symbol_conf.field_sep; | ||
175 | } | ||
176 | |||
177 | static inline size_t perf_hpp__color_overhead(void) | ||
178 | { | ||
179 | return perf_hpp__use_color() ? | ||
180 | (COLOR_MAXLEN + sizeof(PERF_COLOR_RESET)) * PERF_HPP__MAX_INDEX | ||
181 | : 0; | ||
182 | } | ||
183 | |||
178 | struct perf_evlist; | 184 | struct perf_evlist; |
179 | 185 | ||
180 | struct hist_browser_timer { | 186 | struct hist_browser_timer { |
@@ -183,7 +189,7 @@ struct hist_browser_timer { | |||
183 | int refresh; | 189 | int refresh; |
184 | }; | 190 | }; |
185 | 191 | ||
186 | #ifdef SLANG_SUPPORT | 192 | #ifdef HAVE_SLANG_SUPPORT |
187 | #include "../ui/keysyms.h" | 193 | #include "../ui/keysyms.h" |
188 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, | 194 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, |
189 | struct hist_browser_timer *hbt); | 195 | struct hist_browser_timer *hbt); |
@@ -204,12 +210,9 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | |||
204 | return 0; | 210 | return 0; |
205 | } | 211 | } |
206 | 212 | ||
207 | static inline int hist_entry__tui_annotate(struct hist_entry *self | 213 | static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused, |
208 | __maybe_unused, | 214 | struct perf_evsel *evsel __maybe_unused, |
209 | struct perf_evsel *evsel | 215 | struct hist_browser_timer *hbt __maybe_unused) |
210 | __maybe_unused, | ||
211 | struct hist_browser_timer *hbt | ||
212 | __maybe_unused) | ||
213 | { | 216 | { |
214 | return 0; | 217 | return 0; |
215 | } | 218 | } |
@@ -224,20 +227,5 @@ static inline int script_browse(const char *script_opt __maybe_unused) | |||
224 | #define K_SWITCH_INPUT_DATA -3000 | 227 | #define K_SWITCH_INPUT_DATA -3000 |
225 | #endif | 228 | #endif |
226 | 229 | ||
227 | #ifdef GTK2_SUPPORT | 230 | unsigned int hists__sort_list_width(struct hists *hists); |
228 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | ||
229 | struct hist_browser_timer *hbt __maybe_unused, | ||
230 | float min_pcnt); | ||
231 | #else | ||
232 | static inline | ||
233 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | ||
234 | const char *help __maybe_unused, | ||
235 | struct hist_browser_timer *hbt __maybe_unused, | ||
236 | float min_pcnt __maybe_unused) | ||
237 | { | ||
238 | return 0; | ||
239 | } | ||
240 | #endif | ||
241 | |||
242 | unsigned int hists__sort_list_width(struct hists *self); | ||
243 | #endif /* __PERF_HIST_H */ | 231 | #endif /* __PERF_HIST_H */ |