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.h67
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
8extern struct callchain_param callchain_param; 9extern 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);
96void hists__output_recalc_col_len(struct hists *hists, int max_rows); 97void hists__output_recalc_col_len(struct hists *hists, int max_rows);
97 98
99void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h);
98void hists__inc_nr_events(struct hists *self, u32 type); 100void hists__inc_nr_events(struct hists *self, u32 type);
99size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); 101void events_stats__inc(struct events_stats *stats, u32 type);
102size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
100 103
101size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, 104size_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);
114void hists__reset_col_len(struct hists *hists); 117void hists__reset_col_len(struct hists *hists);
115void hists__calc_col_len(struct hists *hists, struct hist_entry *he); 118void hists__calc_col_len(struct hists *hists, struct hist_entry *he);
116 119
120void hists__match(struct hists *leader, struct hists *other);
121int hists__link(struct hists *leader, struct hists *other);
122
117struct perf_hpp { 123struct 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
124struct perf_hpp_fmt { 130struct 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
139extern 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
132extern struct perf_hpp_fmt perf_hpp__format[]; 144extern struct perf_hpp_fmt perf_hpp__format[];
133 145
134enum { 146enum {
@@ -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
149void perf_hpp__init(void); 164void perf_hpp__init(void);
150void perf_hpp__column_enable(unsigned col, bool enable); 165void perf_hpp__column_register(struct perf_hpp_fmt *format);
166void perf_hpp__column_enable(unsigned col);
151int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, 167int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
152 bool color); 168 bool color);
153 169
154struct perf_evlist; 170struct perf_evlist;
155 171
172struct 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"
158int hist_entry__tui_annotate(struct hist_entry *he, int evidx, 180int 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
161int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 183int 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);
186int script_browse(const char *script_opt);
164#else 187#else
165static inline 188static inline
166int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, 189int 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,
175static inline int hist_entry__tui_annotate(struct hist_entry *self 197static 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
206static 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
190int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, 216int 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
194static inline 219static inline
195int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, 220int 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
205unsigned int hists__sort_list_width(struct hists *self); 228unsigned int hists__sort_list_width(struct hists *self);
206 229
230double perf_diff__compute_delta(struct hist_entry *he, struct hist_entry *pair);
231double perf_diff__compute_ratio(struct hist_entry *he, struct hist_entry *pair);
232s64 perf_diff__compute_wdiff(struct hist_entry *he, struct hist_entry *pair);
233int perf_diff__formula(struct hist_entry *he, struct hist_entry *pair,
234 char *buf, size_t size);
235double perf_diff__period_percent(struct hist_entry *he, u64 period);
207#endif /* __PERF_HIST_H */ 236#endif /* __PERF_HIST_H */