aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r--tools/perf/util/annotate.h76
1 files changed, 42 insertions, 34 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index f6ba3560de5e..ce427445671f 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -59,33 +59,55 @@ bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2);
59 59
60struct annotation; 60struct annotation;
61 61
62struct sym_hist_entry {
63 u64 nr_samples;
64 u64 period;
65};
66
67struct annotation_data {
68 double percent;
69 double percent_sum;
70 struct sym_hist_entry he;
71};
72
73struct annotation_line {
74 struct list_head node;
75 struct rb_node rb_node;
76 s64 offset;
77 char *line;
78 int line_nr;
79 float ipc;
80 u64 cycles;
81 size_t privsize;
82 char *path;
83 int samples_nr;
84 struct annotation_data samples[0];
85};
86
62struct disasm_line { 87struct disasm_line {
63 struct list_head node; 88 struct ins ins;
64 s64 offset; 89 struct ins_operands ops;
65 char *line; 90
66 struct ins ins; 91 /* This needs to be at the end. */
67 int line_nr; 92 struct annotation_line al;
68 float ipc;
69 u64 cycles;
70 struct ins_operands ops;
71}; 93};
72 94
95static inline struct disasm_line *disasm_line(struct annotation_line *al)
96{
97 return al ? container_of(al, struct disasm_line, al) : NULL;
98}
99
73static inline bool disasm_line__has_offset(const struct disasm_line *dl) 100static inline bool disasm_line__has_offset(const struct disasm_line *dl)
74{ 101{
75 return dl->ops.target.offset_avail; 102 return dl->ops.target.offset_avail;
76} 103}
77 104
78struct sym_hist_entry {
79 u64 nr_samples;
80 u64 period;
81};
82
83void disasm_line__free(struct disasm_line *dl); 105void disasm_line__free(struct disasm_line *dl);
84struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos); 106struct annotation_line *
107annotation_line__next(struct annotation_line *pos, struct list_head *head);
85int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw); 108int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
86size_t disasm__fprintf(struct list_head *head, FILE *fp); 109size_t disasm__fprintf(struct list_head *head, FILE *fp);
87double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset, 110void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel);
88 s64 end, const char **path, struct sym_hist_entry *sample);
89 111
90struct sym_hist { 112struct sym_hist {
91 u64 nr_samples; 113 u64 nr_samples;
@@ -104,19 +126,6 @@ struct cyc_hist {
104 u16 reset; 126 u16 reset;
105}; 127};
106 128
107struct source_line_samples {
108 double percent;
109 double percent_sum;
110 u64 nr;
111};
112
113struct source_line {
114 struct rb_node node;
115 char *path;
116 int nr_pcnt;
117 struct source_line_samples samples[1];
118};
119
120/** struct annotated_source - symbols with hits have this attached as in sannotation 129/** struct annotated_source - symbols with hits have this attached as in sannotation
121 * 130 *
122 * @histogram: Array of addr hit histograms per event being monitored 131 * @histogram: Array of addr hit histograms per event being monitored
@@ -132,7 +141,6 @@ struct source_line {
132 */ 141 */
133struct annotated_source { 142struct annotated_source {
134 struct list_head source; 143 struct list_head source;
135 struct source_line *lines;
136 int nr_histograms; 144 int nr_histograms;
137 size_t sizeof_sym_hist; 145 size_t sizeof_sym_hist;
138 struct cyc_hist *cycles_hist; 146 struct cyc_hist *cycles_hist;
@@ -169,9 +177,9 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *samp
169int symbol__alloc_hist(struct symbol *sym); 177int symbol__alloc_hist(struct symbol *sym);
170void symbol__annotate_zero_histograms(struct symbol *sym); 178void symbol__annotate_zero_histograms(struct symbol *sym);
171 179
172int symbol__disassemble(struct symbol *sym, struct map *map, 180int symbol__annotate(struct symbol *sym, struct map *map,
173 const char *arch_name, size_t privsize, 181 struct perf_evsel *evsel, size_t privsize,
174 struct arch **parch, char *cpuid); 182 struct arch **parch);
175 183
176enum symbol_disassemble_errno { 184enum symbol_disassemble_errno {
177 SYMBOL_ANNOTATE_ERRNO__SUCCESS = 0, 185 SYMBOL_ANNOTATE_ERRNO__SUCCESS = 0,
@@ -198,7 +206,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
198 int min_pcnt, int max_lines, int context); 206 int min_pcnt, int max_lines, int context);
199void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); 207void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);
200void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); 208void symbol__annotate_decay_histogram(struct symbol *sym, int evidx);
201void disasm__purge(struct list_head *head); 209void annotated_source__purge(struct annotated_source *as);
202 210
203bool ui__has_annotation(void); 211bool ui__has_annotation(void);
204 212