diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-03-05 00:53:21 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-03-15 12:06:04 -0400 |
commit | db8fd07a541fc2d5e8076f0151286e19591465b3 (patch) | |
tree | 50b9bd5d03c7f761ff6f295bdebdf0be49729662 /tools | |
parent | acf2892270dcc4288c572b1159474c81f3819749 (diff) |
perf annotate: Pass evsel instead of evidx on annotation functions
Pass evsel instead of evidx. This is a preparation for supporting event
group view in annotation and no functional change is intended.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1362462812-30885-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-annotate.c | 16 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 30 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/gtk/annotate.c | 10 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 36 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 36 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 5 |
8 files changed, 75 insertions, 62 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 2e6961ea3184..2f015a99481b 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -109,14 +109,16 @@ static int process_sample_event(struct perf_tool *tool, | |||
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | static int hist_entry__tty_annotate(struct hist_entry *he, int evidx, | 112 | static int hist_entry__tty_annotate(struct hist_entry *he, |
113 | struct perf_evsel *evsel, | ||
113 | struct perf_annotate *ann) | 114 | struct perf_annotate *ann) |
114 | { | 115 | { |
115 | return symbol__tty_annotate(he->ms.sym, he->ms.map, evidx, | 116 | return symbol__tty_annotate(he->ms.sym, he->ms.map, evsel, |
116 | ann->print_line, ann->full_paths, 0, 0); | 117 | ann->print_line, ann->full_paths, 0, 0); |
117 | } | 118 | } |
118 | 119 | ||
119 | static void hists__find_annotations(struct hists *self, int evidx, | 120 | static void hists__find_annotations(struct hists *self, |
121 | struct perf_evsel *evsel, | ||
120 | struct perf_annotate *ann) | 122 | struct perf_annotate *ann) |
121 | { | 123 | { |
122 | struct rb_node *nd = rb_first(&self->entries), *next; | 124 | struct rb_node *nd = rb_first(&self->entries), *next; |
@@ -142,14 +144,14 @@ find_next: | |||
142 | if (use_browser == 2) { | 144 | if (use_browser == 2) { |
143 | int ret; | 145 | int ret; |
144 | 146 | ||
145 | ret = hist_entry__gtk_annotate(he, evidx, NULL); | 147 | ret = hist_entry__gtk_annotate(he, evsel, NULL); |
146 | if (!ret || !ann->skip_missing) | 148 | if (!ret || !ann->skip_missing) |
147 | return; | 149 | return; |
148 | 150 | ||
149 | /* skip missing symbols */ | 151 | /* skip missing symbols */ |
150 | nd = rb_next(nd); | 152 | nd = rb_next(nd); |
151 | } else if (use_browser == 1) { | 153 | } else if (use_browser == 1) { |
152 | key = hist_entry__tui_annotate(he, evidx, NULL); | 154 | key = hist_entry__tui_annotate(he, evsel, NULL); |
153 | switch (key) { | 155 | switch (key) { |
154 | case -1: | 156 | case -1: |
155 | if (!ann->skip_missing) | 157 | if (!ann->skip_missing) |
@@ -168,7 +170,7 @@ find_next: | |||
168 | if (next != NULL) | 170 | if (next != NULL) |
169 | nd = next; | 171 | nd = next; |
170 | } else { | 172 | } else { |
171 | hist_entry__tty_annotate(he, evidx, ann); | 173 | hist_entry__tty_annotate(he, evsel, ann); |
172 | nd = rb_next(nd); | 174 | nd = rb_next(nd); |
173 | /* | 175 | /* |
174 | * Since we have a hist_entry per IP for the same | 176 | * Since we have a hist_entry per IP for the same |
@@ -230,7 +232,7 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
230 | total_nr_samples += nr_samples; | 232 | total_nr_samples += nr_samples; |
231 | hists__collapse_resort(hists); | 233 | hists__collapse_resort(hists); |
232 | hists__output_resort(hists); | 234 | hists__output_resort(hists); |
233 | hists__find_annotations(hists, pos->idx, ann); | 235 | hists__find_annotations(hists, pos, ann); |
234 | } | 236 | } |
235 | } | 237 | } |
236 | 238 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c5601aa7a870..b5520ad0dbb8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -231,7 +231,7 @@ static void perf_top__show_details(struct perf_top *top) | |||
231 | printf("Showing %s for %s\n", perf_evsel__name(top->sym_evsel), symbol->name); | 231 | printf("Showing %s for %s\n", perf_evsel__name(top->sym_evsel), symbol->name); |
232 | printf(" Events Pcnt (>=%d%%)\n", top->sym_pcnt_filter); | 232 | printf(" Events Pcnt (>=%d%%)\n", top->sym_pcnt_filter); |
233 | 233 | ||
234 | more = symbol__annotate_printf(symbol, he->ms.map, top->sym_evsel->idx, | 234 | more = symbol__annotate_printf(symbol, he->ms.map, top->sym_evsel, |
235 | 0, top->sym_pcnt_filter, top->print_entries, 4); | 235 | 0, top->sym_pcnt_filter, top->print_entries, 4); |
236 | if (top->zero) | 236 | if (top->zero) |
237 | symbol__annotate_zero_histogram(symbol, top->sym_evsel->idx); | 237 | symbol__annotate_zero_histogram(symbol, top->sym_evsel->idx); |
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 7dca1555c610..67798472384b 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "../../util/hist.h" | 8 | #include "../../util/hist.h" |
9 | #include "../../util/sort.h" | 9 | #include "../../util/sort.h" |
10 | #include "../../util/symbol.h" | 10 | #include "../../util/symbol.h" |
11 | #include "../../util/evsel.h" | ||
11 | #include <pthread.h> | 12 | #include <pthread.h> |
12 | #include <newt.h> | 13 | #include <newt.h> |
13 | 14 | ||
@@ -331,7 +332,7 @@ static void annotate_browser__set_rb_top(struct annotate_browser *browser, | |||
331 | } | 332 | } |
332 | 333 | ||
333 | static void annotate_browser__calc_percent(struct annotate_browser *browser, | 334 | static void annotate_browser__calc_percent(struct annotate_browser *browser, |
334 | int evidx) | 335 | struct perf_evsel *evsel) |
335 | { | 336 | { |
336 | struct map_symbol *ms = browser->b.priv; | 337 | struct map_symbol *ms = browser->b.priv; |
337 | struct symbol *sym = ms->sym; | 338 | struct symbol *sym = ms->sym; |
@@ -344,7 +345,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, | |||
344 | 345 | ||
345 | list_for_each_entry(pos, ¬es->src->source, node) { | 346 | list_for_each_entry(pos, ¬es->src->source, node) { |
346 | struct browser_disasm_line *bpos = disasm_line__browser(pos); | 347 | struct browser_disasm_line *bpos = disasm_line__browser(pos); |
347 | bpos->percent = disasm_line__calc_percent(pos, sym, evidx); | 348 | bpos->percent = disasm_line__calc_percent(pos, sym, evsel->idx); |
348 | if (bpos->percent < 0.01) { | 349 | if (bpos->percent < 0.01) { |
349 | RB_CLEAR_NODE(&bpos->rb_node); | 350 | RB_CLEAR_NODE(&bpos->rb_node); |
350 | continue; | 351 | continue; |
@@ -401,7 +402,8 @@ static void annotate_browser__init_asm_mode(struct annotate_browser *browser) | |||
401 | browser->b.nr_entries = browser->nr_asm_entries; | 402 | browser->b.nr_entries = browser->nr_asm_entries; |
402 | } | 403 | } |
403 | 404 | ||
404 | static bool annotate_browser__callq(struct annotate_browser *browser, int evidx, | 405 | static bool annotate_browser__callq(struct annotate_browser *browser, |
406 | struct perf_evsel *evsel, | ||
405 | struct hist_browser_timer *hbt) | 407 | struct hist_browser_timer *hbt) |
406 | { | 408 | { |
407 | struct map_symbol *ms = browser->b.priv; | 409 | struct map_symbol *ms = browser->b.priv; |
@@ -432,7 +434,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser, int evidx, | |||
432 | } | 434 | } |
433 | 435 | ||
434 | pthread_mutex_unlock(¬es->lock); | 436 | pthread_mutex_unlock(¬es->lock); |
435 | symbol__tui_annotate(target, ms->map, evidx, hbt); | 437 | symbol__tui_annotate(target, ms->map, evsel, hbt); |
436 | ui_browser__show_title(&browser->b, sym->name); | 438 | ui_browser__show_title(&browser->b, sym->name); |
437 | return true; | 439 | return true; |
438 | } | 440 | } |
@@ -615,7 +617,8 @@ static void annotate_browser__update_addr_width(struct annotate_browser *browser | |||
615 | browser->addr_width += browser->jumps_width + 1; | 617 | browser->addr_width += browser->jumps_width + 1; |
616 | } | 618 | } |
617 | 619 | ||
618 | static int annotate_browser__run(struct annotate_browser *browser, int evidx, | 620 | static int annotate_browser__run(struct annotate_browser *browser, |
621 | struct perf_evsel *evsel, | ||
619 | struct hist_browser_timer *hbt) | 622 | struct hist_browser_timer *hbt) |
620 | { | 623 | { |
621 | struct rb_node *nd = NULL; | 624 | struct rb_node *nd = NULL; |
@@ -628,7 +631,7 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx, | |||
628 | if (ui_browser__show(&browser->b, sym->name, help) < 0) | 631 | if (ui_browser__show(&browser->b, sym->name, help) < 0) |
629 | return -1; | 632 | return -1; |
630 | 633 | ||
631 | annotate_browser__calc_percent(browser, evidx); | 634 | annotate_browser__calc_percent(browser, evsel); |
632 | 635 | ||
633 | if (browser->curr_hot) { | 636 | if (browser->curr_hot) { |
634 | annotate_browser__set_rb_top(browser, browser->curr_hot); | 637 | annotate_browser__set_rb_top(browser, browser->curr_hot); |
@@ -641,7 +644,7 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx, | |||
641 | key = ui_browser__run(&browser->b, delay_secs); | 644 | key = ui_browser__run(&browser->b, delay_secs); |
642 | 645 | ||
643 | if (delay_secs != 0) { | 646 | if (delay_secs != 0) { |
644 | annotate_browser__calc_percent(browser, evidx); | 647 | annotate_browser__calc_percent(browser, evsel); |
645 | /* | 648 | /* |
646 | * Current line focus got out of the list of most active | 649 | * Current line focus got out of the list of most active |
647 | * lines, NULL it so that if TAB|UNTAB is pressed, we | 650 | * lines, NULL it so that if TAB|UNTAB is pressed, we |
@@ -657,7 +660,7 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx, | |||
657 | hbt->timer(hbt->arg); | 660 | hbt->timer(hbt->arg); |
658 | 661 | ||
659 | if (delay_secs != 0) | 662 | if (delay_secs != 0) |
660 | symbol__annotate_decay_histogram(sym, evidx); | 663 | symbol__annotate_decay_histogram(sym, evsel->idx); |
661 | continue; | 664 | continue; |
662 | case K_TAB: | 665 | case K_TAB: |
663 | if (nd != NULL) { | 666 | if (nd != NULL) { |
@@ -754,7 +757,7 @@ show_help: | |||
754 | goto show_sup_ins; | 757 | goto show_sup_ins; |
755 | goto out; | 758 | goto out; |
756 | } else if (!(annotate_browser__jump(browser) || | 759 | } else if (!(annotate_browser__jump(browser) || |
757 | annotate_browser__callq(browser, evidx, hbt))) { | 760 | annotate_browser__callq(browser, evsel, hbt))) { |
758 | show_sup_ins: | 761 | show_sup_ins: |
759 | ui_helpline__puts("Actions are only available for 'callq', 'retq' & jump instructions."); | 762 | ui_helpline__puts("Actions are only available for 'callq', 'retq' & jump instructions."); |
760 | } | 763 | } |
@@ -776,10 +779,10 @@ out: | |||
776 | return key; | 779 | return key; |
777 | } | 780 | } |
778 | 781 | ||
779 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | 782 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, |
780 | struct hist_browser_timer *hbt) | 783 | struct hist_browser_timer *hbt) |
781 | { | 784 | { |
782 | return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx, hbt); | 785 | return symbol__tui_annotate(he->ms.sym, he->ms.map, evsel, hbt); |
783 | } | 786 | } |
784 | 787 | ||
785 | static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, | 788 | static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, |
@@ -826,7 +829,8 @@ static inline int width_jumps(int n) | |||
826 | return 1; | 829 | return 1; |
827 | } | 830 | } |
828 | 831 | ||
829 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | 832 | int symbol__tui_annotate(struct symbol *sym, struct map *map, |
833 | struct perf_evsel *evsel, | ||
830 | struct hist_browser_timer *hbt) | 834 | struct hist_browser_timer *hbt) |
831 | { | 835 | { |
832 | struct disasm_line *pos, *n; | 836 | struct disasm_line *pos, *n; |
@@ -909,7 +913,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
909 | 913 | ||
910 | annotate_browser__update_addr_width(&browser); | 914 | annotate_browser__update_addr_width(&browser); |
911 | 915 | ||
912 | ret = annotate_browser__run(&browser, evidx, hbt); | 916 | ret = annotate_browser__run(&browser, evsel, hbt); |
913 | list_for_each_entry_safe(pos, n, ¬es->src->source, node) { | 917 | list_for_each_entry_safe(pos, n, ¬es->src->source, node) { |
914 | list_del(&pos->node); | 918 | list_del(&pos->node); |
915 | disasm_line__free(pos); | 919 | disasm_line__free(pos); |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index aa22704047d6..0e125e1543dc 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1599,7 +1599,7 @@ do_annotate: | |||
1599 | * Don't let this be freed, say, by hists__decay_entry. | 1599 | * Don't let this be freed, say, by hists__decay_entry. |
1600 | */ | 1600 | */ |
1601 | he->used = true; | 1601 | he->used = true; |
1602 | err = hist_entry__tui_annotate(he, evsel->idx, hbt); | 1602 | err = hist_entry__tui_annotate(he, evsel, hbt); |
1603 | he->used = false; | 1603 | he->used = false; |
1604 | /* | 1604 | /* |
1605 | * offer option to annotate the other branch source or target | 1605 | * offer option to annotate the other branch source or target |
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index 7d8dc581a545..6e2fc7e3f093 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "gtk.h" | 1 | #include "gtk.h" |
2 | #include "util/debug.h" | 2 | #include "util/debug.h" |
3 | #include "util/annotate.h" | 3 | #include "util/annotate.h" |
4 | #include "util/evsel.h" | ||
4 | #include "ui/helpline.h" | 5 | #include "ui/helpline.h" |
5 | 6 | ||
6 | 7 | ||
@@ -85,7 +86,7 @@ static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl) | |||
85 | } | 86 | } |
86 | 87 | ||
87 | static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | 88 | static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, |
88 | struct map *map, int evidx, | 89 | struct map *map, struct perf_evsel *evsel, |
89 | struct hist_browser_timer *hbt __maybe_unused) | 90 | struct hist_browser_timer *hbt __maybe_unused) |
90 | { | 91 | { |
91 | struct disasm_line *pos, *n; | 92 | struct disasm_line *pos, *n; |
@@ -121,7 +122,7 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | |||
121 | 122 | ||
122 | gtk_list_store_append(store, &iter); | 123 | gtk_list_store_append(store, &iter); |
123 | 124 | ||
124 | if (perf_gtk__get_percent(s, sizeof(s), sym, pos, evidx)) | 125 | if (perf_gtk__get_percent(s, sizeof(s), sym, pos, evsel->idx)) |
125 | gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1); | 126 | gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1); |
126 | if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos)) | 127 | if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos)) |
127 | gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1); | 128 | gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1); |
@@ -139,7 +140,8 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | |||
139 | return 0; | 140 | return 0; |
140 | } | 141 | } |
141 | 142 | ||
142 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | 143 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, |
144 | struct perf_evsel *evsel, | ||
143 | struct hist_browser_timer *hbt) | 145 | struct hist_browser_timer *hbt) |
144 | { | 146 | { |
145 | GtkWidget *window; | 147 | GtkWidget *window; |
@@ -206,7 +208,7 @@ int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | |||
206 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, | 208 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, |
207 | tab_label); | 209 | tab_label); |
208 | 210 | ||
209 | perf_gtk__annotate_symbol(scrolled_window, sym, map, evidx, hbt); | 211 | perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt); |
210 | return 0; | 212 | return 0; |
211 | } | 213 | } |
212 | 214 | ||
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index d33fe937e6f1..7eac5f0895ee 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "symbol.h" | 14 | #include "symbol.h" |
15 | #include "debug.h" | 15 | #include "debug.h" |
16 | #include "annotate.h" | 16 | #include "annotate.h" |
17 | #include "evsel.h" | ||
17 | #include <pthread.h> | 18 | #include <pthread.h> |
18 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
19 | 20 | ||
@@ -603,7 +604,7 @@ struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disa | |||
603 | } | 604 | } |
604 | 605 | ||
605 | static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 start, | 606 | static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 start, |
606 | int evidx, u64 len, int min_pcnt, int printed, | 607 | struct perf_evsel *evsel, u64 len, int min_pcnt, int printed, |
607 | int max_lines, struct disasm_line *queue) | 608 | int max_lines, struct disasm_line *queue) |
608 | { | 609 | { |
609 | static const char *prev_line; | 610 | static const char *prev_line; |
@@ -616,7 +617,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st | |||
616 | const char *color; | 617 | const char *color; |
617 | struct annotation *notes = symbol__annotation(sym); | 618 | struct annotation *notes = symbol__annotation(sym); |
618 | struct source_line *src_line = notes->src->lines; | 619 | struct source_line *src_line = notes->src->lines; |
619 | struct sym_hist *h = annotation__histogram(notes, evidx); | 620 | struct sym_hist *h = annotation__histogram(notes, evsel->idx); |
620 | s64 offset = dl->offset; | 621 | s64 offset = dl->offset; |
621 | const u64 addr = start + offset; | 622 | const u64 addr = start + offset; |
622 | struct disasm_line *next; | 623 | struct disasm_line *next; |
@@ -648,7 +649,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st | |||
648 | list_for_each_entry_from(queue, ¬es->src->source, node) { | 649 | list_for_each_entry_from(queue, ¬es->src->source, node) { |
649 | if (queue == dl) | 650 | if (queue == dl) |
650 | break; | 651 | break; |
651 | disasm_line__print(queue, sym, start, evidx, len, | 652 | disasm_line__print(queue, sym, start, evsel, len, |
652 | 0, 0, 1, NULL); | 653 | 0, 0, 1, NULL); |
653 | } | 654 | } |
654 | } | 655 | } |
@@ -935,7 +936,8 @@ static void symbol__free_source_line(struct symbol *sym, int len) | |||
935 | 936 | ||
936 | /* Get the filename:line for the colored entries */ | 937 | /* Get the filename:line for the colored entries */ |
937 | static int symbol__get_source_line(struct symbol *sym, struct map *map, | 938 | static int symbol__get_source_line(struct symbol *sym, struct map *map, |
938 | int evidx, struct rb_root *root, int len, | 939 | struct perf_evsel *evsel, |
940 | struct rb_root *root, int len, | ||
939 | const char *filename) | 941 | const char *filename) |
940 | { | 942 | { |
941 | u64 start; | 943 | u64 start; |
@@ -943,7 +945,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
943 | char cmd[PATH_MAX * 2]; | 945 | char cmd[PATH_MAX * 2]; |
944 | struct source_line *src_line; | 946 | struct source_line *src_line; |
945 | struct annotation *notes = symbol__annotation(sym); | 947 | struct annotation *notes = symbol__annotation(sym); |
946 | struct sym_hist *h = annotation__histogram(notes, evidx); | 948 | struct sym_hist *h = annotation__histogram(notes, evsel->idx); |
947 | struct rb_root tmp_root = RB_ROOT; | 949 | struct rb_root tmp_root = RB_ROOT; |
948 | 950 | ||
949 | if (!h->sum) | 951 | if (!h->sum) |
@@ -1018,10 +1020,10 @@ static void print_summary(struct rb_root *root, const char *filename) | |||
1018 | } | 1020 | } |
1019 | } | 1021 | } |
1020 | 1022 | ||
1021 | static void symbol__annotate_hits(struct symbol *sym, int evidx) | 1023 | static void symbol__annotate_hits(struct symbol *sym, struct perf_evsel *evsel) |
1022 | { | 1024 | { |
1023 | struct annotation *notes = symbol__annotation(sym); | 1025 | struct annotation *notes = symbol__annotation(sym); |
1024 | struct sym_hist *h = annotation__histogram(notes, evidx); | 1026 | struct sym_hist *h = annotation__histogram(notes, evsel->idx); |
1025 | u64 len = symbol__size(sym), offset; | 1027 | u64 len = symbol__size(sym), offset; |
1026 | 1028 | ||
1027 | for (offset = 0; offset < len; ++offset) | 1029 | for (offset = 0; offset < len; ++offset) |
@@ -1031,9 +1033,9 @@ static void symbol__annotate_hits(struct symbol *sym, int evidx) | |||
1031 | printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum); | 1033 | printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum); |
1032 | } | 1034 | } |
1033 | 1035 | ||
1034 | int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, | 1036 | int symbol__annotate_printf(struct symbol *sym, struct map *map, |
1035 | bool full_paths, int min_pcnt, int max_lines, | 1037 | struct perf_evsel *evsel, bool full_paths, |
1036 | int context) | 1038 | int min_pcnt, int max_lines, int context) |
1037 | { | 1039 | { |
1038 | struct dso *dso = map->dso; | 1040 | struct dso *dso = map->dso; |
1039 | char *filename; | 1041 | char *filename; |
@@ -1060,7 +1062,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, | |||
1060 | printf("------------------------------------------------\n"); | 1062 | printf("------------------------------------------------\n"); |
1061 | 1063 | ||
1062 | if (verbose) | 1064 | if (verbose) |
1063 | symbol__annotate_hits(sym, evidx); | 1065 | symbol__annotate_hits(sym, evsel); |
1064 | 1066 | ||
1065 | list_for_each_entry(pos, ¬es->src->source, node) { | 1067 | list_for_each_entry(pos, ¬es->src->source, node) { |
1066 | if (context && queue == NULL) { | 1068 | if (context && queue == NULL) { |
@@ -1068,7 +1070,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, | |||
1068 | queue_len = 0; | 1070 | queue_len = 0; |
1069 | } | 1071 | } |
1070 | 1072 | ||
1071 | switch (disasm_line__print(pos, sym, start, evidx, len, | 1073 | switch (disasm_line__print(pos, sym, start, evsel, len, |
1072 | min_pcnt, printed, max_lines, | 1074 | min_pcnt, printed, max_lines, |
1073 | queue)) { | 1075 | queue)) { |
1074 | case 0: | 1076 | case 0: |
@@ -1163,9 +1165,9 @@ size_t disasm__fprintf(struct list_head *head, FILE *fp) | |||
1163 | return printed; | 1165 | return printed; |
1164 | } | 1166 | } |
1165 | 1167 | ||
1166 | int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, | 1168 | int symbol__tty_annotate(struct symbol *sym, struct map *map, |
1167 | bool print_lines, bool full_paths, int min_pcnt, | 1169 | struct perf_evsel *evsel, bool print_lines, |
1168 | int max_lines) | 1170 | bool full_paths, int min_pcnt, int max_lines) |
1169 | { | 1171 | { |
1170 | struct dso *dso = map->dso; | 1172 | struct dso *dso = map->dso; |
1171 | const char *filename = dso->long_name; | 1173 | const char *filename = dso->long_name; |
@@ -1178,12 +1180,12 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, | |||
1178 | len = symbol__size(sym); | 1180 | len = symbol__size(sym); |
1179 | 1181 | ||
1180 | if (print_lines) { | 1182 | if (print_lines) { |
1181 | symbol__get_source_line(sym, map, evidx, &source_line, | 1183 | symbol__get_source_line(sym, map, evsel, &source_line, |
1182 | len, filename); | 1184 | len, filename); |
1183 | print_summary(&source_line, filename); | 1185 | print_summary(&source_line, filename); |
1184 | } | 1186 | } |
1185 | 1187 | ||
1186 | symbol__annotate_printf(sym, map, evidx, full_paths, | 1188 | symbol__annotate_printf(sym, map, evsel, full_paths, |
1187 | min_pcnt, max_lines, 0); | 1189 | min_pcnt, max_lines, 0); |
1188 | if (print_lines) | 1190 | if (print_lines) |
1189 | symbol__free_source_line(sym, len); | 1191 | symbol__free_source_line(sym, len); |
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index c422440fe611..376395475663 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -130,47 +130,49 @@ void symbol__annotate_zero_histograms(struct symbol *sym); | |||
130 | 130 | ||
131 | int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize); | 131 | int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize); |
132 | int symbol__annotate_init(struct map *map __maybe_unused, struct symbol *sym); | 132 | int symbol__annotate_init(struct map *map __maybe_unused, struct symbol *sym); |
133 | int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, | 133 | int symbol__annotate_printf(struct symbol *sym, struct map *map, |
134 | bool full_paths, int min_pcnt, int max_lines, | 134 | struct perf_evsel *evsel, bool full_paths, |
135 | int context); | 135 | int min_pcnt, int max_lines, int context); |
136 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); | 136 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); |
137 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); | 137 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); |
138 | void disasm__purge(struct list_head *head); | 138 | void disasm__purge(struct list_head *head); |
139 | 139 | ||
140 | int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, | 140 | int symbol__tty_annotate(struct symbol *sym, struct map *map, |
141 | bool print_lines, bool full_paths, int min_pcnt, | 141 | struct perf_evsel *evsel, bool print_lines, |
142 | int max_lines); | 142 | bool full_paths, int min_pcnt, int max_lines); |
143 | 143 | ||
144 | #ifdef NEWT_SUPPORT | 144 | #ifdef NEWT_SUPPORT |
145 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | 145 | int symbol__tui_annotate(struct symbol *sym, struct map *map, |
146 | struct perf_evsel *evsel, | ||
146 | struct hist_browser_timer *hbt); | 147 | struct hist_browser_timer *hbt); |
147 | #else | 148 | #else |
148 | static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, | 149 | static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, |
149 | struct map *map __maybe_unused, | 150 | struct map *map __maybe_unused, |
150 | int evidx __maybe_unused, | 151 | struct perf_evsel *evsel __maybe_unused, |
151 | struct hist_browser_timer *hbt | 152 | struct hist_browser_timer *hbt |
152 | __maybe_unused) | 153 | __maybe_unused) |
153 | { | 154 | { |
154 | return 0; | 155 | return 0; |
155 | } | 156 | } |
156 | #endif | 157 | #endif |
157 | 158 | ||
158 | #ifdef GTK2_SUPPORT | 159 | #ifdef GTK2_SUPPORT |
159 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | 160 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, |
161 | struct perf_evsel *evsel, | ||
160 | struct hist_browser_timer *hbt); | 162 | struct hist_browser_timer *hbt); |
161 | 163 | ||
162 | static inline int hist_entry__gtk_annotate(struct hist_entry *he, int evidx, | 164 | static inline int hist_entry__gtk_annotate(struct hist_entry *he, |
165 | struct perf_evsel *evsel, | ||
163 | struct hist_browser_timer *hbt) | 166 | struct hist_browser_timer *hbt) |
164 | { | 167 | { |
165 | return symbol__gtk_annotate(he->ms.sym, he->ms.map, evidx, hbt); | 168 | return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt); |
166 | } | 169 | } |
167 | 170 | ||
168 | void perf_gtk__show_annotations(void); | 171 | void perf_gtk__show_annotations(void); |
169 | #else | 172 | #else |
170 | static inline int hist_entry__gtk_annotate(struct hist_entry *he __maybe_unused, | 173 | static inline int hist_entry__gtk_annotate(struct hist_entry *he __maybe_unused, |
171 | int evidx __maybe_unused, | 174 | struct perf_evsel *evsel __maybe_unused, |
172 | struct hist_browser_timer *hbt | 175 | struct hist_browser_timer *hbt __maybe_unused) |
173 | __maybe_unused) | ||
174 | { | 176 | { |
175 | return 0; | 177 | return 0; |
176 | } | 178 | } |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 226a4ae2f936..848331377bdb 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -177,7 +177,7 @@ struct hist_browser_timer { | |||
177 | 177 | ||
178 | #ifdef NEWT_SUPPORT | 178 | #ifdef NEWT_SUPPORT |
179 | #include "../ui/keysyms.h" | 179 | #include "../ui/keysyms.h" |
180 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | 180 | int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, |
181 | struct hist_browser_timer *hbt); | 181 | struct hist_browser_timer *hbt); |
182 | 182 | ||
183 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | 183 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, |
@@ -196,7 +196,8 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | |||
196 | 196 | ||
197 | static inline int hist_entry__tui_annotate(struct hist_entry *self | 197 | static inline int hist_entry__tui_annotate(struct hist_entry *self |
198 | __maybe_unused, | 198 | __maybe_unused, |
199 | int evidx __maybe_unused, | 199 | struct perf_evsel *evsel |
200 | __maybe_unused, | ||
200 | struct hist_browser_timer *hbt | 201 | struct hist_browser_timer *hbt |
201 | __maybe_unused) | 202 | __maybe_unused) |
202 | { | 203 | { |