Commit 599a2f38 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf hists browser: Check sort keys before hot key actions

The context menu in TUI hists browser checks corresponding sort keys
when creating the menu item.  But hotkey actions lacks these checks so
it can filter using incorrect info.

For example, default sort key of 'perf top' doesn't contain 'comm' or
'pid' sort key so each hist entry's thread info is not reliable.  Thus
it should prohibit using thread filter on 't' key.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1457533253-21419-3-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6962ccb3
...@@ -2322,6 +2322,9 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act) ...@@ -2322,6 +2322,9 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
{ {
struct thread *thread = act->thread; struct thread *thread = act->thread;
if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
return 0;
if (browser->hists->thread_filter) { if (browser->hists->thread_filter) {
pstack__remove(browser->pstack, &browser->hists->thread_filter); pstack__remove(browser->pstack, &browser->hists->thread_filter);
perf_hpp__set_elide(HISTC_THREAD, false); perf_hpp__set_elide(HISTC_THREAD, false);
...@@ -2379,6 +2382,9 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act) ...@@ -2379,6 +2382,9 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
{ {
struct map *map = act->ms.map; struct map *map = act->ms.map;
if (!sort__has_dso || map == NULL)
return 0;
if (browser->hists->dso_filter) { if (browser->hists->dso_filter) {
pstack__remove(browser->pstack, &browser->hists->dso_filter); pstack__remove(browser->pstack, &browser->hists->dso_filter);
perf_hpp__set_elide(HISTC_DSO, false); perf_hpp__set_elide(HISTC_DSO, false);
...@@ -2530,6 +2536,9 @@ add_exit_opt(struct hist_browser *browser __maybe_unused, ...@@ -2530,6 +2536,9 @@ add_exit_opt(struct hist_browser *browser __maybe_unused,
static int static int
do_zoom_socket(struct hist_browser *browser, struct popup_action *act) do_zoom_socket(struct hist_browser *browser, struct popup_action *act)
{ {
if (!sort__has_socket || act->socket < 0)
return 0;
if (browser->hists->socket_filter > -1) { if (browser->hists->socket_filter > -1) {
pstack__remove(browser->pstack, &browser->hists->socket_filter); pstack__remove(browser->pstack, &browser->hists->socket_filter);
browser->hists->socket_filter = -1; browser->hists->socket_filter = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment