linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, mingo@kernel.org, jolsa@redhat.com,
	linux-kernel@vger.kernel.org, adrian.hunter@intel.com,
	acme@redhat.com, tglx@linutronix.de
Subject: [tip:perf/urgent] perf auxtrace: Make auxtrace_queues__add_buffer() do CPU filtering
Date: Mon, 9 Apr 2018 22:28:13 -0700	[thread overview]
Message-ID: <tip-b238db655796e74b59d9ece58b645ad0b494d615@git.kernel.org> (raw)
In-Reply-To: <1520327598-1317-8-git-send-email-adrian.hunter@intel.com>

Commit-ID:  b238db655796e74b59d9ece58b645ad0b494d615
Gitweb:     https://git.kernel.org/tip/b238db655796e74b59d9ece58b645ad0b494d615
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 6 Mar 2018 11:13:18 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 6 Apr 2018 09:40:41 -0300

perf auxtrace: Make auxtrace_queues__add_buffer() do CPU filtering

In preparation for supporting AUX area sampling buffers,
auxtrace_queues__add_buffer() needs to be more generic. To that end, move
CPU filtering into it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1520327598-1317-8-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/auxtrace.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index e1aff91c54a8..857de69a5361 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -302,6 +302,13 @@ static int auxtrace_queues__split_buffer(struct auxtrace_queues *queues,
 	return 0;
 }
 
+static bool filter_cpu(struct perf_session *session, int cpu)
+{
+	unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
+
+	return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
+}
+
 static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
 				       struct perf_session *session,
 				       unsigned int idx,
@@ -310,6 +317,9 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
 {
 	int err = -ENOMEM;
 
+	if (filter_cpu(session, buffer->cpu))
+		return 0;
+
 	buffer = memdup(buffer, sizeof(*buffer));
 	if (!buffer)
 		return -ENOMEM;
@@ -344,13 +354,6 @@ out_free:
 	return err;
 }
 
-static bool filter_cpu(struct perf_session *session, int cpu)
-{
-	unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
-
-	return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
-}
-
 int auxtrace_queues__add_event(struct auxtrace_queues *queues,
 			       struct perf_session *session,
 			       union perf_event *event, off_t data_offset,
@@ -367,9 +370,6 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues,
 	};
 	unsigned int idx = event->auxtrace.idx;
 
-	if (filter_cpu(session, event->auxtrace.cpu))
-		return 0;
-
 	return auxtrace_queues__add_buffer(queues, session, idx, &buffer,
 					   buffer_ptr);
 }

      parent reply	other threads:[~2018-04-10  5:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06  9:13 [PATCH 0/7] perf tools: Prepare for AUX area sampling support Adrian Hunter
2018-03-06  9:13 ` [PATCH 1/7] perf record: Combine some auxtrace initialization into a single function Adrian Hunter
2018-03-09  8:38   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 2/7] perf auxtrace: Prevent decoding when --no-itrace Adrian Hunter
2018-03-06 14:06   ` Arnaldo Carvalho de Melo
2018-03-06 14:21     ` Adrian Hunter
2018-03-06 14:32       ` Arnaldo Carvalho de Melo
2018-03-07  8:27   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 3/7] perf auxtrace: Add missing parameters from kernel-doc comments Adrian Hunter
2018-03-09  8:40   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 4/7] perf auxtrace: Rename some buffer-queuing functions Adrian Hunter
2018-03-09  8:40   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 5/7] perf auxtrace: Make auxtrace_queues__add_buffer() return buffer_ptr Adrian Hunter
2018-03-09  8:41   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 6/7] perf auxtrace: Make auxtrace_queues__add_buffer() allocate struct buffer Adrian Hunter
2018-03-06 20:25   ` Arnaldo Carvalho de Melo
2018-03-07  8:06     ` Adrian Hunter
2018-03-07 14:11       ` Arnaldo Carvalho de Melo
2018-04-05  6:17         ` Adrian Hunter
2018-04-05 11:33           ` Arnaldo Carvalho de Melo
2018-04-06 17:04   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 7/7] perf auxtrace: Make auxtrace_queues__add_buffer() do CPU filtering Adrian Hunter
2018-04-06 11:44   ` Adrian Hunter
2018-04-10  5:28   ` tip-bot for Adrian Hunter [this message]

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-b238db655796e74b59d9ece58b645ad0b494d615@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.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=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;
as well as URLs for NNTP newsgroup(s).