]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - tools/perf/util/annotate.h
1 #ifndef __PERF_ANNOTATE_H
2 #define __PERF_ANNOTATE_H
10 #include <linux/list.h>
11 #include <linux/rbtree.h>
32 struct ins_operands
*ops
;
38 void (*free
)(struct ins_operands
*ops
);
39 int (*parse
)(struct ins_operands
*ops
);
40 int (*scnprintf
)(struct ins
*ins
, char *bf
, size_t size
,
41 struct ins_operands
*ops
);
49 bool ins__is_jump(const struct ins
*ins
);
50 bool ins__is_call(const struct ins
*ins
);
51 int ins__scnprintf(struct ins
*ins
, char *bf
, size_t size
, struct ins_operands
*ops
);
54 struct list_head node
;
59 struct ins_operands ops
;
62 static inline bool disasm_line__has_offset(const struct disasm_line
*dl
)
64 return dl
->ops
.target
.offset
!= UINT64_MAX
;
67 void disasm_line__free(struct disasm_line
*dl
);
68 struct disasm_line
*disasm__get_next_ip_line(struct list_head
*head
, struct disasm_line
*pos
);
69 int disasm_line__scnprintf(struct disasm_line
*dl
, char *bf
, size_t size
, bool raw
);
70 size_t disasm__fprintf(struct list_head
*head
, FILE *fp
);
84 /** struct annotated_source - symbols with hits have this attached as in sannotation
86 * @histogram: Array of addr hit histograms per event being monitored
87 * @lines: If 'print_lines' is specified, per source code line percentages
88 * @source: source parsed from a disassembler like objdump -dS
90 * lines is allocated, percentages calculated and all sorted by percentage
91 * when the annotation is about to be presented, so the percentages are for
92 * one of the entries in the histogram array, i.e. for the event/counter being
93 * presented. It is deallocated right after symbol__{tui,tty,etc}_annotate
96 struct annotated_source
{
97 struct list_head source
;
98 struct source_line
*lines
;
101 struct sym_hist histograms
[0];
105 pthread_mutex_t lock
;
106 struct annotated_source
*src
;
110 struct annotation annotation
;
111 struct symbol symbol
;
114 static inline struct sym_hist
*annotation__histogram(struct annotation
*notes
, int idx
)
116 return (((void *)¬es
->src
->histograms
) +
117 (notes
->src
->sizeof_sym_hist
* idx
));
120 static inline struct annotation
*symbol__annotation(struct symbol
*sym
)
122 struct sannotation
*a
= container_of(sym
, struct sannotation
, symbol
);
123 return &a
->annotation
;
126 int symbol__inc_addr_samples(struct symbol
*sym
, struct map
*map
,
127 int evidx
, u64 addr
);
128 int symbol__alloc_hist(struct symbol
*sym
);
129 void symbol__annotate_zero_histograms(struct symbol
*sym
);
131 int symbol__annotate(struct symbol
*sym
, struct map
*map
, size_t privsize
);
132 int symbol__annotate_init(struct map
*map __maybe_unused
, struct symbol
*sym
);
133 int symbol__annotate_printf(struct symbol
*sym
, struct map
*map
, int evidx
,
134 bool full_paths
, int min_pcnt
, int max_lines
,
136 void symbol__annotate_zero_histogram(struct symbol
*sym
, int evidx
);
137 void symbol__annotate_decay_histogram(struct symbol
*sym
, int evidx
);
138 void disasm__purge(struct list_head
*head
);
140 int symbol__tty_annotate(struct symbol
*sym
, struct map
*map
, int evidx
,
141 bool print_lines
, bool full_paths
, int min_pcnt
,
145 int symbol__tui_annotate(struct symbol
*sym
, struct map
*map
, int evidx
,
146 struct hist_browser_timer
*hbt
);
148 static inline int symbol__tui_annotate(struct symbol
*sym __maybe_unused
,
149 struct map
*map __maybe_unused
,
150 int evidx __maybe_unused
,
151 struct hist_browser_timer
*hbt
159 int symbol__gtk_annotate(struct symbol
*sym
, struct map
*map
, int evidx
,
160 struct hist_browser_timer
*hbt
);
162 static inline int hist_entry__gtk_annotate(struct hist_entry
*he
, int evidx
,
163 struct hist_browser_timer
*hbt
)
165 return symbol__gtk_annotate(he
->ms
.sym
, he
->ms
.map
, evidx
, hbt
);
168 static inline int hist_entry__gtk_annotate(struct hist_entry
*he __maybe_unused
,
169 int evidx __maybe_unused
,
170 struct hist_browser_timer
*hbt
177 extern const char *disassembler_style
;
179 #endif /* __PERF_ANNOTATE_H */