aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-11-02 01:50:06 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-11-05 12:03:58 -0500
commit68d807586ba83d9cb77f12c8fb7c97ea438d34ad (patch)
tree15794b3d68f8770312c4e089ff50ece2b78318bc /tools
parent9783adf777a445a1e9d0db4857a3a896a9f42d4a (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-report.c9
-rw-r--r--tools/perf/builtin-top.c3
-rw-r--r--tools/perf/ui/browsers/hists.c22
-rw-r--r--tools/perf/util/hist.h7
4 files changed, 25 insertions, 16 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 234f34d466e3..fc251005dd3d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -428,7 +428,8 @@ static int __cmd_report(struct perf_report *rep)
428 if (use_browser > 0) { 428 if (use_browser > 0) {
429 if (use_browser == 1) { 429 if (use_browser == 1) {
430 perf_evlist__tui_browse_hists(session->evlist, help, 430 perf_evlist__tui_browse_hists(session->evlist, help,
431 NULL); 431 NULL,
432 &session->header.env);
432 } else if (use_browser == 2) { 433 } else if (use_browser == 2) {
433 perf_evlist__gtk_browse_hists(session->evlist, help, 434 perf_evlist__gtk_browse_hists(session->evlist, help,
434 NULL); 435 NULL);
@@ -672,12 +673,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
672 has_br_stack = perf_header__has_feat(&session->header, 673 has_br_stack = perf_header__has_feat(&session->header,
673 HEADER_BRANCH_STACK); 674 HEADER_BRANCH_STACK);
674 675
675 if (!objdump_path) {
676 ret = perf_session_env__lookup_objdump(&session->header.env);
677 if (ret)
678 goto error;
679 }
680
681 if (sort__branch_mode == -1 && has_br_stack) 676 if (sort__branch_mode == -1 && has_br_stack)
682 sort__branch_mode = 1; 677 sort__branch_mode = 1;
683 678
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 102b43c9905d..c9ff3950cd4b 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -598,7 +598,8 @@ static void *display_thread_tui(void *arg)
598 list_for_each_entry(pos, &top->evlist->entries, node) 598 list_for_each_entry(pos, &top->evlist->entries, node)
599 pos->hists.uid_filter_str = top->target.uid_str; 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 exit_browser(0); 604 exit_browser(0);
604 exit(0); 605 exit(0);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index c7d32edb8057..ccc4bd161420 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -11,6 +11,7 @@
11#include "../../util/pstack.h" 11#include "../../util/pstack.h"
12#include "../../util/sort.h" 12#include "../../util/sort.h"
13#include "../../util/util.h" 13#include "../../util/util.h"
14#include "../../arch/common.h"
14 15
15#include "../browser.h" 16#include "../browser.h"
16#include "../helpline.h" 17#include "../helpline.h"
@@ -1137,7 +1138,8 @@ static inline bool is_report_browser(void *timer)
1137static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, 1138static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
1138 const char *helpline, const char *ev_name, 1139 const char *helpline, const char *ev_name,
1139 bool left_exits, 1140 bool left_exits,
1140 struct hist_browser_timer *hbt) 1141 struct hist_browser_timer *hbt,
1142 struct perf_session_env *env)
1141{ 1143{
1142 struct hists *hists = &evsel->hists; 1144 struct hists *hists = &evsel->hists;
1143 struct hist_browser *browser = hist_browser__new(hists); 1145 struct hist_browser *browser = hist_browser__new(hists);
@@ -1367,6 +1369,9 @@ retry_popup_menu:
1367 struct hist_entry *he; 1369 struct hist_entry *he;
1368 int err; 1370 int err;
1369do_annotate: 1371do_annotate:
1372 if (!objdump_path && perf_session_env__lookup_objdump(env))
1373 continue;
1374
1370 he = hist_browser__selected_entry(browser); 1375 he = hist_browser__selected_entry(browser);
1371 if (he == NULL) 1376 if (he == NULL)
1372 continue; 1377 continue;
@@ -1470,6 +1475,7 @@ struct perf_evsel_menu {
1470 struct ui_browser b; 1475 struct ui_browser b;
1471 struct perf_evsel *selection; 1476 struct perf_evsel *selection;
1472 bool lost_events, lost_events_warned; 1477 bool lost_events, lost_events_warned;
1478 struct perf_session_env *env;
1473}; 1479};
1474 1480
1475static void perf_evsel_menu__write(struct ui_browser *browser, 1481static void perf_evsel_menu__write(struct ui_browser *browser,
@@ -1551,7 +1557,8 @@ browse_hists:
1551 hbt->timer(hbt->arg); 1557 hbt->timer(hbt->arg);
1552 ev_name = perf_evsel__name(pos); 1558 ev_name = perf_evsel__name(pos);
1553 key = perf_evsel__hists_browse(pos, nr_events, help, 1559 key = perf_evsel__hists_browse(pos, nr_events, help,
1554 ev_name, true, hbt); 1560 ev_name, true, hbt,
1561 menu->env);
1555 ui_browser__show_title(&menu->b, title); 1562 ui_browser__show_title(&menu->b, title);
1556 switch (key) { 1563 switch (key) {
1557 case K_TAB: 1564 case K_TAB:
@@ -1599,7 +1606,8 @@ out:
1599 1606
1600static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, 1607static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
1601 const char *help, 1608 const char *help,
1602 struct hist_browser_timer *hbt) 1609 struct hist_browser_timer *hbt,
1610 struct perf_session_env *env)
1603{ 1611{
1604 struct perf_evsel *pos; 1612 struct perf_evsel *pos;
1605 struct perf_evsel_menu menu = { 1613 struct perf_evsel_menu menu = {
@@ -1611,6 +1619,7 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
1611 .nr_entries = evlist->nr_entries, 1619 .nr_entries = evlist->nr_entries,
1612 .priv = evlist, 1620 .priv = evlist,
1613 }, 1621 },
1622 .env = env,
1614 }; 1623 };
1615 1624
1616 ui_helpline__push("Press ESC to exit"); 1625 ui_helpline__push("Press ESC to exit");
@@ -1627,15 +1636,16 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
1627} 1636}
1628 1637
1629int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 1638int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
1630 struct hist_browser_timer *hbt) 1639 struct hist_browser_timer *hbt,
1640 struct perf_session_env *env)
1631{ 1641{
1632 if (evlist->nr_entries == 1) { 1642 if (evlist->nr_entries == 1) {
1633 struct perf_evsel *first = list_entry(evlist->entries.next, 1643 struct perf_evsel *first = list_entry(evlist->entries.next,
1634 struct perf_evsel, node); 1644 struct perf_evsel, node);
1635 const char *ev_name = perf_evsel__name(first); 1645 const char *ev_name = perf_evsel__name(first);
1636 return perf_evsel__hists_browse(first, evlist->nr_entries, help, 1646 return perf_evsel__hists_browse(first, evlist->nr_entries, help,
1637 ev_name, false, hbt); 1647 ev_name, false, hbt, env);
1638 } 1648 }
1639 1649
1640 return __perf_evlist__tui_browse_hists(evlist, help, hbt); 1650 return __perf_evlist__tui_browse_hists(evlist, help, hbt, env);
1641} 1651}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 96664cce7c7b..a4f45dd04697 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <pthread.h> 5#include <pthread.h>
6#include "callchain.h" 6#include "callchain.h"
7#include "header.h"
7 8
8extern struct callchain_param callchain_param; 9extern struct callchain_param callchain_param;
9 10
@@ -169,13 +170,15 @@ int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
169 struct hist_browser_timer *hbt); 170 struct hist_browser_timer *hbt);
170 171
171int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 172int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
172 struct hist_browser_timer *hbt); 173 struct hist_browser_timer *hbt,
174 struct perf_session_env *env);
173int script_browse(const char *script_opt); 175int script_browse(const char *script_opt);
174#else 176#else
175static inline 177static inline
176int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, 178int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
177 const char *help __maybe_unused, 179 const char *help __maybe_unused,
178 struct hist_browser_timer *hbt __maybe_unused) 180 struct hist_browser_timer *hbt __maybe_unused,
181 struct perf_session_env *env __maybe_unused)
179{ 182{
180 return 0; 183 return 0;
181} 184}