Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf report: Postpone objdump check until annotation requested

David reported that current perf report refused to run on a data file
captured from a different machine because of objdump.

Since the objdump tools won't be used unless annotation was requested,
checking its presence at init time doesn't make sense.

Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Irina Tirdea <irina.tirdea@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1351835406-15208-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
68d80758 9783adf7

+25 -16
+2 -7
tools/perf/builtin-report.c
··· 428 428 if (use_browser > 0) { 429 429 if (use_browser == 1) { 430 430 perf_evlist__tui_browse_hists(session->evlist, help, 431 - NULL); 431 + NULL, 432 + &session->header.env); 432 433 } else if (use_browser == 2) { 433 434 perf_evlist__gtk_browse_hists(session->evlist, help, 434 435 NULL); ··· 672 671 673 672 has_br_stack = perf_header__has_feat(&session->header, 674 673 HEADER_BRANCH_STACK); 675 - 676 - if (!objdump_path) { 677 - ret = perf_session_env__lookup_objdump(&session->header.env); 678 - if (ret) 679 - goto error; 680 - } 681 674 682 675 if (sort__branch_mode == -1 && has_br_stack) 683 676 sort__branch_mode = 1;
+2 -1
tools/perf/builtin-top.c
··· 598 598 list_for_each_entry(pos, &top->evlist->entries, node) 599 599 pos->hists.uid_filter_str = top->target.uid_str; 600 600 601 - perf_evlist__tui_browse_hists(top->evlist, help, &hbt); 601 + perf_evlist__tui_browse_hists(top->evlist, help, &hbt, 602 + &top->session->header.env); 602 603 603 604 exit_browser(0); 604 605 exit(0);
+16 -6
tools/perf/ui/browsers/hists.c
··· 11 11 #include "../../util/pstack.h" 12 12 #include "../../util/sort.h" 13 13 #include "../../util/util.h" 14 + #include "../../arch/common.h" 14 15 15 16 #include "../browser.h" 16 17 #include "../helpline.h" ··· 1138 1137 static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, 1139 1138 const char *helpline, const char *ev_name, 1140 1139 bool left_exits, 1141 - struct hist_browser_timer *hbt) 1140 + struct hist_browser_timer *hbt, 1141 + struct perf_session_env *env) 1142 1142 { 1143 1143 struct hists *hists = &evsel->hists; 1144 1144 struct hist_browser *browser = hist_browser__new(hists); ··· 1369 1367 struct hist_entry *he; 1370 1368 int err; 1371 1369 do_annotate: 1370 + if (!objdump_path && perf_session_env__lookup_objdump(env)) 1371 + continue; 1372 + 1372 1373 he = hist_browser__selected_entry(browser); 1373 1374 if (he == NULL) 1374 1375 continue; ··· 1475 1470 struct ui_browser b; 1476 1471 struct perf_evsel *selection; 1477 1472 bool lost_events, lost_events_warned; 1473 + struct perf_session_env *env; 1478 1474 }; 1479 1475 1480 1476 static void perf_evsel_menu__write(struct ui_browser *browser, ··· 1557 1551 hbt->timer(hbt->arg); 1558 1552 ev_name = perf_evsel__name(pos); 1559 1553 key = perf_evsel__hists_browse(pos, nr_events, help, 1560 - ev_name, true, hbt); 1554 + ev_name, true, hbt, 1555 + menu->env); 1561 1556 ui_browser__show_title(&menu->b, title); 1562 1557 switch (key) { 1563 1558 case K_TAB: ··· 1606 1599 1607 1600 static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, 1608 1601 const char *help, 1609 - struct hist_browser_timer *hbt) 1602 + struct hist_browser_timer *hbt, 1603 + struct perf_session_env *env) 1610 1604 { 1611 1605 struct perf_evsel *pos; 1612 1606 struct perf_evsel_menu menu = { ··· 1619 1611 .nr_entries = evlist->nr_entries, 1620 1612 .priv = evlist, 1621 1613 }, 1614 + .env = env, 1622 1615 }; 1623 1616 1624 1617 ui_helpline__push("Press ESC to exit"); ··· 1636 1627 } 1637 1628 1638 1629 int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 1639 - struct hist_browser_timer *hbt) 1630 + struct hist_browser_timer *hbt, 1631 + struct perf_session_env *env) 1640 1632 { 1641 1633 if (evlist->nr_entries == 1) { 1642 1634 struct perf_evsel *first = list_entry(evlist->entries.next, 1643 1635 struct perf_evsel, node); 1644 1636 const char *ev_name = perf_evsel__name(first); 1645 1637 return perf_evsel__hists_browse(first, evlist->nr_entries, help, 1646 - ev_name, false, hbt); 1638 + ev_name, false, hbt, env); 1647 1639 } 1648 1640 1649 - return __perf_evlist__tui_browse_hists(evlist, help, hbt); 1641 + return __perf_evlist__tui_browse_hists(evlist, help, hbt, env); 1650 1642 }
+5 -2
tools/perf/util/hist.h
··· 4 4 #include <linux/types.h> 5 5 #include <pthread.h> 6 6 #include "callchain.h" 7 + #include "header.h" 7 8 8 9 extern struct callchain_param callchain_param; 9 10 ··· 170 169 struct hist_browser_timer *hbt); 171 170 172 171 int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 173 - struct hist_browser_timer *hbt); 172 + struct hist_browser_timer *hbt, 173 + struct perf_session_env *env); 174 174 int script_browse(const char *script_opt); 175 175 #else 176 176 static inline 177 177 int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, 178 178 const char *help __maybe_unused, 179 - struct hist_browser_timer *hbt __maybe_unused) 179 + struct hist_browser_timer *hbt __maybe_unused, 180 + struct perf_session_env *env __maybe_unused) 180 181 { 181 182 return 0; 182 183 }