aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-04-02 15:18:45 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-04-03 14:23:11 -0400
commit6920e2854e9a16226ca57199d48fd6b68819f6d5 (patch)
treecf219506536b00c38086e2b83225ff8e3c3db898 /tools
parentb213eac245aa2d29a3b9dd90f3b96ab182337ee8 (diff)
perf annotate browser: Show extra title line with event information
So at the top we'll have two lines, like this, from 'perf report': # perf report --group --ignore-vmlinux ===================================================================================================== Samples: 46 of events 'cycles', 4000 Hz, Event count (approx.): 5154895 _raw_spin_lock_irqsave /proc/kcore Percent │ nop │ push %rbx 0.00 14.29 0.00 │ pushfq 9.09 0.00 0.00 │ pop %rax 9.09 0.00 20.00 │ nop │ mov %rax,%rbx │ cli 4.55 7.14 0.00 │ nop │ xor %eax,%eax │ mov $0x1,%edx │ lock cmpxchg %edx,(%rdi) 77.27 78.57 70.00 │ test %eax,%eax │ ↓ jne 2b │ mov %rbx,%rax 0.00 0.00 10.00 │ pop %rbx │ ← retq │2b: mov %eax,%esi │ → callq queued_spin_lock_slowpath │ mov %rbx,%rax │ pop %rbx Press 'h' for help on│key bindings ===================================================================================================== 9.09 + 9.09 + 4.55 + 77.27 = 100 14.29 + 7.14 + 78.57 = 100 20 + 70 + 10 = 100 We can do the math by using 't' to toggle from 'percent' to nr ===================================================================================================== Samples: 46 of events 'cycles', 4000 Hz, Event count (approx.): 5154895 _raw_spin_lock_irqsave /proc/kcore Period │ nop │ push %rbx 0 79273 0 │ pushfq 190455 0 0 │ pop %rax 198038 0 3045 │ nop │ mov %rax,%rbx │ cli 217233 32562 0 │ nop │ xor %eax,%eax │ mov $0x1,%edx │ lock cmpxchg %edx,(%rdi) 3421649 979174 28273 │ test %eax,%eax │ ↓ jne 2b │ mov %rbx,%rax 0 0 5193 │ pop %rbx │ ← retq │2b: mov %eax,%esi │ → callq queued_spin_lock_slowpath │ mov %rbx,%rax │ pop %rbx Press 'h' for help on│key bindings ===================================================================================================== 79273 + 190455 + 198038 + 3045 + 217233 + 32562 + 3421649 + 979174 + 28273 + 5193 = 5154895 Or number of samples: ===================================================================================================== ooSamples: 46 of events 'cycles', 4000 Hz, Event count (approx.): 5154895 _raw_spin_lock_irqsave /proc/kcore Samples │ nop │ push %rbx 0 2 0 │ pushfq 2 0 0 │ pop %rax 2 0 2 │ nop │ mov %rax,%rbx │ cli 1 1 0 │ nop │ xor %eax,%eax │ mov $0x1,%edx │ lock cmpxchg %edx,(%rdi) 17 11 7 │ test %eax,%eax │ ↓ jne 2b │ mov %rbx,%rax 0 0 1 │ pop %rbx │ ← retq │2b: mov %eax,%esi │ → callq queued_spin_lock_slowpath │ mov %rbx,%rax │ pop %rbx Press 'h' for help on key bindings ===================================================================================================== 2 + 2 + 2 + 2 + 1 + 1 + 17 + 11 + 7 + 1 = 46 Suggested-by: Martin Liška <mliska@suse.cz> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196935 Link: https://lkml.kernel.org/n/tip-ezccyxld50wtwyt66np6aomo@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/ui/browsers/annotate.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index c02fb437ac8e..78bcd220f1b6 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -592,21 +592,40 @@ bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,
592 return __annotate_browser__search_reverse(browser); 592 return __annotate_browser__search_reverse(browser);
593} 593}
594 594
595static int annotate_browser__show(struct ui_browser *browser, char *title, const char *help)
596{
597 struct map_symbol *ms = browser->priv;
598 struct symbol *sym = ms->sym;
599 char symbol_dso[SYM_TITLE_MAX_SIZE];
600
601 if (ui_browser__show(browser, title, help) < 0)
602 return -1;
603
604 sym_title(sym, ms->map, symbol_dso, sizeof(symbol_dso));
605
606 ui_browser__gotorc_title(browser, 0, 0);
607 ui_browser__set_color(browser, HE_COLORSET_ROOT);
608 ui_browser__write_nstring(browser, symbol_dso, browser->width + 1);
609 return 0;
610}
611
595static int annotate_browser__run(struct annotate_browser *browser, 612static int annotate_browser__run(struct annotate_browser *browser,
596 struct perf_evsel *evsel, 613 struct perf_evsel *evsel,
597 struct hist_browser_timer *hbt) 614 struct hist_browser_timer *hbt)
598{ 615{
599 struct rb_node *nd = NULL; 616 struct rb_node *nd = NULL;
617 struct hists *hists = evsel__hists(evsel);
600 struct map_symbol *ms = browser->b.priv; 618 struct map_symbol *ms = browser->b.priv;
601 struct symbol *sym = ms->sym; 619 struct symbol *sym = ms->sym;
602 struct annotation *notes = symbol__annotation(ms->sym); 620 struct annotation *notes = symbol__annotation(ms->sym);
603 const char *help = "Press 'h' for help on key bindings"; 621 const char *help = "Press 'h' for help on key bindings";
604 int delay_secs = hbt ? hbt->refresh : 0; 622 int delay_secs = hbt ? hbt->refresh : 0;
623 char title[256];
605 int key; 624 int key;
606 char title[SYM_TITLE_MAX_SIZE];
607 625
608 sym_title(sym, ms->map, title, sizeof(title)); 626 annotation__scnprintf_samples_period(notes, title, sizeof(title), evsel);
609 if (ui_browser__show(&browser->b, title, help) < 0) 627
628 if (annotate_browser__show(&browser->b, title, help) < 0)
610 return -1; 629 return -1;
611 630
612 annotate_browser__calc_percent(browser, evsel); 631 annotate_browser__calc_percent(browser, evsel);
@@ -637,8 +656,11 @@ static int annotate_browser__run(struct annotate_browser *browser,
637 if (hbt) 656 if (hbt)
638 hbt->timer(hbt->arg); 657 hbt->timer(hbt->arg);
639 658
640 if (delay_secs != 0) 659 if (delay_secs != 0) {
641 symbol__annotate_decay_histogram(sym, evsel->idx); 660 symbol__annotate_decay_histogram(sym, evsel->idx);
661 hists__scnprintf_title(hists, title, sizeof(title));
662 annotate_browser__show(&browser->b, title, help);
663 }
642 continue; 664 continue;
643 case K_TAB: 665 case K_TAB:
644 if (nd != NULL) { 666 if (nd != NULL) {
@@ -812,6 +834,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
812 .seek = ui_browser__list_head_seek, 834 .seek = ui_browser__list_head_seek,
813 .write = annotate_browser__write, 835 .write = annotate_browser__write,
814 .filter = disasm_line__filter, 836 .filter = disasm_line__filter,
837 .extra_title_lines = 1, /* for hists__scnprintf_title() */
815 .priv = &ms, 838 .priv = &ms,
816 .use_navkeypressed = true, 839 .use_navkeypressed = true,
817 }, 840 },