Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282915

Re: [RFC PATCH] perf/core: Put size of a sample at the end of it

From "Wangnan (F)" <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] perf/core: Put size of a sample at the end of it
Date 2015-12-03 11:40 +0100
Message-ID <qBzsS-3Jm-19@gated-at.bofh.it> (permalink)
References <qBaXv-4EG-11@gated-at.bofh.it> <qBfXe-7QB-61@gated-at.bofh.it> <qByZP-3zg-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] perf record: Add snapshot mode support for perf's regular  events "Wangnan (F)" <wangnan0@huawei.com> - 2015-12-02 09:30 +0100
  [RFC PATCH] perf/core: Put size of a sample at the end of it Wang Nan <wangnan0@huawei.com> - 2015-12-02 14:50 +0100
    Re: [RFC PATCH] perf/core: Put size of a sample at the end of it Peter Zijlstra <peterz@infradead.org> - 2015-12-03 11:10 +0100
      Re: [RFC PATCH] perf/core: Put size of a sample at the end of it "Wangnan (F)" <wangnan0@huawei.com> - 2015-12-03 11:40 +0100
    [RFC PATCH v2 2/3] perf tools: Enable overwrite settings Wang Nan <wangnan0@huawei.com> - 2015-12-07 14:40 +0100
    [RFC PATCH v2 0/3] perf core/perf tools: Utilizing overwrite ring buffer Wang Nan <wangnan0@huawei.com> - 2015-12-07 14:40 +0100
      [RFC PATCH v2 1/3] perf/core: Put size of a sample at the end of it Wang Nan <wangnan0@huawei.com> - 2015-12-07 14:40 +0100
      [RFC PATCH v2 3/3] perf record: Find tail pointer through size at end of event Wang Nan <wangnan0@huawei.com> - 2015-12-07 14:40 +0100

csiph-web