linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>, <lizefan@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
	<jolsa@redhat.com>, Wang Nan <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	He Kuang <hekuang@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Nilay Vaish <nilayvaish@gmail.com>
Subject: [PATCH v15 08/12] perf tools: Drop evlist->backward
Date: Tue, 12 Jul 2016 10:00:08 +0000	[thread overview]
Message-ID: <1468317612-11598-9-git-send-email-wangnan0@huawei.com> (raw)
In-Reply-To: <1468317612-11598-1-git-send-email-wangnan0@huawei.com>

We are going to use evlist->backward_mmap as a container for backward
ring buffer. Since a evlist can hold normal and backward ring buffers
together, evlist->backward is useless and misleading. Drop this
indicator.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: pi3orama@163.com
---
 tools/perf/builtin-record.c             | 11 +++++------
 tools/perf/tests/backward-ring-buffer.c |  1 -
 tools/perf/util/evlist.c                |  5 +----
 tools/perf/util/evlist.h                |  1 -
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b2b3b60..f89a4a6 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -119,11 +119,10 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 *start, u64 *end)
 }
 
 static int
-rb_find_range(struct perf_evlist *evlist,
-	      void *data, int mask, u64 head, u64 old,
-	      u64 *start, u64 *end)
+rb_find_range(void *data, int mask, u64 head, u64 old,
+	      u64 *start, u64 *end, bool backward)
 {
-	if (!evlist->backward) {
+	if (!backward) {
 		*start = old;
 		*end = head;
 		return 0;
@@ -143,8 +142,8 @@ static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int
 	void *buf;
 	int rc = 0;
 
-	if (rb_find_range(evlist, data, md->mask, head,
-			  old, &start, &end))
+	if (rb_find_range(data, md->mask, head,
+			  old, &start, &end, false))
 		return -1;
 
 	if (start == end)
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index 3558db7..e18fd03 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -101,7 +101,6 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
 		return TEST_FAIL;
 	}
 
-	evlist->backward = true;
 	err = perf_evlist__create_maps(evlist, &opts.target);
 	if (err < 0) {
 		pr_debug("Not enough memory to create thread/cpu maps\n");
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 6741ced..6fb693c 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -44,7 +44,6 @@ void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
 	perf_evlist__set_maps(evlist, cpus, threads);
 	fdarray__init(&evlist->pollfd, 64);
 	evlist->workload.pid = -1;
-	evlist->backward = false;
 }
 
 struct perf_evlist *perf_evlist__new(void)
@@ -853,9 +852,7 @@ union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist, in
 
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 {
-	if (!evlist->backward)
-		return perf_evlist__mmap_read_forward(evlist, idx);
-	return perf_evlist__mmap_read_backward(evlist, idx);
+	return perf_evlist__mmap_read_forward(evlist, idx);
 }
 
 void perf_mmap__read_catchup(struct perf_mmap *md)
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 8acac5f..72b9ff7 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -50,7 +50,6 @@ struct perf_evlist {
 	bool		 overwrite;
 	bool		 enabled;
 	bool		 has_user_cpus;
-	bool		 backward;
 	size_t		 mmap_len;
 	int		 id_pos;
 	int		 is_pos;
-- 
1.8.3.4

  parent reply	other threads:[~2016-07-12 10:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 10:00 [PATCH v15 00/12] perf tools: Support overwritable ring buffer Wang Nan
2016-07-12 10:00 ` [PATCH v15 01/12] perf tools: Drop redundant evsel->overwrite indicator Wang Nan
2016-07-12 10:00 ` [PATCH v15 02/12] tools lib fd array: Allow associating a pointer cookie with each entry Wang Nan
2016-07-12 10:00 ` [PATCH v15 03/12] perf tools: Update perf evlist mmap related APIs and helpers Wang Nan
2016-07-13 14:06   ` Jiri Olsa
2016-07-14  1:58     ` Wangnan (F)
2016-07-12 10:00 ` [PATCH v15 04/12] perf tools: Record mmap cookie into fdarray private field Wang Nan
2016-07-12 10:00 ` [PATCH v15 05/12] perf tools: Extract common code in mmap failure processing Wang Nan
2016-07-12 10:00 ` [PATCH v15 06/12] perf tools: Alloc backward_mmap array for evlist Wang Nan
2016-07-12 10:00 ` [PATCH v15 07/12] perf tools: Map backward events to backward_mmap Wang Nan
2016-07-13 14:06   ` Jiri Olsa
2016-07-12 10:00 ` Wang Nan [this message]
2016-07-12 10:00 ` [PATCH v15 09/12] perf record: Read from overwritable ring buffer Wang Nan
2016-07-13 14:06   ` Jiri Olsa
2016-07-13 14:07   ` Jiri Olsa
2016-07-13 14:07   ` Jiri Olsa
2016-07-12 10:00 ` [PATCH v15 10/12] perf tools: Enable overwrite settings Wang Nan
2016-07-12 10:00 ` [PATCH v15 11/12] perf tools: Don't warn about out of order event if write_backward is used Wang Nan
2016-07-12 10:00 ` [PATCH v15 12/12] perf tools: Add --tail-synthesize option Wang Nan

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=1468317612-11598-9-git-send-email-wangnan0@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=nilayvaish@gmail.com \
    --cc=pi3orama@163.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).