perf annotate: Move annotate functions to util/
[GitHub/mt8127/android_kernel_alcatel_ttab.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
10struct objdump_line {
11 struct list_head node;
12 s64 offset;
13 char *line;
14};
15
16void objdump_line__free(struct objdump_line *self);
17struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
18 struct objdump_line *pos);
19
20struct sym_hist {
21 u64 sum;
22 u64 addr[0];
23};
24
25struct source_line {
26 struct rb_node node;
27 double percent;
28 char *path;
29};
30
31struct annotation {
32 struct sym_hist *histogram;
33 struct source_line *src_line;
34};
35
36struct sannotation {
37 struct annotation annotation;
38 struct symbol symbol;
39};
40
41static inline struct annotation *symbol__annotation(struct symbol *sym)
42{
43 struct sannotation *a = container_of(sym, struct sannotation, symbol);
44 return &a->annotation;
45}
46
47int symbol__inc_addr_samples(struct symbol *sym, struct map *map, u64 addr);
48
49int symbol__annotate(struct symbol *sym, struct map *map,
50 struct list_head *head, size_t privsize);
51
52int symbol__tty_annotate(struct symbol *sym, struct map *map,
53 bool print_lines, bool full_paths);
54
55#ifdef NO_NEWT_SUPPORT
56static inline int symbol__tui_annotate(symbol *sym __used,
57 struct map *map __used)
58{
59 return 0;
60}
61#else
62int symbol__tui_annotate(struct symbol *sym, struct map *map);
63#endif
64
65#endif /* __PERF_ANNOTATE_H */