diff options
Diffstat (limited to 'tools/perf/util/hist.h')
-rw-r--r-- | tools/perf/util/hist.h | 67 |
1 files changed, 48 insertions, 19 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 66cb31fe81d2..38624686ee9a 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <pthread.h> | 5 | #include <pthread.h> |
6 | #include "callchain.h" | 6 | #include "callchain.h" |
7 | #include "header.h" | ||
7 | 8 | ||
8 | extern struct callchain_param callchain_param; | 9 | extern struct callchain_param callchain_param; |
9 | 10 | ||
@@ -95,8 +96,10 @@ void hists__decay_entries_threaded(struct hists *hists, bool zap_user, | |||
95 | bool zap_kernel); | 96 | bool zap_kernel); |
96 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); | 97 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); |
97 | 98 | ||
99 | void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h); | ||
98 | void hists__inc_nr_events(struct hists *self, u32 type); | 100 | void hists__inc_nr_events(struct hists *self, u32 type); |
99 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); | 101 | void events_stats__inc(struct events_stats *stats, u32 type); |
102 | size_t events_stats__fprintf(struct events_stats *stats, FILE *fp); | ||
100 | 103 | ||
101 | size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, | 104 | size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, |
102 | int max_cols, FILE *fp); | 105 | int max_cols, FILE *fp); |
@@ -114,6 +117,9 @@ bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len); | |||
114 | void hists__reset_col_len(struct hists *hists); | 117 | void hists__reset_col_len(struct hists *hists); |
115 | void hists__calc_col_len(struct hists *hists, struct hist_entry *he); | 118 | void hists__calc_col_len(struct hists *hists, struct hist_entry *he); |
116 | 119 | ||
120 | void hists__match(struct hists *leader, struct hists *other); | ||
121 | int hists__link(struct hists *leader, struct hists *other); | ||
122 | |||
117 | struct perf_hpp { | 123 | struct perf_hpp { |
118 | char *buf; | 124 | char *buf; |
119 | size_t size; | 125 | size_t size; |
@@ -122,13 +128,19 @@ struct perf_hpp { | |||
122 | }; | 128 | }; |
123 | 129 | ||
124 | struct perf_hpp_fmt { | 130 | struct perf_hpp_fmt { |
125 | bool cond; | ||
126 | int (*header)(struct perf_hpp *hpp); | 131 | int (*header)(struct perf_hpp *hpp); |
127 | int (*width)(struct perf_hpp *hpp); | 132 | int (*width)(struct perf_hpp *hpp); |
128 | int (*color)(struct perf_hpp *hpp, struct hist_entry *he); | 133 | int (*color)(struct perf_hpp *hpp, struct hist_entry *he); |
129 | int (*entry)(struct perf_hpp *hpp, struct hist_entry *he); | 134 | int (*entry)(struct perf_hpp *hpp, struct hist_entry *he); |
135 | |||
136 | struct list_head list; | ||
130 | }; | 137 | }; |
131 | 138 | ||
139 | extern struct list_head perf_hpp__list; | ||
140 | |||
141 | #define perf_hpp__for_each_format(format) \ | ||
142 | list_for_each_entry(format, &perf_hpp__list, list) | ||
143 | |||
132 | extern struct perf_hpp_fmt perf_hpp__format[]; | 144 | extern struct perf_hpp_fmt perf_hpp__format[]; |
133 | 145 | ||
134 | enum { | 146 | enum { |
@@ -140,34 +152,44 @@ enum { | |||
140 | PERF_HPP__OVERHEAD_GUEST_US, | 152 | PERF_HPP__OVERHEAD_GUEST_US, |
141 | PERF_HPP__SAMPLES, | 153 | PERF_HPP__SAMPLES, |
142 | PERF_HPP__PERIOD, | 154 | PERF_HPP__PERIOD, |
155 | PERF_HPP__PERIOD_BASELINE, | ||
143 | PERF_HPP__DELTA, | 156 | PERF_HPP__DELTA, |
144 | PERF_HPP__DISPL, | 157 | PERF_HPP__RATIO, |
158 | PERF_HPP__WEIGHTED_DIFF, | ||
159 | PERF_HPP__FORMULA, | ||
145 | 160 | ||
146 | PERF_HPP__MAX_INDEX | 161 | PERF_HPP__MAX_INDEX |
147 | }; | 162 | }; |
148 | 163 | ||
149 | void perf_hpp__init(void); | 164 | void perf_hpp__init(void); |
150 | void perf_hpp__column_enable(unsigned col, bool enable); | 165 | void perf_hpp__column_register(struct perf_hpp_fmt *format); |
166 | void perf_hpp__column_enable(unsigned col); | ||
151 | int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, | 167 | int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, |
152 | bool color); | 168 | bool color); |
153 | 169 | ||
154 | struct perf_evlist; | 170 | struct perf_evlist; |
155 | 171 | ||
172 | struct hist_browser_timer { | ||
173 | void (*timer)(void *arg); | ||
174 | void *arg; | ||
175 | int refresh; | ||
176 | }; | ||
177 | |||
156 | #ifdef NEWT_SUPPORT | 178 | #ifdef NEWT_SUPPORT |
157 | #include "../ui/keysyms.h" | 179 | #include "../ui/keysyms.h" |
158 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | 180 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, |
159 | void(*timer)(void *arg), void *arg, int delay_secs); | 181 | struct hist_browser_timer *hbt); |
160 | 182 | ||
161 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | 183 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, |
162 | void(*timer)(void *arg), void *arg, | 184 | struct hist_browser_timer *hbt, |
163 | int refresh); | 185 | struct perf_session_env *env); |
186 | int script_browse(const char *script_opt); | ||
164 | #else | 187 | #else |
165 | static inline | 188 | static inline |
166 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | 189 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, |
167 | const char *help __maybe_unused, | 190 | const char *help __maybe_unused, |
168 | void(*timer)(void *arg) __maybe_unused, | 191 | struct hist_browser_timer *hbt __maybe_unused, |
169 | void *arg __maybe_unused, | 192 | struct perf_session_env *env __maybe_unused) |
170 | int refresh __maybe_unused) | ||
171 | { | 193 | { |
172 | return 0; | 194 | return 0; |
173 | } | 195 | } |
@@ -175,28 +197,29 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | |||
175 | static inline int hist_entry__tui_annotate(struct hist_entry *self | 197 | static inline int hist_entry__tui_annotate(struct hist_entry *self |
176 | __maybe_unused, | 198 | __maybe_unused, |
177 | int evidx __maybe_unused, | 199 | int evidx __maybe_unused, |
178 | void(*timer)(void *arg) | 200 | struct hist_browser_timer *hbt |
179 | __maybe_unused, | 201 | __maybe_unused) |
180 | void *arg __maybe_unused, | 202 | { |
181 | int delay_secs __maybe_unused) | 203 | return 0; |
204 | } | ||
205 | |||
206 | static inline int script_browse(const char *script_opt __maybe_unused) | ||
182 | { | 207 | { |
183 | return 0; | 208 | return 0; |
184 | } | 209 | } |
210 | |||
185 | #define K_LEFT -1 | 211 | #define K_LEFT -1 |
186 | #define K_RIGHT -2 | 212 | #define K_RIGHT -2 |
187 | #endif | 213 | #endif |
188 | 214 | ||
189 | #ifdef GTK2_SUPPORT | 215 | #ifdef GTK2_SUPPORT |
190 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | 216 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, |
191 | void(*timer)(void *arg), void *arg, | 217 | struct hist_browser_timer *hbt __maybe_unused); |
192 | int refresh); | ||
193 | #else | 218 | #else |
194 | static inline | 219 | static inline |
195 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | 220 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, |
196 | const char *help __maybe_unused, | 221 | const char *help __maybe_unused, |
197 | void(*timer)(void *arg) __maybe_unused, | 222 | struct hist_browser_timer *hbt __maybe_unused) |
198 | void *arg __maybe_unused, | ||
199 | int refresh __maybe_unused) | ||
200 | { | 223 | { |
201 | return 0; | 224 | return 0; |
202 | } | 225 | } |
@@ -204,4 +227,10 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | |||
204 | 227 | ||
205 | unsigned int hists__sort_list_width(struct hists *self); | 228 | unsigned int hists__sort_list_width(struct hists *self); |
206 | 229 | ||
230 | double perf_diff__compute_delta(struct hist_entry *he, struct hist_entry *pair); | ||
231 | double perf_diff__compute_ratio(struct hist_entry *he, struct hist_entry *pair); | ||
232 | s64 perf_diff__compute_wdiff(struct hist_entry *he, struct hist_entry *pair); | ||
233 | int perf_diff__formula(struct hist_entry *he, struct hist_entry *pair, | ||
234 | char *buf, size_t size); | ||
235 | double perf_diff__period_percent(struct hist_entry *he, u64 period); | ||
207 | #endif /* __PERF_HIST_H */ | 236 | #endif /* __PERF_HIST_H */ |