diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-02-04 10:43:24 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-02-05 09:28:48 -0500 |
commit | 2f525d0148ef2734c8a172201e5e1e9167a8a5fd (patch) | |
tree | 6bd0efbdeb640fa52616b20f03aed7176eb6c297 /tools/perf/util/annotate.h | |
parent | 78f7defedbb4da73b9a07635c357c1afcaa55c8f (diff) |
perf annotate: Support multiple histograms in annotation
The perf annotate tool continues aggregating everything on just one
histograms, but to support the top model add support for one histogram
perf evsel in the evlist.
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.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 6e2fbc205299..0a5069ca6dd7 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -28,9 +28,21 @@ struct source_line { | |||
28 | char *path; | 28 | char *path; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | /** struct annotation - symbols with hits have this attached as in sannotation | ||
32 | * | ||
33 | * @histogram: Array of addr hit histograms per event being monitored | ||
34 | * @src_line: If 'print_lines' is specified, per source code line percentages | ||
35 | * | ||
36 | * src_line is allocated, percentages calculated and all sorted by percentage | ||
37 | * when the annotation is about to be presented, so the percentages are for | ||
38 | * one of the entries in the histogram array, i.e. for the event/counter being | ||
39 | * presented. It is deallocated right after symbol__{tui,tty,etc}_annotate | ||
40 | * returns. | ||
41 | */ | ||
31 | struct annotation { | 42 | struct annotation { |
32 | struct sym_hist *histogram; | ||
33 | struct source_line *src_line; | 43 | struct source_line *src_line; |
44 | struct sym_hist *histograms; | ||
45 | int sizeof_sym_hist; | ||
34 | }; | 46 | }; |
35 | 47 | ||
36 | struct sannotation { | 48 | struct sannotation { |
@@ -38,28 +50,35 @@ struct sannotation { | |||
38 | struct symbol symbol; | 50 | struct symbol symbol; |
39 | }; | 51 | }; |
40 | 52 | ||
53 | static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx) | ||
54 | { | ||
55 | return ((void *)notes->histograms) + (notes->sizeof_sym_hist * idx); | ||
56 | } | ||
57 | |||
41 | static inline struct annotation *symbol__annotation(struct symbol *sym) | 58 | static inline struct annotation *symbol__annotation(struct symbol *sym) |
42 | { | 59 | { |
43 | struct sannotation *a = container_of(sym, struct sannotation, symbol); | 60 | struct sannotation *a = container_of(sym, struct sannotation, symbol); |
44 | return &a->annotation; | 61 | return &a->annotation; |
45 | } | 62 | } |
46 | 63 | ||
47 | int symbol__inc_addr_samples(struct symbol *sym, struct map *map, u64 addr); | 64 | int symbol__inc_addr_samples(struct symbol *sym, struct map *map, |
65 | int evidx, u64 addr); | ||
66 | int symbol__alloc_hist(struct symbol *sym, int nevents); | ||
48 | 67 | ||
49 | int symbol__annotate(struct symbol *sym, struct map *map, | 68 | int symbol__annotate(struct symbol *sym, struct map *map, |
50 | struct list_head *head, size_t privsize); | 69 | struct list_head *head, size_t privsize); |
51 | 70 | ||
52 | int symbol__tty_annotate(struct symbol *sym, struct map *map, | 71 | int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, |
53 | bool print_lines, bool full_paths); | 72 | bool print_lines, bool full_paths); |
54 | 73 | ||
55 | #ifdef NO_NEWT_SUPPORT | 74 | #ifdef NO_NEWT_SUPPORT |
56 | static inline int symbol__tui_annotate(symbol *sym __used, | 75 | static inline int symbol__tui_annotate(symbol *sym __used, |
57 | struct map *map __used) | 76 | struct map *map __used, int evidx __used) |
58 | { | 77 | { |
59 | return 0; | 78 | return 0; |
60 | } | 79 | } |
61 | #else | 80 | #else |
62 | int symbol__tui_annotate(struct symbol *sym, struct map *map); | 81 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx); |
63 | #endif | 82 | #endif |
64 | 83 | ||
65 | #endif /* __PERF_ANNOTATE_H */ | 84 | #endif /* __PERF_ANNOTATE_H */ |