aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2013-03-05 00:53:21 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-03-15 12:06:04 -0400
commitdb8fd07a541fc2d5e8076f0151286e19591465b3 (patch)
tree50b9bd5d03c7f761ff6f295bdebdf0be49729662 /tools/perf/ui/browsers/annotate.c
parentacf2892270dcc4288c572b1159474c81f3819749 (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/browsers/annotate.c')
-rw-r--r--tools/perf/ui/browsers/annotate.c30
1 files changed, 17 insertions, 13 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
333static void annotate_browser__calc_percent(struct annotate_browser *browser, 334static 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, &notes->src->source, node) { 346 list_for_each_entry(pos, &notes->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
404static bool annotate_browser__callq(struct annotate_browser *browser, int evidx, 405static 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(&notes->lock); 436 pthread_mutex_unlock(&notes->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
618static int annotate_browser__run(struct annotate_browser *browser, int evidx, 620static 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))) {
758show_sup_ins: 761show_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
779int hist_entry__tui_annotate(struct hist_entry *he, int evidx, 782int 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
785static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, 788static 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
829int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, 832int 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, &notes->src->source, node) { 917 list_for_each_entry_safe(pos, n, &notes->src->source, node) {
914 list_del(&pos->node); 918 list_del(&pos->node);
915 disasm_line__free(pos); 919 disasm_line__free(pos);