linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <acme@redhat.com>, <paulus@samba.org>, <kan.liang@intel.com>,
	<linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
	<lizefen@huawei.com>, Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Yunlong Song <yunlong.song@huawei.com>
Subject: Re: [RFC PATCH] perf/core: Put size of a sample at the end of it
Date: Thu, 3 Dec 2015 18:31:49 +0800	[thread overview]
Message-ID: <56601A15.506@huawei.com> (raw)
In-Reply-To: <20151203100801.GV3816@twins.programming.kicks-ass.net>



On 2015/12/3 18:08, Peter Zijlstra wrote:
> On Wed, Dec 02, 2015 at 01:38:19PM +0000, Wang Nan wrote:
>> This sloution requires user program (perf) do more things. At least
>> following things and limitations should be considered:
>>
>>   1. Before reading such ring buffer, perf must ensure all events which
>>      may output to it is already stopped, so the 'head' pointer it get
>>      is the end of the last record.
> Right, this is tricky, this would not allow two snapshots to happen back
> to back since that would then result in a bunch of missed events.
>
> Aside from this issue its a rather nice idea.

Thank you for your attitude. We can start consider it seriously.

Now I'm working on perf side code to make a workable prototype.

>>   2. We must ensure all events attached this ring buffer has
>>      'PERF_SAMPLE_SIZE' selected.
> That can be easily enforced.

Yes.

>>   3. There must no tracking events output to this ring buffer.
> That is rather unfortunate, we'd best fix that up.
>
>>   4. 2 bytes extra space is required for each record.
> 8, perf records must be 8 byte aligned and sized.

So does it means we need to pad before outputing size?

>> Further improvement can be taken:
>>
>>   1. If PERF_SAMPLE_SIZE is selected, we can avoid outputting the event
>>      size in header. Which eliminate extra space cose;
> That would mandate you always parse the stream backwards. Which seems
> rather unfortunate. Also, no you cannot recoup the extra space, see the
> alignment and size requirement.

That's good. We don't need to consider this :)

Before receiving your comment I'm thinking about modifying
DEFINE_OUTPUT_COPY() to write first sizeof(header) bytes at the
end of reserved area, so it would work automatically for every
possible events.

>>   2. We can find a way to append size information for tracking events
>>      also.
> The !sample records you mean? Yes those had better have them too.

Thank you.


  reply	other threads:[~2015-12-03 10:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 14:00 [PATCH] perf record: Add snapshot mode support for perf's regular events Yunlong Song
2015-11-24 14:00 ` Yunlong Song
2015-11-24 14:30   ` Arnaldo Carvalho de Melo
2015-11-25 12:44     ` Yunlong Song
2015-11-24 15:06   ` David Ahern
2015-11-24 15:20     ` Arnaldo Carvalho de Melo
2015-11-24 15:24       ` David Ahern
2015-11-24 15:40         ` Arnaldo Carvalho de Melo
2015-11-24 16:16           ` David Ahern
2015-11-25  3:50       ` Wangnan (F)
2015-11-25  5:06         ` David Ahern
2015-11-25  7:22         ` Adrian Hunter
2015-11-25  7:47           ` Wangnan (F)
2015-11-25  8:27             ` Adrian Hunter
2015-11-25  8:43               ` Wangnan (F)
2015-11-25  9:05                 ` Adrian Hunter
2015-11-25  7:50     ` Yunlong Song
2015-11-25  9:27 ` Peter Zijlstra
2015-11-25  9:44   ` Wangnan (F)
2015-11-25 12:20     ` Peter Zijlstra
2015-11-25 12:54       ` Wangnan (F)
2015-11-26  9:19         ` Ingo Molnar
2015-11-26  9:24           ` Wangnan (F)
2015-11-26  9:27           ` Ingo Molnar
2015-11-26  9:40             ` Ingo Molnar
2015-11-26  9:57             ` Ingo Molnar
2015-12-02  8:25   ` Wangnan (F)
2015-12-02 13:38     ` [RFC PATCH] perf/core: Put size of a sample at the end of it Wang Nan
2015-12-03 10:08       ` Peter Zijlstra
2015-12-03 10:31         ` Wangnan (F) [this message]
2015-12-07 13:28       ` [RFC PATCH v2 0/3] perf core/perf tools: Utilizing overwrite ring buffer Wang Nan
2015-12-07 13:28         ` [RFC PATCH v2 1/3] perf/core: Put size of a sample at the end of it Wang Nan
2015-12-07 13:28         ` [RFC PATCH v2 2/3] perf tools: Enable overwrite settings Wang Nan
2015-12-07 13:28         ` [RFC PATCH v2 3/3] perf record: Find tail pointer through size at end of event 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=56601A15.506@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefen@huawei.com \
    --cc=mingo@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=pi3orama@163.com \
    --cc=yunlong.song@huawei.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).