perf annotate: Add missing jump variants
[deliverable/linux.git] / tools / perf / util / annotate.h
CommitLineData
78f7defe
ACM
1#ifndef __PERF_ANNOTATE_H
2#define __PERF_ANNOTATE_H
3
4#include <stdbool.h>
5#include "types.h"
6#include "symbol.h"
7#include <linux/list.h>
8#include <linux/rbtree.h>
9
28548d78
ACM
10struct ins;
11
4f9d0325
ACM
12struct ins_ops {
13 int (*parse_target)(const char *operands, u64 *target);
28548d78
ACM
14 int (*scnprintf)(struct ins *ins, char *bf, size_t size,
15 const char *operands, u64 target);
4f9d0325
ACM
16};
17
18struct ins {
19 const char *name;
20 struct ins_ops *ops;
21};
22
23bool ins__is_jump(const struct ins *ins);
d86b0597 24bool ins__is_call(const struct ins *ins);
4f9d0325 25
29ed6e76 26struct disasm_line {
78f7defe
ACM
27 struct list_head node;
28 s64 offset;
4f9d0325 29 u64 target;
78f7defe 30 char *line;
5145418b 31 char *name;
4f9d0325 32 struct ins *ins;
5145418b 33 char *operands;
78f7defe
ACM
34};
35
29ed6e76
ACM
36void disasm_line__free(struct disasm_line *dl);
37struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos);
5145418b 38size_t disasm__fprintf(struct list_head *head, FILE *fp);
78f7defe
ACM
39
40struct sym_hist {
41 u64 sum;
42 u64 addr[0];
43};
44
45struct source_line {
46 struct rb_node node;
47 double percent;
48 char *path;
49};
50
ce6f4fab 51/** struct annotated_source - symbols with hits have this attached as in sannotation
2f525d01
ACM
52 *
53 * @histogram: Array of addr hit histograms per event being monitored
ce6f4fab 54 * @lines: If 'print_lines' is specified, per source code line percentages
29ed6e76 55 * @source: source parsed from a disassembler like objdump -dS
2f525d01 56 *
ce6f4fab 57 * lines is allocated, percentages calculated and all sorted by percentage
2f525d01
ACM
58 * when the annotation is about to be presented, so the percentages are for
59 * one of the entries in the histogram array, i.e. for the event/counter being
60 * presented. It is deallocated right after symbol__{tui,tty,etc}_annotate
61 * returns.
62 */
ce6f4fab
ACM
63struct annotated_source {
64 struct list_head source;
65 struct source_line *lines;
36532461 66 int nr_histograms;
2f525d01 67 int sizeof_sym_hist;
ce6f4fab
ACM
68 struct sym_hist histograms[0];
69};
70
71struct annotation {
72 pthread_mutex_t lock;
73 struct annotated_source *src;
78f7defe
ACM
74};
75
76struct sannotation {
77 struct annotation annotation;
78 struct symbol symbol;
79};
80
2f525d01
ACM
81static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx)
82{
ce6f4fab
ACM
83 return (((void *)&notes->src->histograms) +
84 (notes->src->sizeof_sym_hist * idx));
2f525d01
ACM
85}
86
78f7defe
ACM
87static inline struct annotation *symbol__annotation(struct symbol *sym)
88{
89 struct sannotation *a = container_of(sym, struct sannotation, symbol);
90 return &a->annotation;
91}
92
2f525d01
ACM
93int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
94 int evidx, u64 addr);
d04b35f8 95int symbol__alloc_hist(struct symbol *sym);
36532461 96void symbol__annotate_zero_histograms(struct symbol *sym);
78f7defe 97
ce6f4fab
ACM
98int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize);
99int symbol__annotate_init(struct map *map __used, struct symbol *sym);
100int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
d5e3d747
ACM
101 bool full_paths, int min_pcnt, int max_lines,
102 int context);
36532461 103void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);
ce6f4fab 104void symbol__annotate_decay_histogram(struct symbol *sym, int evidx);
29ed6e76 105void disasm__purge(struct list_head *head);
78f7defe 106
2f525d01 107int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
d040bd36
ACM
108 bool print_lines, bool full_paths, int min_pcnt,
109 int max_lines);
78f7defe
ACM
110
111#ifdef NO_NEWT_SUPPORT
a2221796 112static inline int symbol__tui_annotate(struct symbol *sym __used,
c97cf422 113 struct map *map __used,
81cce8de
ACM
114 int evidx __used,
115 void(*timer)(void *arg) __used,
116 void *arg __used, int delay_secs __used)
78f7defe
ACM
117{
118 return 0;
119}
120#else
c97cf422 121int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
d04b35f8 122 void(*timer)(void *arg), void *arg, int delay_secs);
78f7defe
ACM
123#endif
124
f69b64f7
AK
125extern const char *disassembler_style;
126
78f7defe 127#endif /* __PERF_ANNOTATE_H */
This page took 0.074236 seconds and 5 git commands to generate.