public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, dsahern@gmail.com, hpa@zytor.com,
	peterz@infradead.org, namhyung@kernel.org,
	linux-kernel@vger.kernel.org, jolsa@kernel.org,
	tglx@linutronix.de, mingo@kernel.org
Subject: [tip:perf/core] perf hists browser: Check sort keys before hot key actions
Date: Fri, 11 Mar 2016 00:51:36 -0800	[thread overview]
Message-ID: <tip-599a2f38a989a79df99838f22cb607f5e2b5b56c@git.kernel.org> (raw)
In-Reply-To: <1457533253-21419-3-git-send-email-namhyung@kernel.org>

Commit-ID:  599a2f38a989a79df99838f22cb607f5e2b5b56c
Gitweb:     http://git.kernel.org/tip/599a2f38a989a79df99838f22cb607f5e2b5b56c
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Wed, 9 Mar 2016 23:20:53 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 10 Mar 2016 16:48:02 -0300

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: Namhyung 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cb4191b..4b98165 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2322,6 +2322,9 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 {
 	struct thread *thread = act->thread;
 
+	if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
+		return 0;
+
 	if (browser->hists->thread_filter) {
 		pstack__remove(browser->pstack, &browser->hists->thread_filter);
 		perf_hpp__set_elide(HISTC_THREAD, false);
@@ -2379,6 +2382,9 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
 {
 	struct map *map = act->ms.map;
 
+	if (!sort__has_dso || map == NULL)
+		return 0;
+
 	if (browser->hists->dso_filter) {
 		pstack__remove(browser->pstack, &browser->hists->dso_filter);
 		perf_hpp__set_elide(HISTC_DSO, false);
@@ -2530,6 +2536,9 @@ add_exit_opt(struct hist_browser *browser __maybe_unused,
 static int
 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) {
 		pstack__remove(browser->pstack, &browser->hists->socket_filter);
 		browser->hists->socket_filter = -1;

  reply	other threads:[~2016-03-11  8:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 14:20 [PATCH 1/3] perf tools: Add sort__has_comm variable Namhyung Kim
2016-03-09 14:20 ` [PATCH 2/3] perf hists browser: Allow thread filtering for comm sort key Namhyung Kim
2016-03-09 14:26   ` Arnaldo Carvalho de Melo
2016-03-09 15:14     ` [PATCH v2 " Namhyung Kim
2016-03-11  8:51       ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-09 14:20 ` [PATCH 3/3] perf hists browser: Check sort keys before hot key actions Namhyung Kim
2016-03-11  8:51   ` tip-bot for Namhyung Kim [this message]
2016-03-11  8:50 ` [tip:perf/core] perf tools: Add sort__has_comm variable tip-bot for Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-599a2f38a989a79df99838f22cb607f5e2b5b56c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox