From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>, 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: Fri, 17 Apr 2009 13:14:23 +0200 [thread overview]
Message-ID: <c62985530904170414j1f558aa2q32431ef09f5faae5@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0904170649130.20429@gandalf.stny.rr.com>
2009/4/17 Steven Rostedt <rostedt@goodmis.org>:
>
> On Fri, 17 Apr 2009, Peter Zijlstra wrote:
>
>> On Fri, 2009-04-17 at 06:10 -0400, Steven Rostedt wrote:
>>
>> > When I replied to Frederic, I thought I could come up with a way to do
>> > something like you are proposing. Instead, I only ended up with the
>> > variant that Frederic implemented.
>> >
>> > I've done what you are suggesting several times in tracing. Logdev does
>> > this in its tracing.
>> >
>> > The problem that we have, is that we don't have actual code. We have a
>> > TRACE_EVENT macro that is doing the work for us. This, unfortunately,
>> > limits what we can do.
>>
>> Can't you do things like:
>>
>> #define __string(x) unsigned long length_##x, offset_##x;
>>
>> TP_STRUCT__entry
>>
>> size = sizeof(struct foo);
>>
>> #define __string(x) length_##x = strlen(x) + 1; size += length_##x;
>>
>> TP_STRUCT__entry
>>
>> entry = ring_buffer_lock_reserve(size);
>> offset = sizeof(stuct foo);
>>
>> #define __string(x) \
>> __entry->x = offset_##x = offset; offset += length_##x;
>>
>> TP_STRUCT__entry
>>
>> TP_fast_assign
>>
>> #define _string(x) strcpy(&entry->data[offset_##x], x);
>>
>> TP_STRUCT__entry
>>
>> ring_buffer_unlock();
>>
>> also, you don't need that __ending_string() thing, you can always end a
>> struct with char data[0], its 0 size ;-)
>>
>
> This looks very similar to what I suggested in the cross email.
>
> Frederic,
>
> You want to take a crack at implementing this. I think my description had
> a bit more details, but is basically the same as what Peter is describing
> here.
>
> I'd just make __string become an offset (as described in my email)
>
> Then the user could just index directly. They only need to worry about the
> print, the assignment would be automated.
Nice!
Ok, I will restart with it!
>
> -- Steve
>
>
next prev parent reply other threads:[~2009-04-17 11:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-16 20:00 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
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 [this message]
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=c62985530904170414j1f558aa2q32431ef09f5faae5@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
all inboxes | Powered by JetHome®