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.h88
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
9extern struct callchain_param callchain_param; 11extern 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
82struct hist_entry *__hists__add_entry(struct hists *self, 87struct 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);
86int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); 93int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right);
87int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); 94int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right);
88int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size, 95int hist_entry__transaction_len(void);
96int hist_entry__sort_snprintf(struct hist_entry *he, char *bf, size_t size,
89 struct hists *hists); 97 struct hists *hists);
90void hist_entry__free(struct hist_entry *); 98void hist_entry__free(struct hist_entry *);
91 99
92struct hist_entry *__hists__add_branch_entry(struct hists *self, 100void hists__output_resort(struct hists *hists);
93 struct addr_location *al, 101void 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
99struct 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
106void hists__output_resort(struct hists *self);
107void hists__collapse_resort(struct hists *self);
108 102
109void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); 103void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel);
110void hists__output_recalc_col_len(struct hists *hists, int max_rows); 104void hists__output_recalc_col_len(struct hists *hists, int max_rows);
111 105
112void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h); 106void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h);
113void hists__inc_nr_events(struct hists *self, u32 type); 107void hists__inc_nr_events(struct hists *hists, u32 type);
114void events_stats__inc(struct events_stats *stats, u32 type); 108void events_stats__inc(struct events_stats *stats, u32 type);
115size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); 109size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
116 110
117size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, 111size_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
120int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); 114int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);
121int hist_entry__annotate(struct hist_entry *self, size_t privsize); 115int hist_entry__annotate(struct hist_entry *he, size_t privsize);
122 116
123void hists__filter_by_dso(struct hists *hists); 117void hists__filter_by_dso(struct hists *hists);
124void hists__filter_by_thread(struct hists *hists); 118void hists__filter_by_thread(struct hists *hists);
125void hists__filter_by_symbol(struct hists *hists); 119void hists__filter_by_symbol(struct hists *hists);
126 120
127u16 hists__col_len(struct hists *self, enum hist_column col); 121u16 hists__col_len(struct hists *hists, enum hist_column col);
128void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); 122void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len);
129bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len); 123bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len);
130void hists__reset_col_len(struct hists *hists); 124void hists__reset_col_len(struct hists *hists);
131void hists__calc_col_len(struct hists *hists, struct hist_entry *he); 125void hists__calc_col_len(struct hists *hists, struct hist_entry *he);
132 126
@@ -175,6 +169,18 @@ void perf_hpp__init(void);
175void perf_hpp__column_register(struct perf_hpp_fmt *format); 169void perf_hpp__column_register(struct perf_hpp_fmt *format);
176void perf_hpp__column_enable(unsigned col); 170void perf_hpp__column_enable(unsigned col);
177 171
172static inline size_t perf_hpp__use_color(void)
173{
174 return !symbol_conf.field_sep;
175}
176
177static 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
178struct perf_evlist; 184struct perf_evlist;
179 185
180struct hist_browser_timer { 186struct 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"
188int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, 194int 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
207static inline int hist_entry__tui_annotate(struct hist_entry *self 213static 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 230unsigned int hists__sort_list_width(struct hists *hists);
228int 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
232static inline
233int 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
242unsigned int hists__sort_list_width(struct hists *self);
243#endif /* __PERF_HIST_H */ 231#endif /* __PERF_HIST_H */