linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: acme@kernel.org
Cc: jolsa@redhat.com, kan.liang@intel.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, namhyung@kernel.org,
	ak@linux.intel.com, yao.jin@linux.intel.com,
	linux-kernel@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: [PATCH v2 2/3] perf report: Make -F more strict like -s
Date: Thu, 14 Nov 2019 18:52:12 +0530	[thread overview]
Message-ID: <20191114132213.5419-3-ravi.bangoria@linux.ibm.com> (raw)
In-Reply-To: <20191114132213.5419-1-ravi.bangoria@linux.ibm.com>

Currently -F allows branch-mode / mem-mode fields with -F even
when perf report is not running in that mode. Don't allow that.

Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/util/sort.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index cba8f22e4ffb..9999f6853440 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -2974,6 +2974,9 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
+		if (sort__mode != SORT_MODE__BRANCH)
+			return -EINVAL;
+
 		return __sort_dimension__add_output(list, sd);
 	}
 
@@ -2983,6 +2986,9 @@ int output_field_add(struct perf_hpp_list *list, char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
+		if (sort__mode != SORT_MODE__MEMORY)
+			return -EINVAL;
+
 		return __sort_dimension__add_output(list, sd);
 	}
 
-- 
2.21.0


  parent reply	other threads:[~2019-11-14 13:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 13:22 [PATCH v2 0/3] perf report: Few fixes Ravi Bangoria
2019-11-14 13:22 ` [PATCH v2 1/3] perf hists: Replace pr_err with ui__error Ravi Bangoria
2019-12-04 15:26   ` Arnaldo Carvalho de Melo
2019-12-06  8:03   ` [tip: perf/urgent] perf report/top TUI: Replace pr_err() with ui__error() tip-bot2 for Ravi Bangoria
2019-11-14 13:22 ` Ravi Bangoria [this message]
2019-12-06  8:03   ` [tip: perf/urgent] perf report: Make -F more strict like -s tip-bot2 for Ravi Bangoria
2019-11-14 13:22 ` [PATCH v2 3/3] perf report: Bail out --mem-mode if mem info is not available Ravi Bangoria
2019-12-06  8:03   ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria
2019-12-04 10:36 ` [PATCH v2 0/3] perf report: Few fixes Ravi Bangoria
2019-12-04 12:07 ` Jiri Olsa

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=20191114132213.5419-3-ravi.bangoria@linux.ibm.com \
    --to=ravi.bangoria@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=yao.jin@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).