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/perf/ui | |
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/perf/ui')
-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 |
3 files changed, 24 insertions, 18 deletions
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 | ||