aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r--tools/perf/util/annotate.h29
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 */
31struct annotation { 42struct 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
36struct sannotation { 48struct sannotation {
@@ -38,28 +50,35 @@ struct sannotation {
38 struct symbol symbol; 50 struct symbol symbol;
39}; 51};
40 52
53static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx)
54{
55 return ((void *)notes->histograms) + (notes->sizeof_sym_hist * idx);
56}
57
41static inline struct annotation *symbol__annotation(struct symbol *sym) 58static 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
47int symbol__inc_addr_samples(struct symbol *sym, struct map *map, u64 addr); 64int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
65 int evidx, u64 addr);
66int symbol__alloc_hist(struct symbol *sym, int nevents);
48 67
49int symbol__annotate(struct symbol *sym, struct map *map, 68int 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
52int symbol__tty_annotate(struct symbol *sym, struct map *map, 71int 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
56static inline int symbol__tui_annotate(symbol *sym __used, 75static 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
62int symbol__tui_annotate(struct symbol *sym, struct map *map); 81int 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 */