aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-02-04 06:45:46 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-02-05 09:28:21 -0500
commit78f7defedbb4da73b9a07635c357c1afcaa55c8f (patch)
treea4ddcb93682e17e986272b626ce94eb0ed35f8b7 /tools/perf/util/annotate.h
parent764328d3209dd81b02a55722556b07b6f35e3ca0 (diff)
perf annotate: Move annotate functions to util/
They will be used by perf top, so that we have just one set of routines to do annotation. Rename "struct sym_priv" to "struct annotation", etc, to clarify this code a bit. Rename "struct sym_ext" to "struct source_line", to give it a meaningful name, that clarifies that it is a the result of an addr2line call, that is sorted by percentage one particular source code line appeared in the annotation. And since we're moving things around also rename 'sym_hist->ip' to 'sym_hist->addr' as we want to do data structure annotation at some point. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r--tools/perf/util/annotate.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
new file mode 100644
index 000000000000..6e2fbc205299
--- /dev/null
+++ b/tools/perf/util/annotate.h
@@ -0,0 +1,65 @@
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 */