diff options
Diffstat (limited to 'tools/perf/util/hist.h')
-rw-r--r-- | tools/perf/util/hist.h | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 3beb97c4d822..ff6f9d56ea41 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; |
@@ -27,6 +28,7 @@ struct events_stats { | |||
27 | u64 total_lost; | 28 | u64 total_lost; |
28 | u64 total_invalid_chains; | 29 | u64 total_invalid_chains; |
29 | u32 nr_events[PERF_RECORD_HEADER_MAX]; | 30 | u32 nr_events[PERF_RECORD_HEADER_MAX]; |
31 | u32 nr_lost_warned; | ||
30 | u32 nr_unknown_events; | 32 | u32 nr_unknown_events; |
31 | u32 nr_invalid_chains; | 33 | u32 nr_invalid_chains; |
32 | u32 nr_unknown_id; | 34 | u32 nr_unknown_id; |
@@ -42,9 +44,18 @@ enum hist_column { | |||
42 | HISTC_NR_COLS, /* Last entry */ | 44 | HISTC_NR_COLS, /* Last entry */ |
43 | }; | 45 | }; |
44 | 46 | ||
47 | struct thread; | ||
48 | struct dso; | ||
49 | |||
45 | struct hists { | 50 | struct hists { |
51 | struct rb_root entries_in_array[2]; | ||
52 | struct rb_root *entries_in; | ||
46 | struct rb_root entries; | 53 | struct rb_root entries; |
54 | struct rb_root entries_collapsed; | ||
47 | u64 nr_entries; | 55 | u64 nr_entries; |
56 | const struct thread *thread_filter; | ||
57 | const struct dso *dso_filter; | ||
58 | pthread_mutex_t lock; | ||
48 | struct events_stats stats; | 59 | struct events_stats stats; |
49 | u64 event_stream; | 60 | u64 event_stream; |
50 | u16 col_len[HISTC_NR_COLS]; | 61 | u16 col_len[HISTC_NR_COLS]; |
@@ -57,29 +68,35 @@ struct hist_entry *__hists__add_entry(struct hists *self, | |||
57 | struct symbol *parent, u64 period); | 68 | struct symbol *parent, u64 period); |
58 | extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *); | 69 | 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 *); | 70 | extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *); |
60 | int hist_entry__fprintf(struct hist_entry *self, struct hists *hists, | 71 | int hist_entry__fprintf(struct hist_entry *he, size_t size, struct hists *hists, |
61 | struct hists *pair_hists, bool show_displacement, | 72 | struct hists *pair_hists, bool show_displacement, |
62 | long displacement, FILE *fp, u64 total); | 73 | long displacement, FILE *fp, u64 session_total); |
63 | int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size, | 74 | int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size, |
64 | struct hists *hists, struct hists *pair_hists, | 75 | struct hists *hists); |
65 | bool show_displacement, long displacement, | ||
66 | bool color, u64 total); | ||
67 | void hist_entry__free(struct hist_entry *); | 76 | void hist_entry__free(struct hist_entry *); |
68 | 77 | ||
69 | void hists__output_resort(struct hists *self); | 78 | void hists__output_resort(struct hists *self); |
79 | void hists__output_resort_threaded(struct hists *hists); | ||
70 | void hists__collapse_resort(struct hists *self); | 80 | void hists__collapse_resort(struct hists *self); |
81 | void hists__collapse_resort_threaded(struct hists *hists); | ||
82 | |||
83 | void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel); | ||
84 | void hists__decay_entries_threaded(struct hists *hists, bool zap_user, | ||
85 | bool zap_kernel); | ||
86 | void hists__output_recalc_col_len(struct hists *hists, int max_rows); | ||
71 | 87 | ||
72 | void hists__inc_nr_events(struct hists *self, u32 type); | 88 | void hists__inc_nr_events(struct hists *self, u32 type); |
73 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); | 89 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); |
74 | 90 | ||
75 | size_t hists__fprintf(struct hists *self, struct hists *pair, | 91 | size_t hists__fprintf(struct hists *self, struct hists *pair, |
76 | bool show_displacement, FILE *fp); | 92 | bool show_displacement, bool show_header, |
93 | int max_rows, int max_cols, FILE *fp); | ||
77 | 94 | ||
78 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); | 95 | 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); | 96 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); |
80 | 97 | ||
81 | void hists__filter_by_dso(struct hists *self, const struct dso *dso); | 98 | void hists__filter_by_dso(struct hists *hists); |
82 | void hists__filter_by_thread(struct hists *self, const struct thread *thread); | 99 | void hists__filter_by_thread(struct hists *hists); |
83 | 100 | ||
84 | u16 hists__col_len(struct hists *self, enum hist_column col); | 101 | 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); | 102 | void hists__set_col_len(struct hists *self, enum hist_column col, u16 len); |
@@ -90,26 +107,32 @@ struct perf_evlist; | |||
90 | #ifdef NO_NEWT_SUPPORT | 107 | #ifdef NO_NEWT_SUPPORT |
91 | static inline | 108 | static inline |
92 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used, | 109 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used, |
93 | const char *help __used) | 110 | const char *help __used, |
111 | void(*timer)(void *arg) __used, | ||
112 | void *arg __used, | ||
113 | int refresh __used) | ||
94 | { | 114 | { |
95 | return 0; | 115 | return 0; |
96 | } | 116 | } |
97 | 117 | ||
98 | static inline int hist_entry__tui_annotate(struct hist_entry *self __used, | 118 | static inline int hist_entry__tui_annotate(struct hist_entry *self __used, |
99 | int evidx __used) | 119 | int evidx __used, |
120 | void(*timer)(void *arg) __used, | ||
121 | void *arg __used, | ||
122 | int delay_secs __used) | ||
100 | { | 123 | { |
101 | return 0; | 124 | return 0; |
102 | } | 125 | } |
103 | #define KEY_LEFT -1 | 126 | #define K_LEFT -1 |
104 | #define KEY_RIGHT -2 | 127 | #define K_RIGHT -2 |
105 | #else | 128 | #else |
106 | #include <newt.h> | 129 | #include "ui/keysyms.h" |
107 | int hist_entry__tui_annotate(struct hist_entry *self, int evidx); | 130 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, |
108 | 131 | void(*timer)(void *arg), void *arg, int delay_secs); | |
109 | #define KEY_LEFT NEWT_KEY_LEFT | ||
110 | #define KEY_RIGHT NEWT_KEY_RIGHT | ||
111 | 132 | ||
112 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help); | 133 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, |
134 | void(*timer)(void *arg), void *arg, | ||
135 | int refresh); | ||
113 | #endif | 136 | #endif |
114 | 137 | ||
115 | unsigned int hists__sort_list_width(struct hists *self); | 138 | unsigned int hists__sort_list_width(struct hists *self); |