All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, hpa@zytor.com, namhyung@gmail.com,
	tglx@linutronix.de, acme@redhat.com, jolsa@redhat.com,
	eranian@google.com, adrian.hunter@intel.com, fweisbec@gmail.com,
	dsahern@gmail.com, linux-kernel@vger.kernel.org,
	mingo@kernel.org
Subject: [tip:perf/core] perf script: Always allow fields 'addr' and 'cpu' for auxtrace
Date: Tue, 5 May 2015 20:12:06 -0700	[thread overview]
Message-ID: <tip-6d5cdd64f314e03c8606c777dc44b09769f8e038@git.kernel.org> (raw)
In-Reply-To: <1429903807-20559-3-git-send-email-adrian.hunter@intel.com>

Commit-ID:  6d5cdd64f314e03c8606c777dc44b09769f8e038
Gitweb:     http://git.kernel.org/tip/6d5cdd64f314e03c8606c777dc44b09769f8e038
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Fri, 24 Apr 2015 22:29:44 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 4 May 2015 12:43:49 -0300

perf script: Always allow fields 'addr' and 'cpu' for auxtrace

If a file contains AUX area tracing data then always allow fields 'addr'
and 'cpu' to be selected as options for perf script.  This is necessary
because AUX area decoding may synthesize events with that information.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1429903807-20559-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index cd2f38b..6805098 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -148,9 +148,10 @@ static const char *output_field2str(enum perf_output_field field)
 
 #define PRINT_FIELD(x)  (output[attr->type].fields & PERF_OUTPUT_##x)
 
-static int perf_evsel__check_stype(struct perf_evsel *evsel,
-				   u64 sample_type, const char *sample_msg,
-				   enum perf_output_field field)
+static int perf_evsel__do_check_stype(struct perf_evsel *evsel,
+				      u64 sample_type, const char *sample_msg,
+				      enum perf_output_field field,
+				      bool allow_user_set)
 {
 	struct perf_event_attr *attr = &evsel->attr;
 	int type = attr->type;
@@ -160,6 +161,8 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel,
 		return 0;
 
 	if (output[type].user_set) {
+		if (allow_user_set)
+			return 0;
 		evname = perf_evsel__name(evsel);
 		pr_err("Samples for '%s' event do not have %s attribute set. "
 		       "Cannot print '%s' field.\n",
@@ -177,10 +180,22 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel,
 	return 0;
 }
 
+static int perf_evsel__check_stype(struct perf_evsel *evsel,
+				   u64 sample_type, const char *sample_msg,
+				   enum perf_output_field field)
+{
+	return perf_evsel__do_check_stype(evsel, sample_type, sample_msg, field,
+					  false);
+}
+
 static int perf_evsel__check_attr(struct perf_evsel *evsel,
 				  struct perf_session *session)
 {
 	struct perf_event_attr *attr = &evsel->attr;
+	bool allow_user_set;
+
+	allow_user_set = perf_header__has_feat(&session->header,
+					       HEADER_AUXTRACE);
 
 	if (PRINT_FIELD(TRACE) &&
 		!perf_session__has_traces(session, "record -R"))
@@ -193,8 +208,8 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
 	}
 
 	if (PRINT_FIELD(ADDR) &&
-		perf_evsel__check_stype(evsel, PERF_SAMPLE_ADDR, "ADDR",
-					PERF_OUTPUT_ADDR))
+		perf_evsel__do_check_stype(evsel, PERF_SAMPLE_ADDR, "ADDR",
+					   PERF_OUTPUT_ADDR, allow_user_set))
 		return -EINVAL;
 
 	if (PRINT_FIELD(SYM) && !PRINT_FIELD(IP) && !PRINT_FIELD(ADDR)) {
@@ -231,8 +246,8 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
 		return -EINVAL;
 
 	if (PRINT_FIELD(CPU) &&
-		perf_evsel__check_stype(evsel, PERF_SAMPLE_CPU, "CPU",
-					PERF_OUTPUT_CPU))
+		perf_evsel__do_check_stype(evsel, PERF_SAMPLE_CPU, "CPU",
+					   PERF_OUTPUT_CPU, allow_user_set))
 		return -EINVAL;
 
 	if (PRINT_FIELD(PERIOD) &&

  reply	other threads:[~2015-05-06  3:12 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 19:29 [PATCH V3 00/25] perf tools: Introduce an abstraction for AUX Area and Instruction Tracing Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 01/25] perf tools: Amend mmap ref counting for the AUX area mmap Adrian Hunter
2015-05-06  3:11   ` [tip:perf/core] perf evlist: " tip-bot for Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 02/25] perf script: Always allow fields 'addr' and 'cpu' for auxtrace Adrian Hunter
2015-05-06  3:12   ` tip-bot for Adrian Hunter [this message]
2015-04-24 19:29 ` [PATCH V3 03/25] perf report: Add Instruction Tracing support Adrian Hunter
2015-05-06  3:12   ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 04/25] perf tools: Add AUX area tracing index Adrian Hunter
2015-04-28 12:07   ` Jiri Olsa
2015-04-29 11:26     ` Adrian Hunter
2015-04-28 12:32   ` Jiri Olsa
2015-04-29 12:11     ` Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 05/25] perf tools: Hit all build ids when AUX area tracing Adrian Hunter
2015-04-28 12:45   ` Jiri Olsa
2015-04-29 12:24     ` Adrian Hunter
2015-04-29 15:26       ` Jiri Olsa
2015-04-24 19:29 ` [PATCH V3 06/25] perf tools: Add build option NO_AUXTRACE to exclude " Adrian Hunter
2015-04-28 12:59   ` Jiri Olsa
2015-04-24 19:29 ` [PATCH V3 07/25] perf auxtrace: Add option to synthesize events for transactions Adrian Hunter
2015-04-28 13:02   ` Jiri Olsa
2015-04-24 19:29 ` [PATCH V3 08/25] perf tools: Add support for PERF_RECORD_AUX Adrian Hunter
2015-04-28 13:09   ` Jiri Olsa
2015-04-24 19:29 ` [PATCH V3 09/25] perf tools: Add support for PERF_RECORD_ITRACE_START Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 10/25] perf tools: Add AUX area tracing Snapshot Mode Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 11/25] perf record: Add AUX area tracing Snapshot Mode support Adrian Hunter
2015-04-28 13:24   ` Jiri Olsa
2015-04-29 13:14     ` Adrian Hunter
2015-04-29 15:23       ` Jiri Olsa
2015-04-24 19:29 ` [PATCH V3 12/25] perf auxtrace: Add Intel PT as an AUX area tracing type Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 13/25] perf tools: Add Intel PT packet decoder Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 14/25] perf tools: Add Intel PT instruction decoder Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 15/25] perf tools: Add Intel PT log Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 16/25] perf tools: Add Intel PT decoder Adrian Hunter
2015-04-24 19:29 ` [PATCH V3 17/25] perf tools: Add Intel PT support Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 18/25] perf tools: Take Intel PT into use Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 19/25] perf tools: Allow auxtrace data alignment Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 20/25] perf tools: Add Intel BTS support Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 21/25] perf tools: Output sample flags and insn_len from intel_pt Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 22/25] perf tools: Output sample flags and insn_len from intel_bts Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 23/25] perf tools: Intel PT to always update thread stack trace number Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 24/25] perf tools: Intel BTS " Adrian Hunter
2015-04-24 19:30 ` [PATCH V3 25/25] perf tools: Add example call-graph script Adrian Hunter
2015-04-24 20:33 ` [PATCH V3 00/25] perf tools: Introduce an abstraction for AUX Area and Instruction Tracing Arnaldo Carvalho de Melo
2015-04-28 14:33 ` Arnaldo Carvalho de Melo

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-6d5cdd64f314e03c8606c777dc44b09769f8e038@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.