diff options
author | Feng Tang <feng.tang@intel.com> | 2012-10-31 12:00:55 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-31 14:14:19 -0400 |
commit | c77d8d7030128e61e206658815b96a6befed9d06 (patch) | |
tree | b30ae321060abc134d7a85ec21523a544f569d5a | |
parent | dc53eda5a025f3e7503219477a8aefb8842ed74b (diff) |
perf browser: Don't show scripts menu for 'perf top'
As 'perf top' has no data files to run scripts against. Also add a
is_report_browser() helper function to judge whether the running browser
is for 'perf report'.
Signed-off-by: Feng Tang <feng.tang@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1351699257-5102-1-git-send-email-feng.tang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index fe622845872..082078ae9a6 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1127,6 +1127,12 @@ static inline void free_popup_options(char **options, int n) | |||
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | /* Check whether the browser is for 'top' or 'report' */ | ||
1131 | static inline bool is_report_browser(void *timer) | ||
1132 | { | ||
1133 | return timer == NULL; | ||
1134 | } | ||
1135 | |||
1130 | static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | 1136 | static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, |
1131 | const char *helpline, const char *ev_name, | 1137 | const char *helpline, const char *ev_name, |
1132 | bool left_exits, | 1138 | bool left_exits, |
@@ -1214,7 +1220,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1214 | } | 1220 | } |
1215 | continue; | 1221 | continue; |
1216 | case 'r': | 1222 | case 'r': |
1217 | goto do_scripts; | 1223 | if (is_report_browser(timer)) |
1224 | goto do_scripts; | ||
1225 | continue; | ||
1218 | case K_F1: | 1226 | case K_F1: |
1219 | case 'h': | 1227 | case 'h': |
1220 | case '?': | 1228 | case '?': |
@@ -1233,7 +1241,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1233 | "E Expand all callchains\n" | 1241 | "E Expand all callchains\n" |
1234 | "d Zoom into current DSO\n" | 1242 | "d Zoom into current DSO\n" |
1235 | "t Zoom into current Thread\n" | 1243 | "t Zoom into current Thread\n" |
1236 | "r Run available scripts\n" | 1244 | "r Run available scripts('perf report' only)\n" |
1237 | "P Print histograms to perf.hist.N\n" | 1245 | "P Print histograms to perf.hist.N\n" |
1238 | "V Verbose (DSO names in callchains, etc)\n" | 1246 | "V Verbose (DSO names in callchains, etc)\n" |
1239 | "/ Filter symbol by name"); | 1247 | "/ Filter symbol by name"); |