From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Zhaolei <zhaolei@cn.fujitsu.com>,
Tom Zanussi <tzanussi@gmail.com>, Li Zefan <lizf@cn.fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2 v2] tracing/events: provide string with undefined size support
Date: Thu, 16 Apr 2009 22:28:46 +0200 [thread overview]
Message-ID: <c62985530904161328g299e8a67q2012a577e8a2f1a4@mail.gmail.com> (raw)
In-Reply-To: <1239912812.23397.3432.camel@laptop>
2009/4/16 Peter Zijlstra <a.p.zijlstra@chello.nl>:
> On Thu, 2009-04-16 at 22:00 +0200, Frederic Weisbecker wrote:
>> Impact: less memory usage for tracing
>>
>> This patch provides the support for dynamic size strings on
>> event tracing.
>>
>> The key concept is to use a structure with an ending char array field of
>> undefined size and use such ability to allocate the minimal size on the ring
>> buffer to make the entry fit inside as opposite to a fixed length strings with
>> upper bound.
>>
>> This patch provides one new macro:
>>
>> -__ending_string(name, src)
>>
>> This one declares the string to the structure inside TP_STRUCT__entry.
>> You need to provide the name of the string field and the source that will be
>> copied inside.
>> Two constraints: only one __ending_string() per TRACE_EVENT can be added and
>> it must be the last field to be declared. Hence the __ending prefix.
>>
>> This macro will declare the necessary field and will also add the dynamic
>> size of the string needed for the ring buffer entry allocation.
>>
>> It also support filtering because these strings behave essentially
>> like usual fixed length string.
>
> can't we simply do __string(name, src) and output something like:
>
> struct {
> u16 size;
> char str[0];
> } name;
>
> That would get rid of this __ending_ wart.
>
>
Hmm, I don't understand.
Such a thing doesn't seem to work. Once we fill the string it would
override the fields that
follow it if it's not at the end.
next prev parent reply other threads:[~2009-04-16 20:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-16 20:00 [PATCH 1/2 v2] tracing/events: provide string with undefined size support Frederic Weisbecker
2009-04-16 20:00 ` [PATCH 2/2 v2] tracing/lock: provide lock_acquired event support for dynamic size string Frederic Weisbecker
2009-04-16 20:13 ` [PATCH 1/2 v2] tracing/events: provide string with undefined size support Peter Zijlstra
2009-04-16 20:28 ` Frédéric Weisbecker [this message]
2009-04-17 6:22 ` Peter Zijlstra
2009-04-17 8:59 ` Frédéric Weisbecker
2009-04-17 9:29 ` Peter Zijlstra
2009-04-17 10:04 ` Frédéric Weisbecker
2009-04-17 10:07 ` Frédéric Weisbecker
2009-04-17 10:10 ` Steven Rostedt
2009-04-17 10:16 ` Frédéric Weisbecker
2009-04-17 10:39 ` Peter Zijlstra
2009-04-17 10:51 ` Steven Rostedt
2009-04-17 11:14 ` Frédéric Weisbecker
2009-04-17 10:39 ` Steven Rostedt
2009-04-18 18:42 ` Frederic Weisbecker
2009-04-19 0:52 ` Steven Rostedt
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=c62985530904161328g299e8a67q2012a577e8a2f1a4@mail.gmail.com \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
--cc=zhaolei@cn.fujitsu.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