From: "Wangnan (F)" <wangnan0@huawei.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
Jiri Olsa <jolsa@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Zefan Li <lizefan@huawei.com>,
He Kuang <hekuang@huawei.com>
Subject: Re: [PATCH v8 3/8] perf tests: Add testcase for auxiliary evlist
Date: Wed, 22 Jun 2016 12:10:33 +0800 [thread overview]
Message-ID: <576A0FB9.30907@huawei.com> (raw)
In-Reply-To: <20160621210538.GE4213@kernel.org>
On 2016/6/22 5:05, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jun 20, 2016 at 10:47:20AM +0000, Wang Nan escreveu:
>> Improve test backward
[SNIP]
>>
>> diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
>> index d9ba991..76e34c0 100644
>> --- a/tools/perf/tests/backward-ring-buffer.c
>> +++ b/tools/perf/tests/backward-ring-buffer.c
>> @@ -31,16 +31,19 @@ static int count_samples(struct perf_evlist *evlist, int *sample_count,
>> for (i = 0; i < evlist->nr_mmaps; i++) {
>> union perf_event *event;
>>
>> - perf_evlist__mmap_read_catchup(evlist, i);
>> - while ((event = perf_evlist__mmap_read_backward(evlist, i)) != NULL) {
>> + if (evlist->backward)
>> + perf_evlist__mmap_read_catchup(evlist, i);
> So, shouldn't this be done at perf_evlist__mmap_read_catchup()? I.e. you
> will use this only when you know that one of the evlists count_samples()
> will deal with can be a backwards one...
>
> I.e. do with perf_evlist__mmap_read_catchup the same thing you did in
> perf_evlist__mmap_read, checking there this evlist->backward.
I can make the code clearer, but I don't agree hiding evlist->backward
checker in
perf_evlist__mmap_read_catchup():
1. If we make perf_evlist__mmap_read_catchup() implicitly ignore
non-backward evlist,
then we are creating a new rule for reading from mmaps that, before
calling
perf_evlist__mmap_read() we need to call
perf_evlist__mmap_read_catchup() first.
Theoretically, existing code should be adjusted to satisify this new
rule, but
actually most of catchup does nothing.
If we don't require existing code be adjusted, then we are still
required to
clarify when catchup() is required, so evlist->backward is still
exposed.
2. I think we don't need to restrict perf_evlist__mmap_read_catchup()
for backward
ring buffer. It is a generic operations, can be used for a normal
evlist to
consume existing data in ring buffer.
> This can be done on top, so I'll continue tentatively merging this.
>
>> + while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) {
>> const u32 type = event->header.type;
>>
>> switch (type) {
>> case PERF_RECORD_SAMPLE:
>> - (*sample_count)++;
>> + if (sample_count)
>> + (*sample_count)++;
>> break;
>> case PERF_RECORD_COMM:
>> - (*comm_count)++;
>> + if (comm_count)
>> + (*comm_count)++;
> You could've avoided all this by passing some dummy integer pointer for
> the enter_sample_count case. Making the patch smaller helps reviewing
> :-)
Will do.
Thank you.
next prev parent reply other threads:[~2016-06-22 4:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 10:47 [PATCH v8 0/8] perf tools: Support overwritable ring buffer Wang Nan
2016-06-20 10:47 ` [PATCH v8 1/8] perf tools: Fix write_backwards fallback Wang Nan
2016-06-20 10:47 ` [PATCH v8 2/8] perf evlist: Introduce aux evlist Wang Nan
2016-06-20 20:36 ` Arnaldo Carvalho de Melo
2016-06-21 1:31 ` Wangnan (F)
2016-06-20 10:47 ` [PATCH v8 3/8] perf tests: Add testcase for auxiliary evlist Wang Nan
2016-06-21 21:05 ` Arnaldo Carvalho de Melo
2016-06-22 4:10 ` Wangnan (F) [this message]
2016-06-20 10:47 ` [PATCH v8 4/8] perf record: Introduce rec->overwrite_evlist for overwritable events Wang Nan
2016-06-21 21:30 ` Arnaldo Carvalho de Melo
2016-06-20 10:47 ` [PATCH v8 5/8] perf record: Toggle overwrite ring buffer for reading Wang Nan
2016-06-20 10:47 ` [PATCH v8 6/8] perf tools: Enable overwrite settings Wang Nan
2016-06-21 21:49 ` Arnaldo Carvalho de Melo
2016-06-20 10:47 ` [PATCH v8 7/8] perf tools: Don't warn about out of order event if write_backward is used Wang Nan
2016-06-20 10:47 ` [PATCH v8 8/8] perf tools: Add --tail-synthesize option Wang Nan
-- strict thread matches above, loose matches on Subject: below --
2016-06-15 2:23 [PATCH v7 0/8] perf tools: Support overwritable ring buffer Wang Nan
2016-06-15 2:23 ` [PATCH v7 1/8] perf evlist: Introduce aux evlist Wang Nan
2016-06-15 2:23 ` [PATCH v7 2/8] perf tests: Add testcase for auxiliary evlist Wang Nan
2016-06-15 2:23 ` [PATCH v7 3/8] perf record: Introduce rec->overwrite_evlist for overwritable events Wang Nan
2016-06-15 2:23 ` [PATCH v7 4/8] perf record: Toggle overwrite ring buffer for reading Wang Nan
2016-06-15 2:23 ` [PATCH v7 5/8] perf tools: Enable overwrite settings Wang Nan
2016-06-15 2:23 ` [PATCH v7 6/8] perf tools: Don't warn about out of order event if write_backward is used Wang Nan
2016-06-15 2:23 ` [PATCH v7 7/8] perf tools: Check write_backward during evlist config Wang Nan
2016-06-16 21:47 ` Arnaldo Carvalho de Melo
2016-06-20 4:09 ` Wangnan (F)
2016-06-22 7:43 ` [tip:perf/core] perf evsel: Fix write_backwards fallback tip-bot for Arnaldo Carvalho de Melo
2016-06-15 2:23 ` [PATCH v7 8/8] perf record: Unmap overwrite evlist when event terminate Wang Nan
2016-06-16 20:59 ` Arnaldo Carvalho de Melo
2016-06-20 8:04 ` Wangnan (F)
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=576A0FB9.30907@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mhiramat@kernel.org \
--cc=namhyung@kernel.org \
--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).