diff options
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r-- | tools/perf/util/annotate.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index bc08b36a713..b237c8678c2 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -28,22 +28,29 @@ 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 | 31 | /** struct annotated_source - symbols with hits have this attached as in sannotation |
32 | * | 32 | * |
33 | * @histogram: Array of addr hit histograms per event being monitored | 33 | * @histogram: Array of addr hit histograms per event being monitored |
34 | * @src_line: If 'print_lines' is specified, per source code line percentages | 34 | * @lines: If 'print_lines' is specified, per source code line percentages |
35 | * @source: source parsed from objdump -dS | ||
35 | * | 36 | * |
36 | * src_line is allocated, percentages calculated and all sorted by percentage | 37 | * lines is allocated, percentages calculated and all sorted by percentage |
37 | * when the annotation is about to be presented, so the percentages are for | 38 | * 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 | * 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 | * presented. It is deallocated right after symbol__{tui,tty,etc}_annotate |
40 | * returns. | 41 | * returns. |
41 | */ | 42 | */ |
42 | struct annotation { | 43 | struct annotated_source { |
43 | struct source_line *src_line; | 44 | struct list_head source; |
44 | struct sym_hist *histograms; | 45 | struct source_line *lines; |
45 | int nr_histograms; | 46 | int nr_histograms; |
46 | int sizeof_sym_hist; | 47 | int sizeof_sym_hist; |
48 | struct sym_hist histograms[0]; | ||
49 | }; | ||
50 | |||
51 | struct annotation { | ||
52 | pthread_mutex_t lock; | ||
53 | struct annotated_source *src; | ||
47 | }; | 54 | }; |
48 | 55 | ||
49 | struct sannotation { | 56 | struct sannotation { |
@@ -53,7 +60,8 @@ struct sannotation { | |||
53 | 60 | ||
54 | static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx) | 61 | static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx) |
55 | { | 62 | { |
56 | return ((void *)notes->histograms) + (notes->sizeof_sym_hist * idx); | 63 | return (((void *)¬es->src->histograms) + |
64 | (notes->src->sizeof_sym_hist * idx)); | ||
57 | } | 65 | } |
58 | 66 | ||
59 | static inline struct annotation *symbol__annotation(struct symbol *sym) | 67 | static inline struct annotation *symbol__annotation(struct symbol *sym) |
@@ -67,14 +75,12 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
67 | int symbol__alloc_hist(struct symbol *sym, int nevents); | 75 | int symbol__alloc_hist(struct symbol *sym, int nevents); |
68 | void symbol__annotate_zero_histograms(struct symbol *sym); | 76 | void symbol__annotate_zero_histograms(struct symbol *sym); |
69 | 77 | ||
70 | int symbol__annotate(struct symbol *sym, struct map *map, | 78 | int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize); |
71 | struct list_head *head, size_t privsize); | 79 | int symbol__annotate_init(struct map *map __used, struct symbol *sym); |
72 | int symbol__annotate_printf(struct symbol *sym, struct map *map, | 80 | int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, |
73 | struct list_head *head, int evidx, bool full_paths, | 81 | bool full_paths, int min_pcnt, int max_lines); |
74 | int min_pcnt, int max_lines); | ||
75 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); | 82 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); |
76 | void symbol__annotate_decay_histogram(struct symbol *sym, | 83 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); |
77 | struct list_head *head, int evidx); | ||
78 | void objdump_line_list__purge(struct list_head *head); | 84 | void objdump_line_list__purge(struct list_head *head); |
79 | 85 | ||
80 | int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, | 86 | int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, |