aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-08-03 12:53:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-06 10:56:54 -0400
commita7cb8863dd352f052e7b2b86a17410070d1b69af (patch)
tree5457034b0590343405fe477d0a3b02a6233e9277 /tools/perf
parent8a06bf14008fbf55a86105b8569494f4beeb8762 (diff)
perf hists browser: Add verbose mode hotkey
Right now just shows the DSO name in callchain entries, to help debug the DWARF CFI post unwind code. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-54gouunatugtfw92j6gddk45@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/ui/browsers/hists.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 413bd62eedb1..b8094692c153 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -24,6 +24,7 @@ struct hist_browser {
24 struct hist_entry *he_selection; 24 struct hist_entry *he_selection;
25 struct map_symbol *selection; 25 struct map_symbol *selection;
26 int print_seq; 26 int print_seq;
27 bool show_dso;
27 bool has_symbols; 28 bool has_symbols;
28}; 29};
29 30
@@ -376,12 +377,19 @@ out:
376} 377}
377 378
378static char *callchain_list__sym_name(struct callchain_list *cl, 379static char *callchain_list__sym_name(struct callchain_list *cl,
379 char *bf, size_t bfsize) 380 char *bf, size_t bfsize, bool show_dso)
380{ 381{
382 int printed;
383
381 if (cl->ms.sym) 384 if (cl->ms.sym)
382 return cl->ms.sym->name; 385 printed = scnprintf(bf, bfsize, "%s", cl->ms.sym->name);
386 else
387 printed = scnprintf(bf, bfsize, "%#" PRIx64, cl->ip);
388
389 if (show_dso)
390 scnprintf(bf + printed, bfsize - printed, " %s",
391 cl->ms.map ? cl->ms.map->dso->short_name : "unknown");
383 392
384 snprintf(bf, bfsize, "%#" PRIx64, cl->ip);
385 return bf; 393 return bf;
386} 394}
387 395
@@ -417,7 +425,7 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *browse
417 remaining -= cumul; 425 remaining -= cumul;
418 426
419 list_for_each_entry(chain, &child->val, list) { 427 list_for_each_entry(chain, &child->val, list) {
420 char ipstr[BITS_PER_LONG / 4 + 1], *alloc_str; 428 char bf[1024], *alloc_str;
421 const char *str; 429 const char *str;
422 int color; 430 int color;
423 bool was_first = first; 431 bool was_first = first;
@@ -434,7 +442,8 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *browse
434 } 442 }
435 443
436 alloc_str = NULL; 444 alloc_str = NULL;
437 str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); 445 str = callchain_list__sym_name(chain, bf, sizeof(bf),
446 browser->show_dso);
438 if (was_first) { 447 if (was_first) {
439 double percent = cumul * 100.0 / new_total; 448 double percent = cumul * 100.0 / new_total;
440 449
@@ -493,7 +502,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *browser,
493 char folded_sign = ' '; 502 char folded_sign = ' ';
494 503
495 list_for_each_entry(chain, &node->val, list) { 504 list_for_each_entry(chain, &node->val, list) {
496 char ipstr[BITS_PER_LONG / 4 + 1], *s; 505 char bf[1024], *s;
497 int color; 506 int color;
498 507
499 folded_sign = callchain_list__folded(chain); 508 folded_sign = callchain_list__folded(chain);
@@ -510,7 +519,8 @@ static int hist_browser__show_callchain_node(struct hist_browser *browser,
510 *is_current_entry = true; 519 *is_current_entry = true;
511 } 520 }
512 521
513 s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); 522 s = callchain_list__sym_name(chain, bf, sizeof(bf),
523 browser->show_dso);
514 ui_browser__gotorc(&browser->b, row, 0); 524 ui_browser__gotorc(&browser->b, row, 0);
515 ui_browser__set_color(&browser->b, color); 525 ui_browser__set_color(&browser->b, color);
516 slsmg_write_nstring(" ", offset); 526 slsmg_write_nstring(" ", offset);
@@ -830,7 +840,7 @@ static int hist_browser__fprintf_callchain_node_rb_tree(struct hist_browser *bro
830 remaining -= cumul; 840 remaining -= cumul;
831 841
832 list_for_each_entry(chain, &child->val, list) { 842 list_for_each_entry(chain, &child->val, list) {
833 char ipstr[BITS_PER_LONG / 4 + 1], *alloc_str; 843 char bf[1024], *alloc_str;
834 const char *str; 844 const char *str;
835 bool was_first = first; 845 bool was_first = first;
836 846
@@ -842,7 +852,8 @@ static int hist_browser__fprintf_callchain_node_rb_tree(struct hist_browser *bro
842 folded_sign = callchain_list__folded(chain); 852 folded_sign = callchain_list__folded(chain);
843 853
844 alloc_str = NULL; 854 alloc_str = NULL;
845 str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); 855 str = callchain_list__sym_name(chain, bf, sizeof(bf),
856 browser->show_dso);
846 if (was_first) { 857 if (was_first) {
847 double percent = cumul * 100.0 / new_total; 858 double percent = cumul * 100.0 / new_total;
848 859
@@ -880,10 +891,10 @@ static int hist_browser__fprintf_callchain_node(struct hist_browser *browser,
880 int printed = 0; 891 int printed = 0;
881 892
882 list_for_each_entry(chain, &node->val, list) { 893 list_for_each_entry(chain, &node->val, list) {
883 char ipstr[BITS_PER_LONG / 4 + 1], *s; 894 char bf[1024], *s;
884 895
885 folded_sign = callchain_list__folded(chain); 896 folded_sign = callchain_list__folded(chain);
886 s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); 897 s = callchain_list__sym_name(chain, bf, sizeof(bf), browser->show_dso);
887 printed += fprintf(fp, "%*s%c %s\n", offset, " ", folded_sign, s); 898 printed += fprintf(fp, "%*s%c %s\n", offset, " ", folded_sign, s);
888 } 899 }
889 900
@@ -1133,6 +1144,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
1133 continue; 1144 continue;
1134 case 'd': 1145 case 'd':
1135 goto zoom_dso; 1146 goto zoom_dso;
1147 case 'V':
1148 browser->show_dso = !browser->show_dso;
1149 continue;
1136 case 't': 1150 case 't':
1137 goto zoom_thread; 1151 goto zoom_thread;
1138 case '/': 1152 case '/':
@@ -1164,6 +1178,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
1164 "d Zoom into current DSO\n" 1178 "d Zoom into current DSO\n"
1165 "t Zoom into current Thread\n" 1179 "t Zoom into current Thread\n"
1166 "P Print histograms to perf.hist.N\n" 1180 "P Print histograms to perf.hist.N\n"
1181 "V Verbose (DSO names in callchains, etc)\n"
1167 "/ Filter symbol by name"); 1182 "/ Filter symbol by name");
1168 continue; 1183 continue;
1169 case K_ENTER: 1184 case K_ENTER: